符号查找错误:_FileName_:未定义符号:_intel_fast_memmove

时间:2016-12-19 16:46:40

标签: c++ fortran linker-errors

所以我正在努力将Fortran和C ++代码链接在一起,当我尝试运行可执行文件时,我遇到了上述错误。我已经做了一些寻找其他解决方案,到目前为止我找到的所有东西都没有帮助。我会试着把所有东西都包括在内,但是我对这种东西并不是那么好,所以如果还有什么需要/有用的东西让我知道,我会抓住它。

生成文件:

LDLIBS = -I/share/apps/intel/composer_xe_2011.sp1.10.319/mkl/include \
         -L/share/apps/intel/composer_xe_2011_sp1.10.319/mkl/lib/intel64 \
         -I/share/apps/intel/composer_xe_2011_sp1.10.319/mkl/interfaces/lapack95/source\
         -mkl -openmp -reentrancy threaded

INCLUDE = -I/path/mstl/include \
          -I/path/mstl/include/physics \
          -I/path/mstl/include/math2 \
          -I/path/mstl/include/math2/algebra \
          -I/path/mstl/include/mat2/analysis \
          -I/path/mstl/include/math2/data \
          -I/path/mstl/include/math2/geometry \
          -I/path/mstl/include/math2/group \
          -I/path/mstl/include/math2/spline \
          -I/path/mstl/include/math2/probabilityandstatistics

LIBRARY = -L/path/mstl/lib

FC = ifort -c             #f compiler
CC = icc -c               #c compiler
LK = ifort -v -o ../abXX  #linker

CF = -mcmodel=large -i-dynamic -no-ipo -r8 -xW -traceback -fpe0 #f compile flags
OF = $(CF) -O2                                                  #f optimization flags
DF = $(CF) -g -debug -fpskchk -C -warn interfaces               #f debug flags

OPTIONS = -O -loops -lstdc++ -lmstl.icc          #c compile flags
LKOPS = -icc -lstdc++ -lmstl.icc -cxxlib -lintlc #linking options for C libs

COMP = $(FC) $(OF)                               #fortran compiler
CMP = $(CC) $(LIBRARY) $(INCLUDE) $(OPTIONS)     #C++ compiler
LINK = $(LK) $(OF)                               #program linker

MODULES = list of all fortran .o files here. 

COBJS = list of all c++ .o files here.

.cpp.o:
       $(CMP) $<

.f.o:
       $(COMP) $<

../abXX: $(MODULES) $(COBJS)
        $(LINK) $(MODULES) $(COBJS) $(LDLIBS) $(LIBRARY) $(INCLUDE) $(LKOPS)

clean:
      rm -v -f *.o *.mod ../abXX

.mybashrc:

echo "I exist in mybashrc"

export PATH=$PATH:/opt/intel/composer_xe_2011_sp1/bin
export PATH=$PATH:/opt/INTEL/bin

source /opt/INTEL/bin/compilervars.sh intel64
export LD_LIBRARY_PATH = $LD_LIBRARY_PATH:/opt/intel/composerxe/mkl/lib/intel64/
export LD_LIBRARY_PATH = /opt/intel/composer_xe_2011_sp1.10.319/compiler/lib/intel64/:$LD_LIB_PATH

export INTEL_LICENSE_FILE = /opt/INTEL/licenses/client.lic

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/intel/mkl/lib/intel64

错误消息:

./../abXX: symbol lookup error: ./../abXX: undefined symbol: _intel_fast_memmove

我还运行以下小脚本寻找其他未定义的符号:

nm --line-numbers --print-file-name --undefined-only --no-sort *.o > errorlist.txt
grep _intel_fast_ errorlist.txt > intelerrors.txt

当我这样做时,我实际上发现Fortran文件中有大量未定义的引用_intel_fast_memcpy和_intel_fast_memset。 _intel_fast_memmove只在其中一个cpp文件中显示为缺失。

我也发现这很奇怪,因为没有c的Fortran代码运行得很好。我没有对Fortran代码进行任何更改。我只是从指定的make文件中删除了INCLUDE,LIBRARY,CC,OPTIONS,LKOPS,CMP和COBJS的定义,并且../abXX的配方变为

$(LINK) $(MODULES) $(LDLIBS)

我想我已经看到了我所看到的其他线程所要求的所有我遇到的类似错误,我可以发布任何其他可能有用的内容。

编辑:根据要求:

echo $LD_LIBRARY_PATH的结果:

/opt/intel/composer_xe_2011_sp1.10.319/compiler/lib/intel64/:/opt/INTEL/compilers_and_libraries_2016.3.210/linux/compiler/lib/intel64:/opt/INTEL/compilers_and_libraries_2016.3.210/linux/compiler/lib/intel64_lin:/opt/INTEL/compilers_and_libraries_2016.3.210/linux/ipp/lib/intel64:/opt/INTEL/compilers_and_libraries_2016.3.210/linux/compiler/lib/intel64:/opt/INTEL/compilers_and_libraries_2016.3.210/linux/mkl/lib/intel64:/opt/INTEL/compilers_and_libraries_2016.3.210/linux/tbb/lib/intel64/gcc4.4:/opt/INTEL/debugger_2016/libipt/intel64/lib:/opt/INTEL/compilers_and_libraries_2016.3.210/linux/daal/lib/intel64_lin:/opt/INTEL/compilers_and_libraries_2016.3.210/linux/daal/../tbb/lib/intel64_lin/gcc4.4:/opt/INTEL/compilers_and_libraries_2016.3.210/linux/daal/../compiler/lib/intel64_lin::/opt/intel/composerxe/mkl/lib/intel64/:/opt/intel/composerxe/mkl/lib/intel64/:/opt/intel/mkl/lib/intel64

`ldd ../ abXX'的结果

linux-vdso.so.1 =>  (0x00007fffb51b8000)
libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x0000003171800000)
libintlc.so.5 => /opt/intel/composer_xe_2011_sp1.10.319/compiler/lib/intel64/libintlc.so.5 (0x00007fc93b678000)
libmkl_intel_lp64.so => /opt/INTEL/compilers_and_libraries_2016.3.210/linux/mkl/lib/intel64/libmkl_intel_lp64.so (0x00007fc93ab68000)
libmkl_intel_thread.so => /opt/INTEL/compilers_and_libraries_2016.3.210/linux/mkl/lib/intel64/libmkl_intel_thread.so (0x00007fc939238000)
libmkl_core.so => /opt/INTEL/compilers_and_libraries_2016.3.210/linux/mkl/lib/intel64/libmkl_core.so (0x00007fc937820000)
libiomp5.so => /opt/intel/composer_xe_2011_sp1.10.319/compiler/lib/intel64/libiomp5.so (0x00007fc937528000)
libifport.so.5 => /opt/intel/composer_xe_2011_sp1.10.319/compiler/lib/intel64/libifport.so.5 (0x00007fc9373f0000)
libifcoremt.so.5 => /opt/intel/composer_xe_2011_sp1.10.319/compiler/lib/intel64/libifcoremt.so.5 (0x00007fc937178000)
libimf.so => /opt/intel/composer_xe_2011_sp1.10.319/compiler/lib/intel64/libimf.so (0x00007fc936da8000)
libsvml.so => /opt/intel/composer_xe_2011_sp1.10.319/compiler/lib/intel64/libsvml.so (0x00007fc936628000)
libm.so.6 => /lib64/libm.so.6 (0x000000316b000000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x0000003171400000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x000000316b400000)
libdl.so.2 => /lib64/libdl.so.2 (0x000000316b800000)
libc.so.6 => /lib64/libc.so.6 (0x000000316ac00000)
/lib64/ld-linux-x86-64.so.2 (0x000000316a800000)

1 个答案:

答案 0 :(得分:0)

英特尔编译器附带一个安装shell文件。对于bash,这些将是ifortvars.shiccvars.sh。来源那些正确设置环境(此处为LD_LIBRARY_PATH)。

使用ldd检查您生成的文件。如果您的环境设置不正确,它将告诉您哪些.so文件未找到。