序言:这个问题与甲骨文无关,相反,我想了解gcc-4和gcc-6在处理“位置独立代码”方面的根本区别。
因此,我决定尝试在Debian扩展上安装Oracle 12c。
在与gcc-6的链接阶段,会发出以下错误消息:
/usr/bin/ld: /opt/oracle/product/12.2.0/lib/libpls12.a(pci.o):
relocation R_X86_64_32S against `.rodata.str1.4' can not be used when making a shared object;
recompile with -fPIC.然而,如果我切换编译器使用gcc-4.9,所有的链接都是没有任何问题的。
因此,我的两个问题:
发布于 2017-08-22 14:14:11
在默认情况下,gcc-6链接器很可能会创建与位置无关的可执行文件。这个问题可以如下所示,并通过添加链接器标志-无饼图来解决:
UNIX # gcc-6 -g -Wall -fno-pic -c helloworld.c -o helloworld.o
UNIX # gcc-6 -g -Wall helloworld.o -o helloworld
/usr/bin/ld: helloworld.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
UNIX # gcc-6 -g -Wall -no-pie helloworld.o -o helloworld实际上,在甲骨文使用的gcc选项中添加了-no-饼后,链接工作正常,没有任何错误。
发布于 2017-11-25 19:33:40
来自溴化物的溶液效果很好。我还做了一些其他的步骤来让它发挥作用:
在安装过程中,我从oracle修改了默认链接器工具,编辑了该文件。
/opt/oracle/product/12.2.0/db1/bin/orald 在第一行中,我强制使用GCC链接器,并添加了“无饼”选项:
#if [ -z "$BASH_VERSION" -o -n "$ORALD_USE_GCC" ] ; then
exec gcc -no-pie "$@"
exit 1
#fi标签: oracle 12c debian拉伸
https://stackoverflow.com/questions/44529536
复制相似问题