digitalmars.D.learn - dmd (v2.075.0): fully static linking: undefined reference to
- kdevel (15/15) Aug 19 2017 test.d
- kdevel (2/3) Aug 19 2017 https://issues.dlang.org/show_bug.cgi?id=12268
- Joakim (7/10) Aug 19 2017 That function is supposed to be provided by the dynamic linker
- Jacob Carlborg (4/25) Aug 21 2017 You can use LDC to statically link the binary.
test.d
---
void main ()
{
}
---
$ dmd -c test.d
$ cc -o test test.o -L/[...]/dmd2/linux/lib64 -lphobos2 -static
-lpthread -lrt
/[...]/dmd2/linux/lib64/libphobos2.a(sections_elf_shared_774_420.o): In
function `_D2rt19sections_elf_shared11getTLSRangeFNbNimmZAv':
src/rt/sections_elf_shared.d:(.text._D2rt19sections_elf_shared11getTLSRangeFNbNimmZAv[_D2rt19sections_elf_shared11getTLSRan
eFNbNimmZAv]+0x38): undefined reference to `__tls_get_addr'
collect2: error: ld returned 1 exit status
Found that on the net but no solution:
http://www.digitalmars.com/d/archives/digitalmars/D/learn/Static_linking_on_Linux_with_dmd_or_gcc_74954.html
Any hints?
Aug 19 2017
On Saturday, 19 August 2017 at 14:07:49 UTC, kdevel wrote:src/rt/sections_elf_shared.d:(.text._D2rt19sections_elf_shared11getTLSRangeFNbNimmZAv[_D2rt19sections_elf_shared11getTLSRan eFNbNimmZAv]+0x38): undefined reference to `__tls_get_addr'https://issues.dlang.org/show_bug.cgi?id=12268
Aug 19 2017
On Saturday, 19 August 2017 at 14:22:21 UTC, kdevel wrote:On Saturday, 19 August 2017 at 14:07:49 UTC, kdevel wrote:That function is supposed to be provided by the dynamic linker when running your program, but I'm guessing -static makes the linker check for all symbols at link-time, not allowing such deferred linking. It looks like dmd or druntime doesn't support such full static linking yet, as they assume that function will be there.src/rt/sections_elf_shared.d:(.text._D2rt19sections_elf_shared11getTLSRangeFNbNimmZAv[_D2rt19sections_elf_shared11getTLSRan eFNbNimmZAv]+0x38): undefined reference to `__tls_get_addr'https://issues.dlang.org/show_bug.cgi?id=12268
Aug 19 2017
On 2017-08-19 16:07, kdevel wrote:
test.d
---
void main ()
{
}
---
$ dmd -c test.d
$ cc -o test test.o -L/[...]/dmd2/linux/lib64 -lphobos2 -static
-lpthread -lrt
/[...]/dmd2/linux/lib64/libphobos2.a(sections_elf_shared_774_420.o): In
function `_D2rt19sections_elf_shared11getTLSRangeFNbNimmZAv':
src/rt/sections_elf_shared.d:(.text._D2rt19sections_elf_shared11getTLSRangeFNbNimmZAv[_D2rt19sections_elf_shared11getTLSRan
eFNbNimmZAv]+0x38):
undefined reference to `__tls_get_addr'
collect2: error: ld returned 1 exit status
Found that on the net but no solution:
http://www.digitalmars.com/d/archives/digitalmars/D/learn/Static_linking_on_Linux_with_d
d_or_gcc_74954.html
Any hints?
You can use LDC to statically link the binary.
--
/Jacob Carlborg
Aug 21 2017









Joakim <dlang joakim.fea.st> 