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

!!- Fixed Build on OS X (Might Work On Linux Too) -!!

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



Joined: 12 Jul 2006
Posts: 5
Location: Round Rock, TX, USA

PostPosted: Tue Jul 18, 2006 2:18 am    Post subject: !!- Fixed Build on OS X (Might Work On Linux Too) -!! Reply with quote

Well, no guarantees but I made some changes to Build (partly from forums) but I got it working on OS X! I got lost a couple times and probably marred some of the Digital Mars settings a bit, but it should work in a pure GNU/GDC environment. Very Happy

Code:

Index: Source/build.d
===================================================================
--- Source/build.d      (revision 48)
+++ Source/build.d      (working copy)
@@ -161,7 +161,7 @@
             char[] vEtcPath    = "/etc/";
         }
 
-        char[]     vVersionSwitch = "-version";
+        char[]     vVersionSwitch = "-fversion";
         char[]     vDebugSwitch = "-debug";
         char[][]   vCompilerDefs;
         char[]     vOutFileSwitch = "-of";
@@ -195,7 +195,7 @@
         }
 
         version(Posix) {
-            char[] vCompilerExe=`gdc`;
+            char[] vCompilerExe=`gdmd`;
             char[] vCompileOnly= `-c`;
             char[] vLinkerExe=`gdmd`;
             bool   vPostSwitches = false;
@@ -211,18 +211,18 @@
             char[] vConfigSep = ":";
             char[] vLibrarian = `ar`;
             char[] vLibrarianOpts = `-r`;
-            char[] vLinkLibSwitch = "-l-L";
+            char[] vLinkLibSwitch = "-L-l";
             char[] vHomePathId = "HOME";
             char[] vEtcPath    = "/etc/";
         }
-        char[]     vVersionSwitch = "-fversion";
-        char[]     vDebugSwitch = "-fdebug";
-        char[]     vOutFileSwitch = "-o ";
+        char[]     vVersionSwitch = "-version";
+        char[]     vDebugSwitch = "-debug";
+        char[]     vOutFileSwitch = "-of";
         char[][]   vCompilerDefs;
-        char[]     vImportPath = "-I ";
-        char[]     vSymInfoSwitch = "/co";
+        char[]     vImportPath = "-I";
+        char[]     vSymInfoSwitch = "-g";
         /* GDC places object files in the directory from which it is called */
-        bool       vUseModBaseName = true;
+        bool       vUseModBaseName = false;
     }
 
     char[]       vOverrideConfigPath = "";
@@ -934,17 +934,17 @@
 
         if (lFileName.length > 0)
         {
-            lCmdItem = lFileName;
-            if ( util.str.ends(lCmdItem, "." ~ vLibExtention) == True)
-            {
-                // Cut off extention.
-                lCmdItem.length = lCmdItem.length - vLibExtention.length - 1;
-                lLibraryFiles ~= lCmdItem;
-            }
-            else
-            {
+//            lCmdItem = lFileName;
+//            if ( util.str.ends(lCmdItem, "." ~ vLibExtention) == True)
+//            {
+//                // Cut off extention.
+//                lCmdItem.length = lCmdItem.length - vLibExtention.length - 1;
+//                lLibraryFiles ~= lCmdItem;
+//            }
+//            else
+//            {
                 lFilesToLink ~= lCmdItem;
-            }
+//            }
         }
     }
 
@@ -2209,7 +2209,8 @@
         if (vDefaultLibs.length == 0)
         {
             vDefaultLibs ~= "c";
-            vDefaultLibs ~= "phobos";
+            vDefaultLibs ~= "gphobos";
+            vDefaultLibs ~= "pthread";
             vDefaultLibs ~= "m";
         }
     }
Index: Source/Makefile.gdc
===================================================================
--- Source/Makefile.gdc (revision 48)
+++ Source/Makefile.gdc (working copy)
@@ -5,7 +5,7 @@
 all: build
 
 build: $(SOURCES)
-       $(DMD) $(DFLAGS) -of$@ $(SOURCES)
+       $(DMD) -version=BuildVerbose $(DFLAGS) -of$@ $(SOURCES)
 
 clean:
        rm -f *.o build
Index: Source/full.brf
===================================================================
--- Source/full.brf     (revision 48)
+++ Source/full.brf     (working copy)
@@ -1,4 +1,5 @@
 # This creates a production / distribution edition of the program.
+-op
 build.d         # Starting file
 +prod
 # --Derek Parnell-- May 07, 2005 10:43:00 PM
-long auto_build_number = 124;
+long auto_build_number = 132;
Index: Source/util/macro.d
===================================================================
--- Source/util/macro.d (revision 48)
+++ Source/util/macro.d (working copy)
@@ -1,4 +1,5 @@
 module util.macro;
+import util.fileex;
 
 private {
     import util.str;
@@ -630,4 +631,4 @@
     lKnownMacros.length = lKnownMacros.length + 1;
     lKnownMacros[$-1] = pNewMacro;
     vScopes[pScope] = lKnownMacros;
-}
\ No newline at end of file
+}
Back to top
View user's profile Send private message
Derek Parnell



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

PostPosted: Tue Jul 18, 2006 1:23 pm    Post subject: Re: !!- Fixed Build on OS X (Might Work On Linux Too) -!! Reply with quote

Skrylar wrote:
Well, no guarantees but I made some changes to Build (partly from forums) but I got it working on OS X!


THANKS! Very Happy

I'll fold this into the main release.
_________________
--
Derek
skype name: derek.j.parnell
Back to top
View user's profile Send private message
JJR



Joined: 22 Feb 2004
Posts: 1104

PostPosted: Tue Jul 18, 2006 7:44 pm    Post subject: Reply with quote

Good Job, Skrylar!

It's contributions like that that keep D moving forward. Smile

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



Joined: 22 Jul 2006
Posts: 2

PostPosted: Sat Jul 22, 2006 4:36 am    Post subject: Reply with quote

I'm running OS X 10.3.9 with gcc version 3.3.6 (gdc 0.18, using dmd 0.157).

After making Skrylar's changes I was able to compile Build ok, but when I tried using it to create a simple "Hello world" program, it failed with the following link errors:

Code:

Building target '/Users/agentsmith/hello'
Time not recorded for hello (target)
Time 1153563622 (most recent)
Linking with ..........
 hello.o -of hello -L-lc -L-lgphobos -L-lpthread -L-lm

Running '/usr/bin/gdmd  hello.o -of hello -L-lc -L-lgphobos -L-lpthread -L-lm'
ld: multiple definitions of symbol __Dmain
hello.o definition of __Dmain in section (__TEXT,__text)
hello.o definition of __Dmain in section (__TEXT,__text)
ld: multiple definitions of symbol __ModuleInfo_5hello
hello.o definition of __ModuleInfo_5hello in section (__DATA,__data)
hello.o definition of __ModuleInfo_5hello in section (__DATA,__data)
Failed. Return code: 0100



I was able to build the same program ok just using: gdc hello.d -o hello
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