我想在Docker中安装yaml-cpp库。我可以通过以下步骤在我的PC (Ubuntu)上安装这个github回购:
cmake cmake [-G generator] [-DBUILD_SHARED_LIBS=ON|OFF] ..
make
make install和yaml-cpp工作正常.
我在码头做同样的步骤。然后启动MyProject并将其链接到CMakeLists.txt中的yaml-cpp库。
target_link_libraries(MyProject yaml-cpp)但是,当我试图在可执行文件中启动时出现了错误:
./MyProject: error while loading shared libraries: libyaml-cpp.so.0.5: cannot open shared object file: No such file or directory更新
我的Dockerfile是:
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y \
sudo \
git \
build-essential \
cmake \
libboost-dev \
libboost-all-dev \
doxygen \
unzip \
python3 \
wget
## Install SimGrid
RUN git clone https://github.com/simgrid/simgrid.git
WORKDIR "/simgrid"
RUN cmake -Denable_documentation=OFF -Denable_coverage=OFF \
-Denable_java=OFF -Denable_model-checking=OFF \
-Denable_lua=OFF -Denable_compile_optimizations=OFF -Denable_smpi=OFF \
-Denable_smpi_MPICH3_testsuite=OFF -Denable_compile_warnings=OFF .
RUN sudo sync; sudo make; sudo make install;
RUN cd lib && sudo cp * /usr/lib; cd ../include && sudo cp -a * /usr/include
## Install yaml-cpp parser
RUN git clone https://github.com/jbeder/yaml-cpp.git
WORKDIR "/yaml-cpp"
RUN mkdir build && cd build && cmake -DBUILD_SHARED_LIBS=ON .. && cd .. && make && make install
# LHCb grid simulation project
WORKDIR "/"
RUN git clone https://github.com/skygrid/grid_simulation.git
WORKDIR "/grid_simulation"
RUN sudo sysctl -w vm.max_map_count=500000
CMD ["./run.sh"]发布于 2017-10-05 11:08:18
我也有类似的问题,在我自己的共享库内的码头容器。由于某种原因,我的应用程序找不到库,尽管我已经将它放到了/usr/local/lib/目录中。在主机里一切都很好。
神奇的是,app在仅仅找到ldconfig -v \ grep -v ^$'\t‘的停靠容器中执行cli命令后才开始工作。
https://stackoverflow.com/questions/42285083
复制相似问题