2017-02-16 65 views
1

我想安装yaml-cpp库。docker中的库安装

要安装在Ubuntu(我的电脑),我通常从github克隆它,做下列步骤操作:

cmake cmake [-G generator] [-DBUILD_SHARED_LIBS=ON|OFF] .. 
make 
make install 

,它工作正常。

我在Docker中执行相同的步骤。然后,我开始MyProjectCMakeLists.txttarget_link_libraries(MyProject yaml-cpp)

链接它针对yaml-cpp库,但我有错误,当我尝试在可执行文件启动:

./MyProject: error while loading shared libraries: libyaml-cpp.so.0.5: cannot open shared object file: No such file or directory 

UPD

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"] 
+0

有关您的dockerfile的更多信息会很棒 – clue404

+0

发布您的Dockerfile,以便我们可以看到您如何构建此映像。 – gbolo

+0

@ ro0kie4 @gbolo我已经添加了'Dockerfile' –

回答

0

我已经simil与我自己的共享库内码头集装箱问题。由于某种原因,即使我把它放在/ usr/local/lib /目录下,我的应用程序也找不到库。在主机中一切正常。神奇的是,在Docker容器中执行cli命令后,app才开始工作,该容器只查找ldd搜索路径:ldconfig -v | grep -v^$'\ t'。