FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to control linking order of libraries on linux?

 
Post new topic   Reply to topic     Forum Index -> Build
View previous topic :: View next topic  
Author Message
Bradley Smith



Joined: 20 Jun 2006
Posts: 60

PostPosted: Wed Nov 22, 2006 12:06 am    Post subject: How to control linking order of libraries on linux? Reply with quote

I want to build a program which uses a library gld that depends on libraries GL, GLU, x11, and phobos. I can't get the order of the libraries correct.

I have tried reordering the libraries
Code:
bud -test source/examples/triangle.d -L-L-L../x11 -L-L-L. gld.a x11.a
bud -test source/examples/triangle.d -L-L-L../x11 -L-L-L. x11.a gld.a

but both of the above commands always produce the wrong library order
Code:
Command: '/home/basmith/tools/dmd/dmd/bin/dmd -L-L../x11 -L-L. source/examples/triangle.o -ofsource/examples/triangle -L-lc -L-lphobos -L-lpthread -L-lm -L-lx11 -L-lgld -L-L/home/basmith/tools/dmd/dmd/lib'

I need the order to be gld then x11.

How do run build to execute the following link command?
Code:
dmd source/examples/triangle.o -oftriangle -L-L. -L-L../x11 -L-lgld -L-lx11 -L-lGL -L-lGLU -L-L/home/basmith/tools/dmd/dmd/lib -L-lphobos -L-lpthread
Back to top
View user's profile Send private message
Derek Parnell



Joined: 22 Apr 2004
Posts: 408
Location: Melbourne, Australia

PostPosted: Wed Nov 22, 2006 1:59 am    Post subject: Re: How to control linking order of libraries on linux? Reply with quote

Bradley Smith wrote:
I want to build a program which uses a library gld that depends on libraries GL, GLU, x11, and phobos. I can't get the order of the libraries correct.

It looks like we have fallen victim of the Associative Array hashing algorithm. I store the names of libraries in an AA with the library name as the key. I do this to avoid duplications. However, I output the libraries based on the order the .keys property which is not necessarily the same as the order they were entered.

This is a bug and I'll fix it ASAP.
_________________
--
Derek
skype name: derek.j.parnell
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Build All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group