编译SOSlib C库时出错

时间:2016-03-08 18:24:45

标签: linux compiler-errors ode

我正在尝试编译库,

http://www.tbi.univie.ac.at/~raim/odeSolver/

具体来说,我已经为此获得了必要的库。

但是每当我尝试用“make”编译它时,我都会收到以下错误。

Making all in src
make[1]: Entering directory `/home/user/SOSLib/buildSOSlib/src'
/usr/bin/make  all-am
make[2]: Entering directory `/home/user/SOSLib/buildSOSlib/src'
/bin/bash ../libtool  --tag=CC   --mode=link /usr/bin/gcc-4.8 -Wno-unknown-pragmas -Wall -Wextra -ansi -std=iso9899:1990 -g3 -gdwarf-2 -no-undefined -L/usr/lib64 -L/usr/local/lib   -o libODES.la -rpath /usr/local/lib ASTIndexNameNode.lo arithmeticCompiler.lo charBuffer.lo compiler.lo cvodeData.lo cvodeSolver.lo daeSolver.lo drawGraph.lo evaluateAST.lo integratorInstance.lo integratorSettings.lo interpol.lo modelSimplify.lo nullSolver.lo odeConstruct.lo odeModel.lo odeSolver.lo processAST.lo sbml.lo sbmlResults.lo sensSolver.lo solverError.lo util.lo data.lo error.lo -lsbml -lxml2 -lsundials_ida -lsundials_kinsol -lsundials_cvodes -lsundials_nvecserial -lm  -lm -ldl 
libtool: link: /usr/bin/gcc-4.8 -shared  -fPIC -DPIC  .libs/ASTIndexNameNode.o .libs/arithmeticCompiler.o .libs/charBuffer.o .libs/compiler.o .libs/cvodeData.o .libs/cvodeSolver.o .libs/daeSolver.o .libs/drawGraph.o .libs/evaluateAST.o .libs/integratorInstance.o .libs/integratorSettings.o .libs/interpol.o .libs/modelSimplify.o .libs/nullSolver.o .libs/odeConstruct.o .libs/odeModel.o .libs/odeSolver.o .libs/processAST.o .libs/sbml.o .libs/sbmlResults.o .libs/sensSolver.o .libs/solverError.o .libs/util.o .libs/data.o .libs/error.o   -L/usr/lib64 -L/usr/local/lib -lsbml -lxml2 /usr/local/lib/libsundials_ida.a /usr/local/lib/libsundials_kinsol.a /usr/local/lib/libsundials_cvodes.a /usr/local/lib/libsundials_nvecserial.a -lm -ldl    -Wl,-soname -Wl,libODES.so.0 -o .libs/libODES.so.0.0.0
/usr/bin/ld: /usr/local/lib/libsundials_ida.a(ida.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libsundials_ida.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [libODES.la] Error 1
make[2]: Leaving directory `/home/user/SOSLib/buildSOSlib/src'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/user/SOSLib/buildSOSlib/src'
make: *** [all-recursive] Error 1

这里发生了什么?

1 个答案:

答案 0 :(得分:0)

您正在尝试构建共享库,并且必须将共享库构建为与位置无关的代码,以便在内存中的任何位置加载和运行它们。这是通过将-fPIC标志传递给GCC来实现的。似乎其中一个库(libsundials_ida.a)不是用它构建的。