How to get ldc2 to link dynamically to Phobos

Shriramana Sharma via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Sat Oct 17 20:07:07 PDT 2015


W.r.t. my recent thread 
http://forum.dlang.org/post/mvt67j$3dg$1@digitalmars.com on Phobos still 
being statically linked in, it was suggested that I should use the -
defaultlib=libphobos2.so option. This works fine with DMD 2.068.2 but I'm 
not sure how to get it working with LDC. LDC doesn't seem to ship with a 
compiled Phobos SO so I just symlinked it from DMD's one (not sure whether 
that is compatible or not though):

$ pwd
/opt/ldc2-0.16.0-beta2-linux-x86_64/lib
$ ls -l
total 51956
-rw-r--r-- 1 samjnaa samjnaa  2403108 Oct 10 18:25 libdruntime-ldc.a
-rw-r--r-- 1 samjnaa samjnaa  4822716 Oct 10 18:25 libdruntime-ldc-debug.a
-rw-r--r-- 1 samjnaa samjnaa 15820544 Oct 10 18:28 libphobos2-ldc.a
-rw-r--r-- 1 samjnaa samjnaa 30150532 Oct 10 18:29 libphobos2-ldc-debug.a
lrwxrwxrwx 1 samjnaa samjnaa       18 Oct 18 08:19 libphobos2.so -> 
libphobos2.so.0.68
lrwxrwxrwx 1 samjnaa samjnaa       20 Oct 18 08:19 libphobos2.so.0.68 -> 
libphobos2.so.0.68.2
lrwxrwxrwx 1 samjnaa samjnaa       46 Oct 18 08:18 libphobos2.so.0.68.2 -> 
/usr/lib/x86_64-linux-gnu/libphobos2.so.0.68.2

... but anyhow I keep getting the error:

/usr/bin/ld: cannot find -llibphobos2.so
collect2: error: ld returned 1 exit status
Error: /usr/bin/gcc failed with status: 1

BTW why is LDC using gcc and not clang to link?

-- 
Shriramana Sharma, Penguin #395953


More information about the digitalmars-d-ldc mailing list