digitalmars.D.bugs - [Issue 12268] New: full static linking does not work, unresolved __tls_get_addr
- d-bugmail puremagic.com (18/23) Feb 26 2014 https://d.puremagic.com/issues/show_bug.cgi?id=12268
- d-bugmail puremagic.com (12/12) Feb 26 2014 https://d.puremagic.com/issues/show_bug.cgi?id=12268
- d-bugmail puremagic.com (6/6) Feb 26 2014 https://d.puremagic.com/issues/show_bug.cgi?id=12268
- d-bugmail puremagic.com (59/59) Feb 26 2014 https://d.puremagic.com/issues/show_bug.cgi?id=12268
https://d.puremagic.com/issues/show_bug.cgi?id=12268 Summary: full static linking does not work, unresolved __tls_get_addr Product: D Version: unspecified Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: public dicebot.lv http://forum.dlang.org/post/slsscokbcjfyxbfaulom forum.dlang.org :$ dmd hellod.d -c $ gcc hellod.o -o hellod -m32 -L/home/me/d/dmd2/linux/bin32/../lib32 -Xlinker --export-dynamic -l:libphobos2.a -lpthread -lm -lrt -static undefined reference to `__tls_get_addr'-- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 26 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12268 AG <agordon wi.mit.edu> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |agordon wi.mit.edu I'll just mention too previous related bug reports: http://d.puremagic.com/issues/show_bug.cgi?id=6952 http://d.puremagic.com/issues/show_bug.cgi?id=4376 -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 26 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12268 Those 2 look like a different issue. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 26 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12268 Perhaps those are different issue, but I'll explain why I think they are related: 1. by default, "dmd" creates dynamic executables. 2. if we run "dmd -v", we see the "gcc" command line that DMD uses. In this bug, and with the mention thread, the person took the output from dmd, and added (manually) "-static" - directly to the gcc command line. 3. In the other two mention threads, the person used "-L-static" to tell DMD to pass "-static" to the linker. But the way DMD passes the parameter to the linker is by adding "-Xlinker -static" - which has slightly different effect (and different error message). So, while it could be that the error messages are different (and perhaps the root cause is different), These are related bugs (IMHO) - they both try to compile static binaries on linux. At least it's worth knowing about those two. Example: $ cat hello.d import std.stdio; void main() { writeln("hello world"); } $ dmd -ofhello.o -c hello.d $ dmd -v -ofhello hello.o binary dmd version v2.064 gcc hello.o -o hello -m64 -L/usr/lib64/ -l:libphobos2.a -lpthread -lm -lrt $ gcc hello.o -o hello -m64 -L//usr/lib64/ -l:libphobos2.a -lpthread -lm -lrt -static /usr/lib64/libphobos2.a(sections_linux_4ce_420.o): In function `_D2rt14sections_linux11getTLSRangeFmmZAv': src/rt/sections_linux.d:(.text._D2rt14sections_linux11getTLSRangeFmmZAv+0x38): undefined reference to `__tls_get_addr' collect2: error: ld returned 1 exit status $ dmd -L-static -v -ofhello hello.o binary dmd version v2.064 gcc hello.o -o hello -m64 -Xlinker -static -L/usr/lib64 -l:libphobos2.a -lpthread -lm -lrt .../x86_64-unknown-linux-gnu/bin/ld: cannot find -lgcc_s .../x86_64-unknown-linux-gnu/bin/ld: cannot find -lgcc_s collect2: error: ld returned 1 exit status --- errorlevel 1 ================== -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 26 2014