Re: Building a dmd that works on old systems: TLS problems with libc
On Friday, 3 October 2014 at 14:21:02 UTC, Atila Neves wrote: Then I tried only using dmd to compile and linking it myself. That worked, but the resulting binary crashed. After loading it up in gdb, it crashed in __tls_get_addr My guess would be that your system doesn't have __tls_get_addr, which is unique in that it is provided by the runtime linker from glibc. You may want to try out my Android patch for dmd, which doesn't use native TLS and doesn't rely on that function either: http://164.138.25.188/dmd/packed_tls_for_elf.patch You'll want to get rid of that last change to mars.c, substitute rt/sections_android.d for rt/sections_linux.d in druntime (don't forget to change the version (Android): inside that file to version (linux): also), and make sure you're using the default ld.bfd linker and not the gold linker. That might work for you. On Thursday, 9 October 2014 at 17:30:04 UTC, Kevin Lamonte wrote: I am experiencing a similar problem trying to build a static executable, exactly as described in https://issues.dlang.org/show_bug.cgi?id=12268 . I don't know if the root cause is a gcc issue or a phobos issue. Probably neither, probably a druntime issue, specifically the rt.sections_linux module's use of the __tls_get_addr function, which is called from the dynamic linker at runtime.
Re: Building a dmd that works on old systems: TLS problems with libc
On Friday, 3 October 2014 at 10:47:11 UTC, David Nadlinger wrote: On Friday, 3 October 2014 at 08:47:07 UTC, Atila Neves wrote: ld: .../libphobos2.a(sections_linux_570_420.o): undefined reference to symbol '__tls_get_addr@@GLIBC_2.3' /lib64/ld-linux-x86-64.so.2: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status So to be clear, this is with a libphobos2.a built on the target system? The error message looks like you might have a Phobos library built for a newer libc. David I am experiencing a similar problem trying to build a static executable, exactly as described in https://issues.dlang.org/show_bug.cgi?id=12268 . I don't know if the root cause is a gcc issue or a phobos issue.
Building a dmd that works on old systems: TLS problems with libc
Both the pre-compiled dmd and building it from source from git HEAD give me the same result. I'm trying to compile D programs on an ancient Linux distro I have no root access to and hence no control over (don't ask). Its libc is so old I can't compile gcc 4.9 on it (gcc 4.8 is the most recent one that'll compile). I also can't copy compiled D programs over since its dynamic linker is too old as well. And using dmd works until it tries linking, at which point I get this: ld: .../libphobos2.a(sections_linux_570_420.o): undefined reference to symbol '__tls_get_addr@@GLIBC_2.3' /lib64/ld-linux-x86-64.so.2: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status Any ideas on what else I could do except for compiling a new libc? Cos I tried that a few weeks back and it was a descent into madness that didn't work at all. Atila
Re: Building a dmd that works on old systems: TLS problems with libc
On Friday, 3 October 2014 at 08:47:07 UTC, Atila Neves wrote: ld: .../libphobos2.a(sections_linux_570_420.o): undefined reference to symbol '__tls_get_addr@@GLIBC_2.3' /lib64/ld-linux-x86-64.so.2: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status So to be clear, this is with a libphobos2.a built on the target system? The error message looks like you might have a Phobos library built for a newer libc. David
Re: Building a dmd that works on old systems: TLS problems with libc
On Friday, 3 October 2014 at 10:47:11 UTC, David Nadlinger wrote: On Friday, 3 October 2014 at 08:47:07 UTC, Atila Neves wrote: ld: .../libphobos2.a(sections_linux_570_420.o): undefined reference to symbol '__tls_get_addr@@GLIBC_2.3' /lib64/ld-linux-x86-64.so.2: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status So to be clear, this is with a libphobos2.a built on the target system? The error message looks like you might have a Phobos library built for a newer libc. David Yes, built on the target system. It gets worse in that I installed gcc 4.8 by compiling it and changing my PATH and LD_LIBRARY_PATH to use it. At first I thought that was the problem and it sort of is but isn't. I removed my custom installations from PATH and LD_LIBRARY_PATH and used the system compiler but got the same problem. Then I tried only using dmd to compile and linking it myself. That worked, but the resulting binary crashed. After loading it up in gdb, it crashed in __tls_get_addr Atila