Thread overview
D and linux
Mar 12, 2004
C
Mar 13, 2004
Julio Jiménez
Mar 15, 2004
C
Mar 15, 2004
Julio Jiménez
March 12, 2004
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
March 13, 2004
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

March 15, 2004
Hmm , what tricks :) ?


C

On Sat, 13 Mar 2004 11:13:17 +0100, Julio Jiménez <jujibo@inicia.es> wrote:

> 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
>



-- 
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
March 15, 2004
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