FS#53407 - [gcc] Compile libbfd with -fPIC

Attached to Project: Arch Linux
Opened by Anatol Pomozov (anatolik) - Wednesday, 22 March 2017, 05:27 GMT
Last edited by Allan McRae (Allan) - Wednesday, 22 March 2017, 06:51 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Allan McRae (Allan)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

I am trying to compile community/tarantool package. And it fails (see message below). The command that fails is

/usr/lib/hardening-wrapper/bin/c++ -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fexceptions -funwind-tables -fno-omit-frame-pointer -fno-stack-protector -fno-common -fopenmp -msse2 -std=c++11 -Wall -Wextra -Wno-strict-aliasing -Wno-char-subscripts -Wno-format-truncation -Wno-invalid-offsetof -O3 -DNDEBUG -Wl,-O1,--sort-common,--as-needed,-z,relro -Wl,--dynamic-list,/mnt/storage/sources/arch/community/tarantool/trunk/src/tarantool/extra/exports.Linux CMakeFiles/tarantool.dir/main.cc.o CMakeFiles/tarantool.dir/title.c.o CMakeFiles/tarantool.dir/__/third_party/libutil_freebsd/flopen.c.o CMakeFiles/tarantool.dir/__/third_party/libutil_freebsd/pidfile.c.o -o tarantool -Wl,--whole-archive box/libbox.a libserver.a libcore.a ../libmisc.a lib/bitset/libbitset.a lib/csv/libcsv.a ../third_party/luajit/src/libluajit.a lib/msgpuck/libmsgpuck.a lib/salad/libsalad.a -Wl,--no-whole-archive libserver.a libcore.a ../libmisc.a lib/bitset/libbitset.a lib/csv/libcsv.a ../third_party/luajit/src/libluajit.a lib/msgpuck/libmsgpuck.a ../libeio.a ../libgopt.a -lyaml -lreadline -lcurses -lform -lssl -lcrypto -ldl -lrt -Wl,-Bstatic -lbfd -liberty -Wl,-Bdynamic -lz ../libzstd.a lib/salad/libsalad.a lib/small/libsmall.a -lpthread ../libev.a -lm ../libcoro.a liburi.a lib/bit/libbit.a
[anatol@argo src]$ /usr/lib/hardening-wrapper/bin/c++ -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fexceptions -funwind-tables -fno-omit-frame-pointer -fno-stack-protector -fno-common -fopenmp -msse2 -std=c++11 -Wall -Wextra -Wno-strict-aliasing -Wno-char-subscripts -Wno-format-truncation -Wno-invalid-offsetof -O3 -DNDEBUG -Wl,-O1,--sort-common,--as-needed,-z,relro -Wl,--dynamic-list,/mnt/storage/sources/arch/community/tarantool/trunk/src/tarantool/extra/exports.Linux CMakeFiles/tarantool.dir/main.cc.o CMakeFiles/tarantool.dir/title.c.o CMakeFiles/tarantool.dir/__/third_party/libutil_freebsd/flopen.c.o CMakeFiles/tarantool.dir/__/third_party/libutil_freebsd/pidfile.c.o -o tarantool -Wl,--whole-archive box/libbox.a libserver.a libcore.a ../libmisc.a lib/bitset/libbitset.a lib/csv/libcsv.a ../third_party/luajit/src/libluajit.a lib/msgpuck/libmsgpuck.a lib/salad/libsalad.a -Wl,--no-whole-archive libserver.a libcore.a ../libmisc.a lib/bitset/libbitset.a lib/csv/libcsv.a ../third_party/luajit/src/libluajit.a lib/msgpuck/libmsgpuck.a ../libeio.a ../libgopt.a -lyaml -lreadline -lcurses -lform -lssl -lcrypto -ldl -lrt -Wl,-Bstatic -lbfd -liberty -Wl,-Bdynamic -lz ../libzstd.a lib/salad/libsalad.a lib/small/libsmall.a -lpthread ../libev.a -lm ../libcoro.a liburi.a lib/bit/libbit.a

and gcc output is

/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(format.o): relocation R_X86_64_32S against symbol `binary_vec' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(hash.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(libbfd.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(opncls.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(section.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(targets.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(binary.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(ihex.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(srec.o): relocation R_X86_64_32S against symbol `_bfd_std_section' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(tekhex.o): relocation R_X86_64_32S against symbol `_hex_value' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(verilog.o): relocation R_X86_64_32S against symbol `bfd_default_arch_struct' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(elf64-x86-64.o): relocation R_X86_64_32S against symbol `_bfd_elf_large_com_section' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(elf-ifunc.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(elf-nacl.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(elf64.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(elf.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(elflink.o): relocation R_X86_64_32S against symbol `_bfd_std_section' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(elf-attrs.o): relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(elf-strtab.o): relocation R_X86_64_32 against `.text' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(elf-eh-frame.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(dwarf1.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(dwarf2.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(elf32-i386.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(elf-vxworks.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(elf32.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(i386linux.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(aout32.o): relocation R_X86_64_32 against symbol `_bfd_generic_link_add_one_symbol' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(pei-i386.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(peigen.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(cofflink.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(coffgen.o): relocation R_X86_64_32S against symbol `_bfd_std_section' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(pei-x86_64.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(pex64igen.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(elf64-gen.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(elf32-gen.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(plugin.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(archive.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(archures.o): relocation R_X86_64_32S against symbol `_sch_istable' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(bfd.o): relocation R_X86_64_32S against symbol `bfd_errmsgs' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(bfdio.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(cache.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(compress.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(linker.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(merge.o): relocation R_X86_64_32 against `.text' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(reloc.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(simple.o): relocation R_X86_64_32S against `.text' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(stab-syms.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(stabs.o): relocation R_X86_64_32S against symbol `_bfd_std_section' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(syms.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(cpu-i386.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/../../../../lib/libbfd.a(archive64.o): relocation R_X86_64_32 against `.rodata.str1.1' 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



If I can read the command line it wants to compile 'tarantool' binary statically with libbfd.a and dynamically with libz.so. But it libbfd does not like it. The error message suggests that libbfd should be compiled with -fPIC.
This task depends upon

Closed by  Allan McRae (Allan)
Wednesday, 22 March 2017, 06:51 GMT
Reason for closing:  Duplicate
Additional comments about closing:   FS#53367 

Loading...