Mac OS X compiling

Ryan Govostes
Mon Nov 16 22:44:00 GMT 2009


On Nov 16, 2009, at 4:28 PM, Yann E. MORIN wrote:

> Hello Ryan!
> Hello All!
> On Monday 16 November 2009 21:22:08 Ryan Govostes wrote:
>> I'm trying to use crosstool-NG on OS X
> OS-X is strange, yes. I don't have it, so I have to rely on others
> (like you) to report success/failure.
>> to build for the x86_64-elf target. 
>> I haven't gotten very far yet so I'll let you know how it goes once I make
>> more progress, but first I thought I'd ask about a few things:
>> 1) crosstool-NG's configure script rejects OS X's sed because it doesn't
>> support GNU's -r flag, as you note on your website. However, the FreeBSD
>> version does support -E, which would appear to do the same thing. What do
>> you think about having configure autodetect the correct flag to support
>> FreeBSD-based systems better?
> Do you have a man page for the sed in the *BSD world? (I mean: can you send
> me a man page.)

Here is the manpage that I see:

> On the overal, yes, that's be nice to have a way to select it.
>> 2) configure also searches for GNU libtool at `which libtool`, but on OS
>> X this is Apple's libtool. The GNU libtool is on the system is installed,
>> but is named glibtool. Likewise for glibtoolize. However, configure
>> provides no means of specifying this.
> Look at how --with-bash, --with-install and so on work. You can craft
> a similar support for libtool: --with-libtool=/path/to/libtool
> Then, a proper wrapper will be added at build time.
>> 3) It looks for the 'stat' command to get information about files.
>> Net/FreeBSD's stat does not support the -c flag, which causes errors. It
>> does support -f for specifying a format, but the format strings are very
>> dissimilar. From what I can see, you are using %F, %a, and %i for file
>> type, access rights in octal, and inode number, respectively. These are
>> a little harder to get, but they seem to be supported.
> Again, do you have a man page?

> Wouldn't it be easier if you install the Ports collection?

Probably, but in my opinion this is not a graceful solution; my computer most likely has all dependencies already, I don't want to install, e.g., two copies of sed just because there are minor differences in argument conventions.

I'm attaching a patch to the configure script. Since I'm not too familiar with the build system I'd like some feedback on it while I continue to make more changes. Here is what is new:

1) More effective detection of sed parameters. Checks for the correct format of the zero-length -i option, as well as -r vs -E for extended regex.

2) More effective detection of libtool / libtoolize. Looks for glibtool / glibtoolize if the first check fails.

3) More effective of detection of stat. So far, just determines whether to pass -c or -f, but since the format strings are different, this should be elaborated on.

4) Custom implementation of recursive readlink (i.e., `readlink -e`). This option is not supported on BSD, so we simulate it.

I think the options detected during configuration still need to be somehow passed through to the build scripts, since right now they are used to generate the Makefile and then go out of scope.

Ryan Govostes

-------------- next part --------------
A non-text attachment was scrubbed...
Name: osx-compat-rev1.diff
Type: application/octet-stream
Size: 8702 bytes
Desc: not available
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2446 bytes
Desc: not available
URL: <>

More information about the crossgcc mailing list