ponylang / ponyc

Pony is an open-source, actor-model, capabilities-secure, high performance programming language
http://www.ponylang.io
BSD 2-Clause "Simplified" License
5.68k stars 409 forks source link

ponyc .deb package gives ld.gold link error on ubuntu 16.10, recommends recompile with -fPIC. --pic don't work with .deb ponyc #1359

Closed sparrisable closed 7 years ago

sparrisable commented 7 years ago

On ubuntu 16.10 (updated on 23 oktobober 2016) the .deb package for ponyc gives the following error:

ponyc -v 0.7.0-4986123 [release](llvm 3.9.0) (gcc-5 (Ubuntu 5.4.1-2ubuntu2) 5.4.1 20160929)

peter@peter-UX305CA:~/Dokument/programs/pony/ponyc$ ponyc examples/helloworld/ Building builtin -> /usr/lib/pony/0.7.0-2189.4986123/packages/builtin Building examples/helloworld/ -> /home/peter/Dokument/programs/pony/ponyc/examples/helloworld Generating Reachability Selector painting Data prototypes Data types Function prototypes Functions Descriptors Optimising Writing ./helloworld.o Linking ./helloworld Warning: environment variable $CC undefined, using gcc-5 as the linker /usr/bin/ld.gold: error: ./helloworld.o: requires dynamic R_X86_64_32 reloc which may overflow at runtime; recompile with -fPIC /usr/bin/ld.gold: error: ./helloworld.o: requires dynamic R_X86_64_32 reloc against 'pony_personality_v0' which may overflow at runtime; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(start.o): requires dynamic R_X86_64_32 reloc which may overflow at runtime; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(scheduler.o): requires dynamic R_X86_64_32 reloc which may overflow at runtime; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(cpu.o): requires dynamic R_X86_64_32 reloc which may overflow at runtime; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(serialise.o): requires dynamic R_X86_64_32 reloc which may overflow at runtime; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(cycle.o): requires dynamic R_X86_64_32 reloc against 'ponyint_pool_free_size' which may overflow at runtime; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(trace.o): requires unsupported dynamic reloc 11; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(delta.o): requires dynamic R_X86_64_32 reloc against 'ponyint_pool_alloc_size' which may overflow at runtime; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(actormap.o): requires dynamic R_X86_64_32 reloc against 'ponyint_pool_alloc_size' which may overflow at runtime; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(options.o): requires dynamic R_X86_64_PC32 reloc against 'strncmp' which may overflow at runtime; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(heap.o): requires unsupported dynamic reloc 11; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(pool.o): requires unsupported dynamic reloc 11; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(alloc.o): requires dynamic R_X86_64_PC32 reloc against 'mmap' which may overflow at runtime; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(pagemap.o): requires dynamic R_X86_64_32 reloc which may overflow at runtime; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(posix_except.o): requires unsupported dynamic reloc 11; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(socket.o): requires dynamic R_X86_64_PC32 reloc against 'getaddrinfo' which may overflow at runtime; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(stdfd.o): requires dynamic R_X86_64_32 reloc which may overflow at runtime; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(lsda.o): requires dynamic R_X86_64_PC32 reloc against '_Unwind_GetLanguageSpecificData' which may overflow at runtime; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(threads.o): requires dynamic R_X86_64_32 reloc which may overflow at runtime; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(epoll.o): requires dynamic R_X86_64_32 reloc which may overflow at runtime; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(asio.o): requires dynamic R_X86_64_32 reloc against 'ponyint_asio_backend_dispatch' which may overflow at runtime; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(actor.o): requires dynamic R_X86_64_PC32 reloc against 'memset' which may overflow at runtime; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(fun.o): requires unsupported dynamic reloc 11; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(hash.o): requires dynamic R_X86_64_PC32 reloc against 'memset' which may overflow at runtime; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(objectmap.o): requires dynamic R_X86_64_32 reloc against 'ponyint_pool_alloc_size' which may overflow at runtime; recompile with -fPIC collect2: error: ld returned 1 exit status Error: unable to link: gcc-5 -o ./helloworld -O3 -march=native -mcx16 -fuse-ld=gold ./helloworld.o -L"/usr/lib/pony/0.7.0-2189.4986123/bin/" -Wl,-rpath,"/usr/lib/pony/0.7.0-2189.4986123/bin/" -L"/usr/lib/pony/0.7.0-2189.4986123/bin/../lib" -Wl,-rpath,"/usr/lib/pony/0.7.0-2189.4986123/bin/../lib" -L"/usr/lib/pony/0.7.0-2189.4986123/bin/../packages" -Wl,-rpath,"/usr/lib/pony/0.7.0-2189.4986123/bin/../packages" -L"/usr/local/lib" -Wl,-rpath,"/usr/local/lib" -Wl,--start-group -Wl,--end-group -lponyrt -lpthread -ldl -lm


Compiling with --pic gives:

peter@peter-UX305CA:~/Dokument/programs/pony/ponyc$ ponyc examples/helloworld/ --pic Building builtin -> /usr/lib/pony/0.7.0-2189.4986123/packages/builtin Building examples/helloworld/ -> /home/peter/Dokument/programs/pony/ponyc/examples/helloworld Generating Reachability Selector painting Data prototypes Data types Function prototypes Functions Descriptors Optimising Writing ./helloworld.o Linking ./helloworld Warning: environment variable $CC undefined, using gcc-5 as the linker /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(start.o): requires dynamic R_X86_64_32 reloc which may overflow at runtime; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(scheduler.o): requires dynamic R_X86_64_32 reloc which may overflow at runtime; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(cpu.o): requires dynamic R_X86_64_32 reloc which may overflow at runtime; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(serialise.o): requires dynamic R_X86_64_32 reloc which may overflow at runtime; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(cycle.o): requires dynamic R_X86_64_32 reloc against 'ponyint_pool_free_size' which may overflow at runtime; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(trace.o): requires unsupported dynamic reloc 11; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(delta.o): requires dynamic R_X86_64_32 reloc against 'ponyint_pool_alloc_size' which may overflow at runtime; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(actormap.o): requires dynamic R_X86_64_32 reloc against 'ponyint_pool_alloc_size' which may overflow at runtime; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(options.o): requires dynamic R_X86_64_PC32 reloc against 'strncmp' which may overflow at runtime; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(heap.o): requires unsupported dynamic reloc 11; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(pool.o): requires unsupported dynamic reloc 11; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(alloc.o): requires dynamic R_X86_64_PC32 reloc against 'mmap' which may overflow at runtime; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(pagemap.o): requires dynamic R_X86_64_32 reloc which may overflow at runtime; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(posix_except.o): requires unsupported dynamic reloc 11; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(socket.o): requires dynamic R_X86_64_PC32 reloc against 'getaddrinfo' which may overflow at runtime; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(stdfd.o): requires dynamic R_X86_64_32 reloc which may overflow at runtime; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(lsda.o): requires dynamic R_X86_64_PC32 reloc against '_Unwind_GetLanguageSpecificData' which may overflow at runtime; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(threads.o): requires dynamic R_X86_64_32 reloc which may overflow at runtime; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(epoll.o): requires dynamic R_X86_64_32 reloc which may overflow at runtime; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(asio.o): requires dynamic R_X86_64_32 reloc against 'ponyint_asio_backend_dispatch' which may overflow at runtime; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(actor.o): requires dynamic R_X86_64_PC32 reloc against 'memset' which may overflow at runtime; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(fun.o): requires unsupported dynamic reloc 11; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(hash.o): requires dynamic R_X86_64_PC32 reloc against 'memset' which may overflow at runtime; recompile with -fPIC /usr/bin/ld.gold: error: /usr/lib/pony/0.7.0-2189.4986123/bin/../lib/libponyrt.a(objectmap.o): requires dynamic R_X86_64_32 reloc against 'ponyint_pool_alloc_size' which may overflow at runtime; recompile with -fPIC collect2: error: ld returned 1 exit status Error: unable to link: gcc-5 -o ./helloworld -O3 -march=native -mcx16 -fuse-ld=gold ./helloworld.o -L"/usr/lib/pony/0.7.0-2189.4986123/bin/" -Wl,-rpath,"/usr/lib/pony/0.7.0-2189.4986123/bin/" -L"/usr/lib/pony/0.7.0-2189.4986123/bin/../lib" -Wl,-rpath,"/usr/lib/pony/0.7.0-2189.4986123/bin/../lib" -L"/usr/lib/pony/0.7.0-2189.4986123/bin/../packages" -Wl,-rpath,"/usr/lib/pony/0.7.0-2189.4986123/bin/../packages" -L"/usr/local/lib" -Wl,-rpath,"/usr/local/lib" -Wl,--start-group -Wl,--end-group -lponyrt -lpthread -ldl -lm

***' ponyc compiled from source: $ ./build/release/ponyc -v 0.7.0-e225e47 [release](llvm 3.8.1) (cc (Ubuntu 6.2.0-5ubuntu12) 6.2.0 20161005)

peter@peter-UX305CA:~/Dokument/programs/pony/ponyc$ ./build/release/ponyc examples/helloworld/ Building builtin -> /home/peter/Dokument/programs/pony/ponyc/packages/builtin Building examples/helloworld/ -> /home/peter/Dokument/programs/pony/ponyc/examples/helloworld Generating Reachability Selector painting Data prototypes Data types Function prototypes Functions Descriptors Optimising Writing ./helloworld.o Linking ./helloworld Warning: environment variable $CC undefined, using cc as the linker /usr/bin/ld.gold: error: ./helloworld.o: requires dynamic R_X86_64_32 reloc which may overflow at runtime; recompile with -fPIC /usr/bin/ld.gold: error: ./helloworld.o: requires dynamic R_X86_64_32 reloc against 'pony_personality_v0' which may overflow at runtime; recompile with -fPIC collect2: error: ld returned 1 exit status Error: unable to link: cc -o ./helloworld -O3 -march=native -mcx16 -fuse-ld=gold ./helloworld.o -L"/home/peter/Dokument/programs/pony/ponyc/build/release/" -Wl,-rpath,"/home/peter/Dokument/programs/pony/ponyc/build/release/" -L"/home/peter/Dokument/programs/pony/ponyc/build/release/../../packages" -Wl,-rpath,"/home/peter/Dokument/programs/pony/ponyc/build/release/../../packages" -L"/usr/local/lib" -Wl,-rpath,"/usr/local/lib" -Wl,--start-group -Wl,--end-group -lponyrt -lpthread -ldl -lm


Building with --pic works for ponyc built from source:

peter@peter-UX305CA:~/Dokument/programs/pony/ponyc$ ./build/release/ponyc examples/helloworld/ --pic Building builtin -> /home/peter/Dokument/programs/pony/ponyc/packages/builtin Building examples/helloworld/ -> /home/peter/Dokument/programs/pony/ponyc/examples/helloworld Generating Reachability Selector painting Data prototypes Data types Function prototypes Functions Descriptors Optimising Writing ./helloworld.o Linking ./helloworld Warning: environment variable $CC undefined, using cc as the linker $

peter@peter-UX305CA:~/Dokument/programs/pony/ponyc$ cc -v Using built-in specs. COLLECT_GCC=cc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/6/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 6.2.0-5ubuntu12' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 6.2.0 20161005 (Ubuntu 6.2.0-5ubuntu12)

Praetonus commented 7 years ago

The problem is that the compiler isn't using the PIC version of the runtime library when compiling with --pic.