www.digitalmars.com         C & C++   DMDScript  

D.gnu - Error when building universal binary

reply Jacob Carlborg <doobnet gmail.com> writes:
I'm trying to build a universal binary on Mac OS X 10.5.4 using the gdc 
bundle from the tango website: 
http://www.dsource.org/projects/tango/wiki/GdcDownloads

I'm using the "-arch" option and I get this error:
cc1d: error: unrecognized command line option "-arch"
(it doesn't matter if I use gdc or gdmd)

Doesn't gdc support the "-arch" option? I thought that if it worked with 
gcc it would also work with gdc.
Aug 05 2008
next sibling parent "Anders Bergh" <anders1 gmail.com> writes:
On Tue, Aug 5, 2008 at 4:10 PM, Jacob Carlborg <doobnet gmail.com> wrote:
 I'm trying to build a universal binary on Mac OS X 10.5.4 using the gdc
 bundle from the tango website:
 http://www.dsource.org/projects/tango/wiki/GdcDownloads

 I'm using the "-arch" option and I get this error:
 cc1d: error: unrecognized command line option "-arch"
 (it doesn't matter if I use gdc or gdmd)

 Doesn't gdc support the "-arch" option? I thought that if it worked with gcc
 it would also work with gdc.

The gdc in the bundle probably doesn't have the Apple gcc patches, it's pretty easy to compile your own gdc using the gcc from developer.apple.com/opensource though... and that will support -arch. -- Anders
Aug 05 2008
prev sibling parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Jacob Carlborg wrote:

 I'm using the "-arch" option and I get this error:
 cc1d: error: unrecognized command line option "-arch"
 (it doesn't matter if I use gdc or gdmd)
 
 Doesn't gdc support the "-arch" option? I thought that if it worked with 
 gcc it would also work with gdc.

FSF's GCC does not support this, but Apple's GCC does. (the "gdcmac" builds use the Apple GCC instead of FSF) When building with the "regular" GCC, you instead run one cross-compilation with powerpc-apple-darwin9-gdc and one cross-compilation with i686-apple-darwin9-gdc, and then lipo(1) the resulting two objects together... Apple's GCC has a frontend that does all this for you. i.e. gdc -arch ppc -arch i386 will call the above two --anders
Aug 05 2008
next sibling parent Jacob Carlborg <doobnet gmail.com> writes:
Anders F Björklund wrote:
 Jacob Carlborg wrote:
 
 I'm using the "-arch" option and I get this error:
 cc1d: error: unrecognized command line option "-arch"
 (it doesn't matter if I use gdc or gdmd)

 Doesn't gdc support the "-arch" option? I thought that if it worked 
 with gcc it would also work with gdc.

FSF's GCC does not support this, but Apple's GCC does. (the "gdcmac" builds use the Apple GCC instead of FSF) When building with the "regular" GCC, you instead run one cross-compilation with powerpc-apple-darwin9-gdc and one cross-compilation with i686-apple-darwin9-gdc, and then lipo(1) the resulting two objects together... Apple's GCC has a frontend that does all this for you. i.e. gdc -arch ppc -arch i386 will call the above two --anders

ok
Aug 06 2008
prev sibling parent reply Jacob Carlborg <doobnet gmail.com> writes:
Anders F Björklund wrote:
 Jacob Carlborg wrote:
 
 I'm using the "-arch" option and I get this error:
 cc1d: error: unrecognized command line option "-arch"
 (it doesn't matter if I use gdc or gdmd)

 Doesn't gdc support the "-arch" option? I thought that if it worked 
 with gcc it would also work with gdc.

FSF's GCC does not support this, but Apple's GCC does. (the "gdcmac" builds use the Apple GCC instead of FSF) When building with the "regular" GCC, you instead run one cross-compilation with powerpc-apple-darwin9-gdc and one cross-compilation with i686-apple-darwin9-gdc, and then lipo(1) the resulting two objects together... Apple's GCC has a frontend that does all this for you. i.e. gdc -arch ppc -arch i386 will call the above two --anders

Can I assume that the -framework option doesn't work? It seems that it doesn't but I don't get an error.
Aug 07 2008
parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Jacob Carlborg wrote:

 Can I assume that the -framework option doesn't work? It seems that it 
 doesn't but I don't get an error.

I was under the impression that it should work with GCC 4.x (for earlier versions I made a patch for FSF GCC 3.3.5) But there are two things that -framework does, it adds a search patch for includes (like -I) and it adds a library and a search path for libraries (like -L) to the linker. Maybe the vanilla -framework support in FSF GCC "forgets" the linker ? You can make it add it by using something like "-Wl,-framework,Carbon" --anders
Aug 10 2008
next sibling parent David Friedman <dvdfrdmn users.ess-eff.net> writes:
Anders F Björklund wrote:
 Jacob Carlborg wrote:
 
 Can I assume that the -framework option doesn't work? It seems that it 
 doesn't but I don't get an error.

I was under the impression that it should work with GCC 4.x (for earlier versions I made a patch for FSF GCC 3.3.5) But there are two things that -framework does, it adds a search patch for includes (like -I) and it adds a library and a search path for libraries (like -L) to the linker. Maybe the vanilla -framework support in FSF GCC "forgets" the linker ? You can make it add it by using something like "-Wl,-framework,Carbon" --anders

The FSF GCC (4.0 and later, at least) simply passes the -framework option to the linker so it "just works". I think the only change in the Apple version is to require an argument after the option. David
Aug 10 2008
prev sibling parent Jacob Carlborg <doobnet gmail.com> writes:
Anders F Björklund wrote:
 Jacob Carlborg wrote:
 
 Can I assume that the -framework option doesn't work? It seems that it 
 doesn't but I don't get an error.

I was under the impression that it should work with GCC 4.x (for earlier versions I made a patch for FSF GCC 3.3.5) But there are two things that -framework does, it adds a search patch for includes (like -I) and it adds a library and a search path for libraries (like -L) to the linker. Maybe the vanilla -framework support in FSF GCC "forgets" the linker ? You can make it add it by using something like "-Wl,-framework,Carbon" --anders

I'll try that
Aug 11 2008