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

BETA v2.08
Goto page Previous  1, 2
 
Post new topic   Reply to topic     Forum Index -> Build
View previous topic :: View next topic  
Author Message
teqdruid



Joined: 11 May 2004
Posts: 390
Location: UMD

PostPosted: Fri May 27, 2005 1:27 pm    Post subject: Reply with quote

So I've been testing the hell outta this thing, by trying to put all the GTK and Glade libs in pragmas, and here's another bug for ya:
Code:
version(build) {
  pragma(link, glade-2.0);
}

When I do this, it puts just "glade-2" in the dmd command, instead of doing anything with -L-l. It looks like any library name with a dot in it, screws the whole thing up.

I should note that I've made a small modification to build in order to get around the bug in my last post:
I modified line 1241 to:
Code:
version(Posix)   lOutText ~= lPrefix ~ lCmdItem[0..$-3] ~ " ";

So that it won't include the .a .

-John
Back to top
View user's profile Send private message Send e-mail AIM Address
Derek Parnell



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

PostPosted: Fri May 27, 2005 4:59 pm    Post subject: Reply with quote

teqdruid wrote:
So I've been testing the hell outta this thing, by trying to put all the GTK and Glade libs in pragmas,

Thanks a lot for helping me out.
teqdruid wrote:
and here's another bug for ya:
Code:
version(build) {
  pragma(link, glade-2.0);
}

When I do this, it puts just "glade-2" in the dmd command, instead of doing anything with -L-l. It looks like any library name with a dot in it, screws the whole thing up.

The problem is that the Build pragma, unlike the DMD one, is not just designed for library files. You can link any sort of file using this pragma.

What Build does, is if the file you supply has an extension in it, Build doesn't do anything to the file name, but if the file name doesn't have an extention, Build adds ".a" to the file name. This signifies that its a library file.

The text "glade-2.0" is deemed to have the extention ".0" and so Build didn't recognise it as a library file. So when the 'fix' you inserted chopped off the last two characters you ended up with "glade-2" with no prefix of "-L-l" going onto the command line.

As a work around with the Build that you now have, use
Code:
pragma(link, "glade-2.0.a");

Note that I also used quotes around the name. That was to help the DMD parser ignore the dots in the name too.

Anyhow, I've now changed Build to recognise "versioned" library file names. By this I mean that now if a file has a dot in it, and the character to the right of the rightmost dot is a digit, I assume its a library file so I append ".a" to it.

teqdruid wrote:
I should note that I've made a small modification to build in order to get around the bug in my last post:
I modified line 1241 to:
Code:
version(Posix)   lOutText ~= lPrefix ~ lCmdItem[0..$-3] ~ " ";

So that it won't include the .a .

I've put in a more discriminate test to cut this off. I'm amazed that gcc/ld is so brain dead that one can't include library file extention to the name. Wink

The ZIP file has been updated.

http://www.users.bigpond.com/ddparnell/build-beta-2.08.zip
_________________
--
Derek
skype name: derek.j.parnell
Back to top
View user's profile Send private message
JJR



Joined: 22 Feb 2004
Posts: 1104

PostPosted: Fri May 27, 2005 5:47 pm    Post subject: Reply with quote

Actually, the majority of linked in linux libraries are *.so (shared libraries), not *.a. So I guess it's best to be specific with the pragma link by providing the file name lib<name>.so?
Back to top
View user's profile Send private message
Derek Parnell



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

PostPosted: Fri May 27, 2005 9:00 pm    Post subject: Reply with quote

JJR wrote:
Actually, the majority of linked in linux libraries are *.so (shared libraries), not *.a. So I guess it's best to be specific with the pragma link by providing the file name lib<name>.so?


I thought shared libraries were linked in at runtime. Windows DLL files are.
_________________
--
Derek
skype name: derek.j.parnell
Back to top
View user's profile Send private message
JJR



Joined: 22 Feb 2004
Posts: 1104

PostPosted: Fri May 27, 2005 11:01 pm    Post subject: Reply with quote

Well, my understanding is that on Windows a program is linked with the "import libs" at link time to qualify the exported symbols for the program.

Linux shared libraries are different. You just link to the shared library directly and the linker locates the required symbols. At run time the actual symbols are loaded from the library. There is no such thing as an import library. It's much simpler really.

Thus to link with a shared library you provide -L-ldl on the dmd command line (for the dynamic loader shared library) and the linker will know to search for and link in libdl.so with the program.

The dynamic linker knows to search for the dynamic library in /usr/lib and /lib and sometimes /usr/local/lib on most linux systems when the program runs. (But this only for system/public static or dynamic c libraries or d libraries placed in the system directories).

This is why I usually add -L-ldl to the dmd.conf file. Because most programs, like derelict-based ones, will need to link that shared library in anyway.

Really, build shouldn't have to differentiate between shared and static libs on linux. If a user wants to link in a static d based lib, they should just include it fully qualified on the command line: libwhatever.a... or add the libraries location to the search path; or the programmer should add pragma(link, libwhatever.a), ie the full name for static libs and it must be where build can find it. For public C based static libs, the linker should know where to search for them in the common places: /usr/lib and /lib. Otherwise it's the programmers responsibility to provide the path for the linker to search.

Perhaps you could just add another pragma(path,"/path/to/d/libs") to help the linker know where to search. That's equivalent to adding -L-L/path/to/d/libs to the dmd command line.

Now that was a muddley mess. I hope you can follow my babblings.

-JJR
Back to top
View user's profile Send private message
teqdruid



Joined: 11 May 2004
Posts: 390
Location: UMD

PostPosted: Sat May 28, 2005 1:29 am    Post subject: Reply with quote

Hey, hey! Now we're getting somewhere. It appears to work. Great work for not having access to a Linux box, Derek! If you need any help setting up the linux system you mentioned, feel free to shoot me an email.

OT: Out of curiosity, what distribution have you selected?

Quote:
-JJR

Perhaps would be a good idea for all of the Johns to follow suite and sign with initials.


-JDD
Back to top
View user's profile Send private message Send e-mail AIM Address
Derek Parnell



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

PostPosted: Sat May 28, 2005 6:23 am    Post subject: Reply with quote

teqdruid wrote:
Hey, hey! Now we're getting somewhere. It appears to work. Great work for not having access to a Linux box, Derek!


Well, luck happens.

teqdruid wrote:
If you need any help setting up the linux system you mentioned, feel free to shoot me an email.

OT: Out of curiosity, what distribution have you selected?


SimplyMEPIS 3.3
_________________
--
Derek
skype name: derek.j.parnell
Back to top
View user's profile Send private message
Derek Parnell



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

PostPosted: Sun May 29, 2005 1:41 am    Post subject: Reply with quote

Derek Parnell wrote:
teqdruid wrote:
If you need any help setting up the linux system you mentioned, feel free to shoot me an email.

OT: Out of curiosity, what distribution have you selected?


SimplyMEPIS 3.3


I had no trouble getting Linux running. I downloaded dmd for Linux and followed the install instructions and it worked without flaw. I then used my makefile to compile Build and that worked. I then used the Linux Build to build itself and that worked too! Amazing!

The only trouble is that Linux is running off the CD for now and it runs so very slowly when using the GUI (KDE). But the shell commands work with blazing speed, including dmd and build.
_________________
--
Derek
skype name: derek.j.parnell
Back to top
View user's profile Send private message
teqdruid



Joined: 11 May 2004
Posts: 390
Location: UMD

PostPosted: Sun May 29, 2005 9:17 am    Post subject: Reply with quote

Quote:
I had no trouble getting Linux running. I downloaded dmd for Linux and followed the install instructions and it worked without flaw. I then used my makefile to compile Build and that worked. I then used the Linux Build to build itself and that worked too! Amazing!

The only trouble is that Linux is running off the CD for now and it runs so very slowly when using the GUI (KDE). But the shell commands work with blazing speed, including dmd and build.


Glad to hear it!
Back to top
View user's profile Send private message Send e-mail AIM Address
JJR



Joined: 22 Feb 2004
Posts: 1104

PostPosted: Fri Jun 03, 2005 12:01 am    Post subject: Reply with quote

Just want to say "thanks," Derek. Build 2.08 fixed the outstanding issues I had.

2.08 works quite nicely. Smile

-JJR
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
Goto page Previous  1, 2
Page 2 of 2

 
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