www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Building SDC from source

reply Joseph Rushton Wakeling via Digitalmars-d-learn writes:
Hi all,

I'm running into a little trouble trying to build SDC.  The first problem was 
that the makefile does not auto-detect the appropriate llvm-config, or the 
libphobos2 location, but that's simply enough fixed by doing (in my case):

     make LLVM_CONFIG=llvm-config-3.4 LD_PATH=/opt/dmd/lib64

It also needs libncurses5-dev to be installed (Debian/Ubuntu package name, may 
vary on other distros).

However, even allowing for this, the build still falls over when it reaches
this 
stage:

gcc -o bin/sdc obj/sdc.o -m64  -L/opt/dmd/lib64 -lphobos2 -Llib -ld-llvm -ld 
`llvm-config-3.4 --ldflags` `llvm-config-3.4 --libs` -lstdc++ -export-dynamic 
-ldl -lffi -lpthread -lm -lncurses
bin/sdc -c -o obj/rt/dmain.o libsdrt/src/d/rt/dmain.d -Ilibsdrt/src
bin/sdc: error while loading shared libraries: libphobos2.so.0.66: cannot open 
shared object file: No such file or directory

This is a bit mysterious, as libphobos2.so.0.66 does indeed exist in the 
/opt/dmd/lib64 directory.  Or is this just an incompatible library version,
with 
SDC expecting 2.065 .... ?

Can anyone advise?

Thanks & best wishes,

       -- Joe
Jul 27 2014
next sibling parent reply "Stefan Koch" <uplink.coder gmail.com> writes:
do you use gdc ?
then you have to use -lgphobos2
Jul 27 2014
parent reply "Stefan Koch" <uplink.coder gmail.com> writes:
On Sunday, 27 July 2014 at 12:12:08 UTC, Stefan Koch wrote:
 do you use gdc ?
 then you have to use -lgphobos2
scratch that I wasn't looking :) sdc itself should not use phobos at all as far as I can tell. libsdrt should be selfcontaint.
Jul 27 2014
next sibling parent reply "Stefan Koch" <uplink.coder gmail.com> writes:
On Sunday, 27 July 2014 at 12:16:05 UTC, Stefan Koch wrote:
 On Sunday, 27 July 2014 at 12:12:08 UTC, Stefan Koch wrote:
 do you use gdc ?
 then you have to use -lgphobos2
scratch that I wasn't looking :) sdc itself should not use phobos at all as far as I can tell. libsdrt should be selfcontaint.
your LD_PATH seems to not have the lib in it
Jul 27 2014
next sibling parent "Stefan Koch" <uplink.coder gmail.com> writes:
On Sunday, 27 July 2014 at 12:22:03 UTC, Stefan Koch wrote:
 On Sunday, 27 July 2014 at 12:16:05 UTC, Stefan Koch wrote:
 On Sunday, 27 July 2014 at 12:12:08 UTC, Stefan Koch wrote:
 do you use gdc ?
 then you have to use -lgphobos2
scratch that I wasn't looking :) sdc itself should not use phobos at all as far as I can tell. libsdrt should be selfcontaint.
your LD_PATH seems to not have the lib in it
you have to envoke manualy "bin/sdc" with your modified LD_PATH. or change the makefile
Jul 27 2014
prev sibling parent Joseph Rushton Wakeling via Digitalmars-d-learn writes:
On 27/07/14 14:22, Stefan Koch via Digitalmars-d-learn wrote:
 your LD_PATH seems to not have the lib in it
From the Makefile, I'd understood that LD_PATH was meant to point to the _directory_ where the libraries are contained, not the actual library itself ... ? After all, it's just mapped to a -L flag.
Jul 27 2014
prev sibling parent Joseph Rushton Wakeling via Digitalmars-d-learn writes:
On 27/07/14 14:16, Stefan Koch via Digitalmars-d-learn wrote:
 sdc itself should not use phobos at all as far as I can tell.
 libsdrt should be selfcontaint.
Yes, it's obviously being used to build the compiler, and supplying the flag directly is clearly only necessary in this case for the gcc call that brings together the sdc frontend and the LLVM backend.
Jul 27 2014
prev sibling parent reply "Dicebot" <public dicebot.lv> writes:
Is shared Phobos library in /opt/dmd known do ldconfig? Can you 
build a sample hello world program with -defaultlib=libphobos.so ?
Jul 27 2014
parent reply Joseph Rushton Wakeling via Digitalmars-d-learn writes:
On 27/07/14 15:10, Dicebot via Digitalmars-d-learn wrote:
 Is shared Phobos library in /opt/dmd known do ldconfig?
No, but isn't that what the -L flag should be passing to gcc?
Jul 27 2014
parent reply "Stefan Koch" <uplink.coder gmail.com> writes:
On Sunday, 27 July 2014 at 14:08:42 UTC, Joseph Rushton Wakeling 
via Digitalmars-d-learn wrote:
 On 27/07/14 15:10, Dicebot via Digitalmars-d-learn wrote:
 Is shared Phobos library in /opt/dmd known do ldconfig?
No, but isn't that what the -L flag should be passing to gcc?
if gcc knows where the lib is it can compile agianst it. But the library beeing _shared_ will not be linked with the executable but the library will be loaded form the path's supplied as LD_PATH or in ldconfig. The -L flag does not change the library-loader in any way (I think).
Jul 27 2014
parent reply Joseph Rushton Wakeling via Digitalmars-d-learn writes:
On 27/07/14 16:20, Stefan Koch via Digitalmars-d-learn wrote:
 if gcc knows where the lib is it can compile agianst it.
 But the library beeing _shared_ will not be linked with the executable but the
 library will be loaded form the path's supplied as LD_PATH or in ldconfig.
 The -L flag does not change the library-loader in any way (I think).
Damn, I just realized I was misreading the messages. The gcc build is now succeeding -- it's the calls to bin/sdc that are failing. Adding a dlang.conf file in /etc/ld.so.conf.d/ which adds the /opt/dmd/lib64 path solves things.
Jul 27 2014
parent reply "Dicebot" <public dicebot.lv> writes:
On Sunday, 27 July 2014 at 14:44:29 UTC, Joseph Rushton Wakeling 
via Digitalmars-d-learn wrote:
 Adding a dlang.conf file in /etc/ld.so.conf.d/ which adds the 
 /opt/dmd/lib64 path solves things.
One of many reasons why you don't usually want to circumvent package management system ;)
Jul 27 2014
parent reply "Stefan Koch" <uplink.coder gmail.com> writes:
On Sunday, 27 July 2014 at 15:00:26 UTC, Dicebot wrote:
 On Sunday, 27 July 2014 at 14:44:29 UTC, Joseph Rushton 
 Wakeling via Digitalmars-d-learn wrote:
 Adding a dlang.conf file in /etc/ld.so.conf.d/ which adds the 
 /opt/dmd/lib64 path solves things.
One of many reasons why you don't usually want to circumvent package management system ;)
yeah dub.jsons for sdc,libd,and llvm-libd are nice but I don't really know how these submodule-thingy works with dub
Jul 27 2014
parent "Stefan Koch" <uplink.coder gmail.com> writes:
On Sunday, 27 July 2014 at 15:15:05 UTC, Stefan Koch wrote:
 On Sunday, 27 July 2014 at 15:00:26 UTC, Dicebot wrote:
 On Sunday, 27 July 2014 at 14:44:29 UTC, Joseph Rushton 
 Wakeling via Digitalmars-d-learn wrote:
 Adding a dlang.conf file in /etc/ld.so.conf.d/ which adds the 
 /opt/dmd/lib64 path solves things.
One of many reasons why you don't usually want to circumvent package management system ;)
yeah dub.jsons for sdc,libd,and llvm-libd are nice but I don't really know how these submodule-thingy works with dub
UPDATE my fork https://github.com/UplinkCoder/sdc32-experimental has weak support for beeing build with dub its much much faster then the makefiles though i still need to integrade libsdrt and polish it
Aug 02 2014