Docker构建错误/usr/bin/ld:找不到-lstdc fedora29

docker build error /usr/bin/ld: cannot find -lstdc++ fedora29

本文关键字:找不到 -lstdc fedora29 ld bin 构建 错误 usr Docker      更新时间:2023-10-16

我正在尝试使用以下dockerfile来构建docker容器:

FROM fedora:29
RUN dnf -y update && dnf install -y file gcc gcc-c++ git make wget which libtool python3-pip redhat-rpm-config python3-devel zlib-devel libstdc++ openmpi-devel
RUN cd /tmp && 
wget http://www.mpich.org/static/downloads/3.3/mpich-3.3.tar.gz && 
gzip -dc mpich-3.3.tar.gz | tar xf - && 
cd mpich-3.3 && 
./configure --disable-fortran --prefix=/usr/mpich-3.3 && 
make && 
make install
ENV PATH            /usr/mpich-3.3/bin:${PATH}
ENV LD_LIBRARY_PATH /usr/mpich-3.3/lib:${LD_LIBRARY_PATH}
RUN cd /usr && git clone https://github.com/Dowell-Lab/FStitch
RUN              cd /usr/FStitch/src && make clean && make
RUN pip3 install FStitch-Bidir --user
ENV PATH            /usr/FStitch/src:${PATH}
ENV PATH            /root/.local/bin:${PATH}
RUN cd /usr && git clone https://github.com/Dowell-Lab/Tfit
RUN              cd /usr/Tfit/src && make clean && make 
ENV PATH            /usr/Tfit/src:${PATH}
CMD /bin/bash

我要克隆的项目写在C 11中,而两个(TFIT)中的第二个需要OpenMPI/mpich。第一个程序成功编译了,但是第二个程序在编译器的最后一步中遇到以下错误:

/usr/bin/ld: cannot find -lstdc++
collect2: error: ld returned 1 exit status
make: *** [Makefile:20: NU_FIT] Error 1

我搜索并找到了这两个链接:

cpp:usr/bin/ld:找不到-l< nameofthelibrary>

usr/bin/ld:找不到-l< nameofthelibrary>

,但是这两个都没有解决这个问题,因为我猜我只是错过了库的依赖性/符号链接,但是我不确定如何在构建中实现这一目标。我可以在本地成功编译,但是我必须模块加载MPI/OpenMPI-X86_64才能这样做。我的猜测是,在设置LD_Library_path时,这是一个开放性问题,但不确定如何在Docker Build中解决此问题。

makefile的前几行如下:

CXX             = mpic++
CXXFLAGS        = -static-libstdc++ -static-libgcc  -Wno-unused-variable -Wno-non-virtual-dtor -std=c++11 -fopenmp -Wno-write-strings -Wno-literal-suffix -D_GLIBCXX_USE_CXX11_ABI=0 -g
EXEC            = ${PWD}/Tfit
ARCH                     = getconf LONG_BIT
CPP_FLAGS_32    = -D32_BIT
CPP_FLAGS_64    = -D64_BIT
GCCVERSION      = $(shell ${CXX} -dumpversion)
NU_FIT: main.o load.o split.o model.o across_segments.o template_matching.o 
    read_in_parameters.o model_selection.o error_stdo_logging.o 
    MPI_comm.o  density_profiler.o bootstrap.o prelim_main.o model_main.o select_main.o FDR.o BIC.o ParamWrapper.o old_template_matching.o
    @printf "linking               : "
    @${CXX} ${CXXFLAGS}  ${PWD}/main.o ${PWD}/load.o ${PWD}/model_selection.o 
    ${PWD}/split.o ${PWD}/model.o ${PWD}/across_segments.o  
    ${PWD}/template_matching.o ${PWD}/read_in_parameters.o  
    ${PWD}/MPI_comm.o   
    ${PWD}/bootstrap.o ${PWD}/density_profiler.o 
    ${PWD}/prelim_main.o ${PWD}/model_main.o ${PWD}/BIC.o ${PWD}/FDR.o  
    ${PWD}/select_main.o  ${PWD}/error_stdo_logging.o ${PWD}/ParamWrapper.o ${PWD}/old_template_matching.o -o ${EXEC} -lmpi
    @cp ${PWD}/Tfit ${PWD}/EMGU

任何帮助都将受到赞赏!

尝试在dnf install列表中添加libstdc++-static。(https://github.com/numenta/nupic/issues/1901)