我认为在这种情况下,我不需要用-fPIC编译静态库,但是我不知道如何告诉链接器,我不会使用静态库中的符号。iostream>std::string static_version_info();那就去做
$ g++ -c foo.cpp -o foo.o -fPICagainst symbol `_ZNSt6vectorIiSaIiEEC1Ev' can not be used when making a shared object; recompile with
我已经使用CMake配置了使用CMAKE_POSITION_INDEPENDENT_CODE = ON选项的项目,但是在编译可执行文件时,Qt5仍然抱怨我应该使用fPIC。with position independent code if Qt was built with -reduce-relocations. " "Compile your code with -fPICCMakeLists.txt文件中启用了这两个选项set(BUI
这是我的命令:
gcc -T linker.ld -o Stack\ Berry.bin -ffreestanding -O2 -nostlib kernel.o boot.o -fPIC -lgccrelocation R_X86_64_32 against `.multiboot' can not be used when making a PIE object; recompile with -fPIC/usr/bin/ld: final link failed: Nonrepresentable section
我正在尝试将一个static library链接到shared library,结果抛出了一个错误,显示为recompile with -fPICsavari@Ramana下面是我如何编译的:
gcc -shared -fPIC -o libShared.sorelocation R_X86_64_32 against `.rodata' can not be used wh
relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC指出静态库中的目标文件需要使用-fpic标志进行编译。我不能理解为什么使用相同的静态库(在没有-fpic的情况下为Windows编译)创建windows dll是可行的?我使用x86_64-w64-mingw32-g++作为Windows DLL。
出于可移植性的原因,我想用gfortran创建一个共享库,将它与libgfortran的静态版本链接起来。不幸的是,我没有设法适当地链接不同的对象。我的源文件都是用-fPIC标志编译的。relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPICcould not read symbols: Bad value
collect2: ld return