我试图将"c++端口音频库“与我的"C++演示模块”链接起来,这是一个python可调用库(模块)。
我使用distutils来执行这个操作,为了执行静态链接,我将libport音频添加到extra_objects参数中,如下所示:
module1 = Extension(
"demo",
sources=cppc,
# TODO remove os dependency
extra_compile_args=gccArgs,
# link against shared libraries
#libraries=[
我有一个共享库项目,只有当我将-fPIC添加到Compiler命令(这解决了问题)时,它才会生成。
当我试图在这个项目中使用静态库时,我会遇到类似的问题,但在这种情况下,我不能用-fPIC修复:
libtest.a(exception.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
我能不能得到一些帮助,我如何能够成功地连接这个?我也尝试过将-fPIC添加到链接器选项中,但我也得到了相同的错误。
我在
我正在尝试使用g++生成一个共享库(libgenerated.so)。共享库使用来自第三方静态库(libmystatic.a)的一些功能。为此,我将静态库与共享库链接为:
g++ -shared -o libgenerated.so $(OBJ_FILES) -lmystatic
上面的命令为静态库返回以下重定位错误:
relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
指出静态库中的目标文件需要使用-fpic标志进行编译。
我试图在Ubuntu上使用g++ 5.4.0创建一个共享库。
我已经构建了Poco C++库的静态库(C++文件),我想静态地将它们链接到我的共享库中。
但这是行不通的。
我在构建脚本中添加了以下字符串:
-Wl,-whole-archive -lPocoFoundation -Wl,-no-whole-archive
g++发出以下错误消息:
relocation R_X86_64_32S against '-ZTVN4Poco15ArchiveStrategyE' can not be used when making a shared object; recompile
我现在正在尝试安装根包
在./configure, make之后,我得到了如下错误:
/usr/bin/ld: /share/lib/python2.6/config/libpython2.6.a(abstract.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/share/lib/python2.6/config/libpython2.6.a: could not read symbols: B
我正在编译一个共享库(.so),它使用log4cxx库。我得到了以下错误:
liblog4cxx.a(level.o): relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC
你知不知道?我应该用一些特殊的选项重新编译log4cxx吗?
我正在尝试使用GCC为我的共享库创建一个预编译头文件。在进行了必要的配置并尝试构建之后,我得到了以下警告:
cc1plus: warning: ./PrecompiledHeaders.h.gch/.c++: created and used with different settings of -fpic [enabled by default]
经过一段时间的搜索,我发现了这段代码,它似乎表明PCH不能与共享代码一起工作:
/* -fpic and -fpie also usually make a PCH invalid. */
if (data[0] != flag_pic)
r
当我试图在Ubuntu 14.04 (64)上创建一个fat共享库时,我遇到了一个奇怪的问题。如果您忘记添加-fPIC或链接到错误的架构库,则通常会收到错误消息:
/usr/bin/ld: /usr/lib/libproj.a(pj_init.o): relocation R_X86_64_32 against
`.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/lib/libproj.a: error adding symbols: Bad value
第一个
我有一个共享库,由另一个我无法控制的应用程序使用,它需要*.so对象。我的库使用了需要静态链接的sqlite3 (我绝对需要一个自包含的二进制文件)。
当我试图编译和链接我的库时:
-fpic -flto -pthread -m64
-flto -static -shared
最后会出现以下错误:
/usr/bin/ld: /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.6.1/crtbeginT.o: relocation R_X86_64_32 against `__DTOR_END__' can not be used when mak