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

Build 2.10 on Linux

 
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: Thu Apr 06, 2006 11:11 am    Post subject: Build 2.10 on Linux Reply with quote

You were right-- you appear to have gotten it wrong for unix.

First, you probably want to use 'gcc' instead of '/usr/bin/ld'. I dunno why, but using gcc works and ld doesn't.

On a simple program, build runs the following:
/usr/bin/ld fasta.o -o fasta -M -lc /noi/map

What's /nio/map?
The command that works is:
gcc fasta.o -o fasta -lphobos -lpthread -lm
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: Thu Apr 06, 2006 7:45 pm    Post subject: Re: Build 2.10 on Linux Reply with quote

teqdruid wrote:
You were right-- you appear to have gotten it wrong for unix.

Laughing I'm not surprised. I don't have a linux to test against so I just read whatever docs I could find and made some guesses about what to do.

teqdruid wrote:
First, you probably want to use 'gcc' instead of '/usr/bin/ld'. I dunno why, but using gcc works and ld doesn't.

On a simple program, build runs the following:
/usr/bin/ld fasta.o -o fasta -M -lc /noi/map
Does it work if you drop off the /noi/map stuff?

teqdruid wrote:
What's /nio/map?

A mistake. It is only supposed to be used with the Windows link program.

teqdruid wrote:
The command that works is:
gcc fasta.o -o fasta -lphobos -lpthread -lm


Ok, I can do this, but where do I get the library information from? I mean, how can I work out what libraries to use just from reading the source files? Or do I need to have you code these in the 'build.cfg' file? eg.
Code:

LINKSWITCH=-lphobos -pthread -lm

so these libraries get added to every link command.
_________________
--
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: Thu Apr 06, 2006 11:08 pm    Post subject: Re: Build 2.10 on Linux Reply with quote

Derek Parnell wrote:
teqdruid wrote:
You were right-- you appear to have gotten it wrong for unix.

Laughing I'm not surprised. I don't have a linux to test against so I just read whatever docs I could find and made some guesses about what to do.


So install Linux. It's not hard to install and dual-boot with Windows.

Quote:
teqdruid wrote:
The command that works is:
gcc fasta.o -o fasta -lphobos -lpthread -lm


Ok, I can do this, but where do I get the library information from? I mean, how can I work out what libraries to use just from reading the source files? Or do I need to have you code these in the 'build.cfg' file? eg.
Code:

LINKSWITCH=-lphobos -lpthread -lm

so these libraries get added to every link command.


dmd always includes those switches, so it's probably best to have build just include them by default, but make it overridable in the config file. I, by the way, don't use a config file for build and I'd rather it not be necessary. The choice of linking program and compiling program to run should also be configurable somewhere but needs a default.

Previous versions of build have also taken libraries to link in via a pragma. I haven't checked this one yet, but it should do that the same as before.

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



Joined: 03 Dec 2005
Posts: 224
Location: Stuttgart - Germany

PostPosted: Fri Apr 14, 2006 1:09 pm    Post subject: segfault with -V Reply with quote

When I try to run with -V I get a segfault. Here is a gdb backtrace:

Quote:
#0 0x0804e3f9 in source.Source._ctor(char[]) () at source.d:240
#1 0x0804ea33 in source.Source.search() () at source.d:403
#2 0x0804e4af in source.Source._ctor(char[]) () at source.d:256
#3 0x0804ea33 in source.Source.search() () at source.d:403
#4 0x0804e4af in source.Source._ctor(char[]) () at source.d:256
#5 0x0804ea33 in source.Source.search() () at source.d:403
#6 0x0804e4af in source.Source._ctor(char[]) () at source.d:256
#7 0x080532d2 in build.Build() () at build.d:701
#8 0x0805778f in D main () at build.d:2179
#9 0x0805da27 in main ()


Hope that helps
Back to top
View user's profile Send private message
brad
Site Admin


Joined: 22 Feb 2004
Posts: 490
Location: Atlanta, GA USA

PostPosted: Mon Jun 05, 2006 10:11 am    Post subject: Re: Build 2.10 on Linux Reply with quote

teqdruid wrote:
You were right-- you appear to have gotten it wrong for unix.

First, you probably want to use 'gcc' instead of '/usr/bin/ld'. I dunno why, but using gcc works and ld doesn't.

On a simple program, build runs the following:
/usr/bin/ld fasta.o -o fasta -M -lc /noi/map

What's /nio/map?
The command that works is:
gcc fasta.o -o fasta -lphobos -lpthread -lm


A potential patch is included. I'm not sure how general it is, or appropriate... for instance, I needed the trailing spaces for some reason.
Code:

> svn diff
Index: Source/build.d
===================================================================
--- Source/build.d      (revision 43)
+++ Source/build.d      (working copy)
@@ -125,11 +125,11 @@
         version(Posix) {
             char[] vCompilerExe=`dmd`;
             char[] vCompileOnlySwitch= ` -c`;
-            char[] vLinkerExe=`ld`;
+            char[] vLinkerExe=`gcc`;
             char[] vConfigFile=`dmd.conf`;
             char[] vCompilerPath=``;
             char[] vLinkerPath=``;
-            char[] vLinkerDefSwitches=`/noi/map`;
+            char[] vLinkerDefSwitches=`-lphobos -lpthread -lm `;
             char[] vConfigPath=`/etc/`;
             char[] vLibPaths = ``;
             char[] vConfigSep = ":";
@@ -2405,8 +2405,8 @@
                 if (pArg == "-g")
                 {
                     // Requires symbolic debug info.
-                    vLinkerDefSwitches ~= "/co";
-                    AddCompilerArg(pArg);
+                 //                    vLinkerDefSwitches ~= "/co ";
+                 //                    AddCompilerArg(pArg);
                     break;
                 }


The last bit was b/c I had some issue with the -g switch.

hth,
BA
Back to top
View user's profile Send private message
brad
Site Admin


Joined: 22 Feb 2004
Posts: 490
Location: Atlanta, GA USA

PostPosted: Mon Jun 05, 2006 10:21 am    Post subject: Reply with quote

Further, a patch on ticket #17 for Build seems to be more comprehensive: http://www.dsource.org/projects/build/ticket/17
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