【问题标题】:Link error with libtool gcc and ld与 libtool gcc 和 ld 链接错误
【发布时间】:2018-01-02 13:24:41
【问题描述】:

我有以下 configure+ma​​ke 脚本来构建一些 sw 包 (libosip):

rm -rf build
rm -rf libosip2-4.1.0
rm -rf libosip2-4.1.0.tar.gz

wget https://ftp.gnu.org/gnu/osip/libosip2-4.1.0.tar.gz
tar xf libosip2-4.1.0.tar.gz

mkdir build
cd build
../libosip2-4.1.0/configure --enable-test --disable-shared
make -j

然后我将 libosip 主函数的调用添加到 klee_make_symbolic。 klee_make_symbolic 位于此路径中的库中:

/home/oren/GIT/LatestKlee/klee/build/lib/

所以我尝试在调用 make 之前添加一个 LDFLAGS:

LDFLAGS="-L/home/oren/GIT/LatestKlee/klee/build/lib/" make -j

但我收到以下错误:

/bin/bash ../../libtool --tag=CC   --mode=link gcc -g   -pedantic -g -DENABLE_TRACE -g    -o torture_test torture.o   ../../src/osipparser2/libosipparser2.la  
libtool: link: gcc -g -pedantic -g -DENABLE_TRACE -g -o torture_test torture.o  ../../src/osipparser2/.libs/libosipparser2.a
torture.o: In function `read_text':
/home/oren/GIT/LatestKlee/myBenchmarks/libosip/build/src/test/../../../libosip2-4.1.0/src/test/torture.c:62: undefined reference to `klee_make_symbolic'
collect2: error: ld returned 1 exit status

非常感谢任何帮助,谢谢!

【问题讨论】:

    标签: gcc makefile ld configure libtool


    【解决方案1】:

    您需要使用-l 链接器选项实际链接该库。

    LDFLAGS="-L/home/oren/GIT/LatestKlee/klee/build/lib/" 添加库搜索路径但不链接任何库。

    【讨论】:

    • 我应该怎么做?我有一个从 libosip 配置中生成的机器生成文件,我应该编辑它吗?还有什么?
    • @OrenIshShalom 请参阅-llibrary 中的gcc Options for Linking 了解完整详情。
    猜你喜欢
    • 2014-12-03
    • 2014-11-26
    • 1970-01-01
    • 1970-01-01
    • 2014-05-28
    • 1970-01-01
    • 2020-02-27
    • 1970-01-01
    • 2013-07-31
    相关资源
    最近更新 更多