www.digitalmars.com         C & C++   DMDScript  

D - D and linux

reply C <dont respond.com> writes:
This is a reference to D not finding phobos as some people have reported=
 =

( has this already been resolved ? ) , I noticed that arranging the file=
s =

using GCC to link makes a difference.  By including the libraries first,=
 i =

get a slew of unresolved dealing with array / assert / invariant etc.

// This will fail with unresolved
gcc  -lpthread -lphobos `curl-config --libs` rm_class.o easycurl.o =

rm_submitter.o -o rm_submitter

// This works ok
gcc  rm_class.o easycurl.o rm_submitter.o -o rm_submitter -lpthread =

-lphobos `curl-config --libs`

I think we should setup a D for Linux FAQ , maybe on the wiki.

C
Mar 12 2004
parent reply =?ISO-8859-15?Q?Julio_Jim=E9nez?= <jujibo inicia.es> writes:
C wrote:
 
 This is a reference to D not finding phobos as some people have reported 
 ( has this already been resolved ? ) , I noticed that arranging the 
 files using GCC to link makes a difference.  By including the libraries 
 first, i get a slew of unresolved dealing with array / assert / 
 invariant etc.
 
 // This will fail with unresolved
 gcc  -lpthread -lphobos `curl-config --libs` rm_class.o easycurl.o 
 rm_submitter.o -o rm_submitter
 
 // This works ok
 gcc  rm_class.o easycurl.o rm_submitter.o -o rm_submitter -lpthread 
 -lphobos `curl-config --libs`
 
 I think we should setup a D for Linux FAQ , maybe on the wiki.
 
 C

From man gcc.... ... Thus, foo.o -lz bar.o searches library z after file foo.o but before bar.o. If bar.o refers to functions in z, those functions may not be loaded. ... That is simply... ;-) But I agree with you for a D Linux FAQ. There are some tricks when using gcc to link D modules... like when use Debug levels in D libraries.... regards Julio
Mar 13 2004
parent reply C <dont respond.com> writes:
Hmm , what tricks :) ?


C

On Sat, 13 Mar 2004 11:13:17 +0100, Julio Jim=E9nez <jujibo inicia.es> w=
rote:

 C wrote:
 This is a reference to D not finding phobos as some people have =


 reported ( has this already been resolved ? ) , I noticed that =


 arranging the files using GCC to link makes a difference.  By includi=


 the libraries first, i get a slew of unresolved dealing with array / =


 assert / invariant etc.

 // This will fail with unresolved
 gcc  -lpthread -lphobos `curl-config --libs` rm_class.o easycurl.o =


 rm_submitter.o -o rm_submitter

 // This works ok
 gcc  rm_class.o easycurl.o rm_submitter.o -o rm_submitter -lpthread =


 -lphobos `curl-config --libs`

 I think we should setup a D for Linux FAQ , maybe on the wiki.

 C

From man gcc.... ... Thus, foo.o -lz bar.o searches library z after file foo.o but before =

 bar.o. If bar.o refers to functions in z, those functions may not be =

 loaded.
 ...

 That is simply... ;-)


 But I agree with you for a D Linux FAQ. There are some tricks when usi=

 gcc to link D modules... like when use Debug levels in D libraries....=

 regards


 Julio

-- = Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Mar 15 2004
parent =?ISO-8859-15?Q?Julio_Jim=E9nez?= <jujibo inicia.es> writes:
C wrote:
 Hmm , what tricks :) ?
 

Have you build a D library with debug code like this: ... class Connection { private: PGconn* pgConn; public: this(char[] connInfo) { pgConn = PQconnectdb(toStringz(connInfo)); debug(1) printf("Connection Created\n"); // executed in debug level 1 } this() { this(""); } ... and then if you link the library in the normal way to your code, get link errors... the trick (or the correct way to do that) is for run your code with debug code inside it and inside library... regards Julio
Mar 15 2004