www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Linkage runaround

reply "Steve Teale" <steve.teale britseyeview.com> writes:
If I link my DMD 2.066.1/ GtkD (latest version) app with static 
Phobos2 I get

Linking executable: ../bin/Debug/compo
../objdir/mainwin.o: In function 
`_D4core7runtime7Runtime17__T11loadLibraryZ11loadLibraryFxAaZPv':
/usr/include/dmd/druntime/import/core/runtime.d:233: undefined 
reference to `rt_loadLibrary'
collect2: ld returned 1 exit status

If I change the link spec to use libphobos2.so, then the app 
links, and runs, but it crashes the first time I try to read 
something from a file with stream.File.readString.

Does this ring a bell with anyone.
Mar 26 2015
next sibling parent reply Steven Schveighoffer <schveiguy yahoo.com> writes:
On 3/26/15 8:37 AM, Steve Teale wrote:
 If I link my DMD 2.066.1/ GtkD (latest version) app with static Phobos2
 I get

 Linking executable: ../bin/Debug/compo
 .../objdir/mainwin.o: In function
 `_D4core7runtime7Runtime17__T11loadLibraryZ11loadLibraryFxAaZPv':
 /usr/include/dmd/druntime/import/core/runtime.d:233: undefined reference
 to `rt_loadLibrary'
 collect2: ld returned 1 exit status

 If I change the link spec to use libphobos2.so, then the app links, and
 runs, but it crashes the first time I try to read something from a file
 with stream.File.readString.

 Does this ring a bell with anyone.
It looks like you are missing a required library. Are you linking with ld? If so, make sure you run dmd with -v to see the link line it uses. -Steve
Mar 26 2015
parent "Steve Teale" <steve.teale britseyeview.com> writes:
On Thursday, 26 March 2015 at 13:17:04 UTC, Steven Schveighoffer 
wrote:
 On 3/26/15 8:37 AM, Steve Teale wrote:
 If I link my DMD 2.066.1/ GtkD (latest version) app with 
 static Phobos2
 I get

 Linking executable: ../bin/Debug/compo
 .../objdir/mainwin.o: In function
 `_D4core7runtime7Runtime17__T11loadLibraryZ11loadLibraryFxAaZPv':
 /usr/include/dmd/druntime/import/core/runtime.d:233: undefined 
 reference
 to `rt_loadLibrary'
 collect2: ld returned 1 exit status

 If I change the link spec to use libphobos2.so, then the app 
 links, and
 runs, but it crashes the first time I try to read something 
 from a file
 with stream.File.readString.

 Does this ring a bell with anyone.
It looks like you are missing a required library. Are you linking with ld? If so, make sure you run dmd with -v to see the link line it uses.
Telling the linker to use the dynamic linking so - on Ubuntu, that appears to be /lib/i386-linux-gnu/ld-linux.so.2 - makes no difference.
 -Steve
Mar 26 2015
prev sibling parent "Vladimir Panteleev" <vladimir thecybershadow.net> writes:
On Thursday, 26 March 2015 at 12:37:32 UTC, Steve Teale wrote:
 If I link my DMD 2.066.1/ GtkD (latest version) app with static 
 Phobos2 I get

 Linking executable: ../bin/Debug/compo
 ../objdir/mainwin.o: In function 
 `_D4core7runtime7Runtime17__T11loadLibraryZ11loadLibraryFxAaZPv':
 /usr/include/dmd/druntime/import/core/runtime.d:233: undefined 
 reference to `rt_loadLibrary'
 collect2: ld returned 1 exit status

 If I change the link spec to use libphobos2.so, then the app 
 links, and runs, but it crashes the first time I try to read 
 something from a file with stream.File.readString.

 Does this ring a bell with anyone.
Does your code call Runtime.loadLibrary anywhere? It looks like rt_loadLibrary is only implemented when on Windows or with version(Shared).
Mar 26 2015