Thread overview
Error when building universal binary
Aug 05, 2008
Jacob Carlborg
Aug 05, 2008
Anders Bergh
Aug 06, 2008
Jacob Carlborg
Aug 07, 2008
Jacob Carlborg
Aug 10, 2008
David Friedman
Aug 11, 2008
Jacob Carlborg
August 05, 2008
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.
August 05, 2008
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
August 05, 2008
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
August 06, 2008
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
August 07, 2008
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.
August 10, 2008
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
August 10, 2008
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
August 11, 2008
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