如何解决如何在 bazel 构建时让 bazel 生成临时静态库 //
我使用 bazel 来构建 tensorflow 和 tensorflow/serving,通常当我用 bazel 构建 tensorflow/serving 时,bazel 会在 bazel-bin/tensorflow_serving/core/
中为我生成一些静态库。
例如,在我成功构建 tensorflow/serving 之后,我得到了 bazel-bin/tensorflow_serving/core/libaspired_version_policy.a
等等。
但是在另一个 docker 实例上构建 tensorflow/serving 时情况发生了变化,在 bazel-bin/tensorflow_serving/core/
下我只有 _objs
,不再有静态库,怎么会?
我应该怎么做才能获得这些静态库?
这是我的 Dockerfile:
FROM tensorflow/tensorflow:1.15.5-py3
LABEL version="1.0.0"
WORKDIR /root/
ENV TMP=/tmp
RUN export https_proxy=http://220.181.102.178:8118 && \
export http_proxy=http://220.181.102.178:8118
RUN ln -s /usr/local/bin/gfortran /usr/bin/gfortran
RUN apt-get update -yq ; exit 0
RUN apt-get install -yq software-properties-common apt-utils && apt-get update -yq; exit 0
RUN apt-get install -yq vim tree clang gdb make git
RUN apt-get install -yq automake bison flex libboost-all-dev libevent-dev
RUN apt-get install -yq libssl-dev ssh libtool pkg-config
RUN apt-get install -yq default-jdk default-jre libunwind8-dev libc-ares-dev
RUN apt-get install -yq python-numpy python-future libleveldb-dev libsnappy-dev libgoogle-perftools-dev
RUN apt-get install -yq librdkafka-dev libapr1-dev libaprutil1-dev texinfo unzip zip
RUN unset TF_NEED_CUDA
## To install go,uncomment below
#RUN add-apt-repository ppa:longsleep/golang-backports -y
#RUN apt-get install -yq golang-go
RUN add-apt-repository ppa:ubuntu-toolchain-r/test -y
RUN apt-get install -yq gcc-8 g++-8
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 80 \
--slave /usr/bin/g++ g++ /usr/bin/g++-8 \
--slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-8 \
--slave /usr/bin/gcc-nm gcc-nm /usr/bin/gcc-nm-8 \
--slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-8
RUN export https_proxy=http://220.181.102.178:8118 && wget https://github.com/Kitware/CMake/releases/download/v3.18.5/cmake-3.18.5-Linux-x86_64.sh && \
bash cmake-3.18.5-Linux-x86_64.sh --prefix=/usr/ --skip-license && \
rm -rf cmake-3.18.5-Linux-x86_64.sh
RUN export https_proxy=http://220.181.102.178:8118 && wget https://github.com/bazelbuild/bazel/releases/download/0.24.1/bazel-0.24.1-installer-linux-x86_64.sh && \
bash bazel-0.24.1-installer-linux-x86_64.sh && rm -rf bazel-0.24.1-installer-linux-x86_64.sh
RUN mkdir .ssh/
ADD .ssh/ .ssh/
ADD .vimrc .
ADD .bashrc .
RUN export PATH=/usr/local/cuda/bin:$PATH && export LD_LIBRARY_PATH=/usr/local/cuda/lib64:/lib:/lib64:/usr/lib:/usr/lib64:/usr/local/lib:/usr/local/lib64:$LD_LIBRARY_PATH
RUN git config --global credential.helper store
巴泽尔版本:0.24.1
tensorflow/serving 版本:1.15.0 从 github 发布页面下载。
构建命令:
export https_proxy=http://10.130.48.179:3128
unset TF_NEED_CUDA
# Build tensorflow_model_server
bazel build -c opt --copt=-msse4.1 --copt=-msse4.2 --copt=-mavx --copt=-mavx2 --copt=-mfma --copt=-O3 --copt=-march=native --cxxopt="-fexceptions" --verbose_failures //tensorflow_serving/model_servers:tensorflow_model_server
请帮忙。谢谢。
解决方法
要构建 canvas {
border: 1px solid red;
}
,Bazel 只需要 <script src="https://rawgit.com/kangax/fabric.js/master/dist/fabric.js"></script>
<canvas id="c" width="250" height="250"></canvas>
<button id="rotate">rotate</button>
文件。制作静态库会很浪费,因为 //tensorflow_serving/model_servers:tensorflow_model_server
规则不需要它们。使用 *.o
构建该特定库,或仅使用 cc_binary
构建工作区中的所有内容
将 linkstatic=0
放入每个 cc_library
调用中,这应该足以强制 bazel 为每个 cc_library
创建静态库。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。