Compile fails OS X 10.4

53 views
Skip to first unread message

kannaballistic

unread,
Nov 12, 2009, 1:41:31 AM11/12/09
to golang-nuts
Hello
I'm am trying to compile Go in OS X 10.4. I set the following
variables in .profile:

export GOROOT=$HOME/go
export GOOS=darwin
export GOARCH=386
export GOBIN=/usr/bin

When trying to compile, the compile dies at this point:

%%%% making libmach %%%%

...

/Users/test/go/src/libmach/darwin.c:656: error: parse error before
'regs'
/Users/test/go/src/libmach/darwin.c:657: error:
'x86_THREAD_STATE64_COUNT' undeclared (first use in this function)
make: *** [darwin.o] Error 1
make: *** Waiting for unfinished jobs....

Any help, please?
Thanks!

Ian Lance Taylor

unread,
Nov 12, 2009, 10:02:49 AM11/12/09
to kannaballistic, golang-nuts
kannaballistic <cbra...@gmail.com> writes:

> Hello
> I'm am trying to compile Go in OS X 10.4. I set the following
> variables in .profile:
>
> export GOROOT=$HOME/go
> export GOOS=darwin
> export GOARCH=386
> export GOBIN=/usr/bin


> /Users/test/go/src/libmach/darwin.c:656: error: parse error before
> 'regs'
> /Users/test/go/src/libmach/darwin.c:657: error:
> 'x86_THREAD_STATE64_COUNT' undeclared (first use in this function)
> make: *** [darwin.o] Error 1
> make: *** Waiting for unfinished jobs....


That code is for 64-bit Mach. It may be that that support only
appeared in the Darwin header files in OS X 10.5 and later--I'm not
sure.

Can anybody suggest a #ifdef or something to detect this case?

Ian

Carsten Elton Sørensen

unread,
Nov 12, 2009, 2:17:49 PM11/12/09
to Ian Lance Taylor, kannaballistic, golang-nuts
2009/11/12 Ian Lance Taylor <ia...@google.com>:
> That code is for 64-bit Mach.  It may be that that support only
> appeared in the Darwin header files in OS X 10.5 and later--I'm not
> sure.

10.5 is the first version to have 64 bit support, so yes, you are correct.

> Can anybody suggest a #ifdef or something to detect this case?

There's __LP64__ which is defined to 1 when compiling for a 64 bit architecture.

There's also __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__. The system
headers seem to use this to detect which specific platform you're
compiling for and enables specific types based on this.

#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) &&
__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050
...
#endif

1050 is the magic value for 10.5.0.

Cheers,
Carsten Sørensen

Russ Cox

unread,
Nov 12, 2009, 8:41:43 PM11/12/09
to kannaballistic, golang-nuts
On Wed, Nov 11, 2009 at 22:41, kannaballistic <cbra...@gmail.com> wrote:
> Hello
> I'm am trying to compile Go in OS X 10.4. I set the following
> variables in .profile:
>
> export  GOROOT=$HOME/go
> export GOOS=darwin
> export GOARCH=386
> export GOBIN=/usr/bin
>
> /Users/test/go/src/libmach/darwin.c:656: error: parse error before
> 'regs'
> /Users/test/go/src/libmach/darwin.c:657: error:
> 'x86_THREAD_STATE64_COUNT' undeclared (first use in this function)
> make: *** [darwin.o] Error 1
> make: *** Waiting for unfinished jobs....

I'm afraid that we haven't tried to run Go on OS X 10.4.
Even if you get past this problem and can build everything,
there may be other surprises: Go bypasses the system
libraries and makes system calls directly, and we haven't
tested any of it on 10.4.  It might take some low-level
system hacking to get things working.  I honestly don't know.

If it makes sense for you to do so, the easiest solution is to
switch to 10.5 or 10.6, both of which are known to work.

Please feel free to add this to the issue tracker
(http://code.google.com/p/go/issues/list)
as a way to coordinate with others who might want
to work on making Go run on OS X 10.4.

Russ
Reply all
Reply to author
Forward
0 new messages