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

Build problems on mac osx

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



Joined: 17 Dec 2005
Posts: 2
Location: Sunland, CA

PostPosted: Sat Dec 17, 2005 4:13 pm    Post subject: Build problems on mac osx Reply with quote

I was trying to go ahead and get Derelict working on Tiger, and ran into this curious habit of build. Apparently, this claim:

Quote:

For the DigitalMars compiler, this also specifies the top-level location where object files are created. By default, object files are created in the same directory as the corresponding source file.


Doesn't hold true for the GDC version of build. Indeed, whenever I try to specify the -od switch at all, it recognizes it as the -o outfile switch. What's happening is that in the GDC version of build, all the *.o files are being created in the directory where build was invoked, but then when build goes to link, it assumes that the object files are in the same folder as the corresponding *.d files.

I whipped up a quick test to verify:

./main.d
./test/test.d

main.d:
Code:

import test.test;
int main(char[][] args)
{
  doSomething();
  return 0;
}


test/test.d:
Code:

module test.test;
import std.file;
void doSomething()
{
  printf("Test.\n");
}


Building the code using a straight call to GDC works fine:
Code:

? gdc -o main main.d test/test.d


However, using build yields the following message:
Code:

? build -Xstd main.d
gdc: test/test.o: No such file or directory


What I was thinking, is patching build to invoke the gdmd wrapper script on Posix systems. GDMD supports the -od argument. I don't know how feasible this is.
_________________
daerid | daerid@gmail.com
Back to top
View user's profile Send private message AIM Address
Derek Parnell



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

PostPosted: Sat Dec 17, 2005 6:15 pm    Post subject: Re: Build problems on mac osx Reply with quote

daerid wrote:

What I was thinking, is patching build to invoke the gdmd wrapper script on Posix systems. GDMD supports the -od argument. I don't know how feasible this is.


Currently, Build invokes 'gdc'. I'd be interested in knowing what the exact command line generated by Build looked like. You can see this by using the '-V' switch.

But in the meantime, the patch is easy. There is one line of code to change.

char[] vCompiler = "gdc";

becomes

char[] vCompiler = "gdmd";

Let me know how it goes so I can improve Build.
_________________
--
Derek
skype name: derek.j.parnell
Back to top
View user's profile Send private message
daerid



Joined: 17 Dec 2005
Posts: 2
Location: Sunland, CA

PostPosted: Sat Dec 17, 2005 8:11 pm    Post subject: Reply with quote

I remember trying that, and it worked if you specified -od, but not if you didn't.

Here's the -V output from a clean SVN build of er... build:
Code:

*** build v2.9 (build 1197)***
Current Dir '~/Projects/Test.d/'
No configuration file path, so assuming current directory
Compiler installed in /usr/bin/
Configuration File installed in /usr/bin/
Active Version: 'BigEndian'
Active Version: 'PPC'
Active Version: 'build'
Active Version: 'Unix'
Active Version: 'darwin'
Active Version: 'Posix'
 file->module main.d => main
Updating main.d dependants time from 1134856857 to 1134871244
Time 1134856857 for main.d
Time 1134871244 for main.o
Scanning main.d
 module->file test.test => test/test.d
 file->module test/test.d => test.test
Time 1134856931 for test/test.d
Time not recorded for test/test.o
Scanning test/test.d
Module name set to 'test.test'
 module->file std.file => std/file.d
Ignoring std/file.d (package: std)
source file[0] test/test.d
Newer time: from not recorded to 1134856931
source file[1] main.d
Newer time: from 1134856931 to 1134871244

Building target 'main'
Time not recorded for ~/Projects/Test.d/main (target)
Time 1134871244 (most recent)
test/test.d newer than its object file
Compiling with ..........
-fversion=Posix -I "~/Projects/Test.d/" -I "~/Projects/Test.d/test/" test/test.d

Running '/usr/bin/gdc -c -fversion=Posix -I "~/Projects/Test.d/" -I "~/Projects/Test.d/test/" test/test.d ' # <-- This puts the .o file in ~/Projects/Test.d/, not ~/Projects/Test.d/test/
Successful
Linking with ..........
-fversion=Posix -I "~/Projects/Test.d/" -I "~/Projects/Test.d/test/" -o main test/test.o main.o # <-- Oops! test.o isn't there!

Running '/usr/bin/gdc -fversion=Posix -I "~/Projects/Test.d/" -I "~/Projects/Test.d/test/" -o main test/test.o main.o '
Failed. Return code: 0100


build args: ...............
 [ 0]: -V
 [ 1]: -Xstd

compiler args: ................
 [ 0]: -fversion=Posix
 [ 1]: -I "~/Projects/Test.d/"
 [ 2]: -I "~/Projects/Test.d/test/"

command line files: ...............
 [ 0]: main.d

source files: ...............
 [ 0]: test/test.d
 [ 1]: main.d

import roots: .................
 [ 0]: ~/Projects/Test.d/
 [ 1]: ~/Projects/Test.d/test/

ignored packages: .................
 [ 0]: phobos
 [ 1]: std


I applied the following patch and got it working, although I'm not 100? positive of the repercussions (I can't think of any):

Code:

Index: source.d
===================================================================
--- source.d   (revision 40)
+++ source.d   (working copy)
@@ -209,6 +209,11 @@
             }
         }
         }
+        version(GNU)
+        {
+           /* GDC places object files in the directory from which it is called */
+           mObjectName = getBaseName(mObjectName);
+        }
 
         mBuildNumber = -1;
 


Here's the -V output with the patch applied:
Code:

*** build v2.9 (build 1197)***
Current Dir '~/Projects/Test.d/'
No configuration file path, so assuming current directory
Compiler installed in /usr/bin/
Configuration File installed in /usr/bin/
Active Version: 'BigEndian'
Active Version: 'PPC'
Active Version: 'build'
Active Version: 'Unix'
Active Version: 'darwin'
Active Version: 'Posix'
 file->module main.d => main
Updating main.d dependants time from 1134856857 to 1134871244
Time 1134856857 for main.d
Time 1134871244 for main.o
Scanning main.d
 module->file test.test => test/test.d
 file->module test/test.d => test.test
Updating test/test.d dependants time from 1134856931 to 1134871264
Time 1134856931 for test/test.d
Time 1134871264 for test.o
Scanning test/test.d
Module name set to 'test.test'
 module->file std.file => std/file.d
Ignoring std/file.d (package: std)
Updating main.d dependants time from 1134871244 to 1134871264
source file[0] test/test.d
Newer time: from not recorded to 1134871264
source file[1] main.d

Building target 'main'
Time not recorded for ~/Projects/Test.d/main (target)
Time 1134871264 (most recent)
main.d has newer dependants than its object file.
Compiling with ..........
-fversion=Posix -I "~/Projects/Test.d/" -I "~/Projects/Test.d/test/" main.d

Running '/usr/bin/gdc -c -fversion=Posix -I "~/Projects/Test.d/" -I "~/Projects/Test.d/test/" main.d '
Successful
Linking with ..........
-fversion=Posix -I "~/Projects/Test.d/" -I "~/Projects/Test.d/test/" -o main test.o main.o

Running '/usr/bin/gdc -fversion=Posix -I "~/Projects/Test.d/" -I "~/Projects/Test.d/test/" -o main test.o main.o '
Successful


build args: ...............
 [ 0]: -V
 [ 1]: -Xstd

compiler args: ................
 [ 0]: -fversion=Posix
 [ 1]: -I "~/Projects/Test.d/"
 [ 2]: -I "~/Projects/Test.d/test/"

command line files: ...............
 [ 0]: main.d

source files: ...............
 [ 0]: test/test.d
 [ 1]: main.d

import roots: .................
 [ 0]: ~/Projects/Test.d/
 [ 1]: ~/Projects/Test.d/test/

ignored packages: .................
 [ 0]: phobos
 [ 1]: std

_________________
daerid | daerid@gmail.com
Back to top
View user's profile Send private message AIM Address
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