cgo error on Mac OSX Mountain Lion

172 views
Skip to first unread message

Olivier Van Acker

unread,
Aug 27, 2012, 9:09:44 AM8/27/12
to golan...@googlegroups.com
When I run .mkall.sh in src/pkg/syscall to generate code I get the following error:

./mkall.sh 
In file included from _const.go:9:
/usr/include/sys/socket.h:705: error: expected specifier-qualifier-list before 'user64_addr_t'
/usr/include/sys/socket.h:720: error: expected specifier-qualifier-list before 'user32_addr_t'
/usr/include/sys/socket.h:909: error: expected specifier-qualifier-list before 'user64_addr_t'
/usr/include/sys/socket.h:917: error: expected specifier-qualifier-list before 'user32_addr_t'
go tool cgo: exit status 2
In file included from types_darwin.go:34:
/usr/include/sys/socket.h:705: error: expected specifier-qualifier-list before 'user64_addr_t'
/usr/include/sys/socket.h:720: error: expected specifier-qualifier-list before 'user32_addr_t'
/usr/include/sys/socket.h:909: error: expected specifier-qualifier-list before 'user64_addr_t'
/usr/include/sys/socket.h:917: error: expected specifier-qualifier-list before 'user32_addr_t'
go tool cgo: exit status 2

Is this related to this issue: http://codereview.appspot.com/4244052/ ?

Regards,

Olivier

minux

unread,
Aug 27, 2012, 9:14:39 AM8/27/12
to Olivier Van Acker, golan...@googlegroups.com
On Mon, Aug 27, 2012 at 9:09 PM, Olivier Van Acker <cyber...@gmail.com> wrote:
When I run .mkall.sh in src/pkg/syscall to generate code I get the following error:
why you want to run mkall.sh?
it's possible that mkall.sh and related source files are out-of-date. 
i don't think so.

Olivier Van Acker

unread,
Aug 27, 2012, 9:19:49 AM8/27/12
to minux, golan...@googlegroups.com
On 27 August 2012 14:14, minux <minu...@gmail.com> wrote:

On Mon, Aug 27, 2012 at 9:09 PM, Olivier Van Acker <cyber...@gmail.com> wrote:
When I run .mkall.sh in src/pkg/syscall to generate code I get the following error:
why you want to run mkall.sh?
it's possible that mkall.sh and related source files are out-of-date. 

I'm adding SCTP network functionality to Go and I need to add the relevant structures/socket api calls to Go before I can add it to the network library


Olivier

minux

unread,
Aug 27, 2012, 11:45:30 AM8/27/12
to Olivier Van Acker, golan...@googlegroups.com
On Mon, Aug 27, 2012 at 9:19 PM, Olivier Van Acker <cyber...@gmail.com> wrote:
On 27 August 2012 14:14, minux <minu...@gmail.com> wrote:
On Mon, Aug 27, 2012 at 9:09 PM, Olivier Van Acker <cyber...@gmail.com> wrote:
When I run .mkall.sh in src/pkg/syscall to generate code I get the following error:
why you want to run mkall.sh?
it's possible that mkall.sh and related source files are out-of-date. 
I'm adding SCTP network functionality to Go and I need to add the relevant structures/socket api calls to Go before I can add it to the network library
ok. then you need to try to manually do what mkall.sh do step by step and isolate the step
that is causing the error.

it should be a call to 'go tool cgo', and you can add -debug-gcc flag to enable debugging output
so that you can know the exact gcc invocation command line and also its input file.
i think you know how to proceed from here on.

Olivier Van Acker

unread,
Aug 27, 2012, 12:29:37 PM8/27/12
to golan...@googlegroups.com, Olivier Van Acker
Found it:
gcc -Wall -Werror -o_obj/_cgo_.o -gdwarf-2 -fno-eliminate-unused-debug-types -c -xc -m64 /usr/include/sys/socket.h 
/usr/include/sys/socket.h:500: error: expected specifier-qualifier-list before ‘user64_addr_t’
/usr/include/sys/socket.h:515: error: expected specifier-qualifier-list before ‘user32_addr_t’
/usr/include/sys/socket.h:664: error: expected specifier-qualifier-list before ‘user64_addr_t’
/usr/include/sys/socket.h:672: error: expected specifier-qualifier-list before ‘user32_addr_t’
 
Double checked and found out this is not the original socket.h but a modified version (cause of adding sctp), re-installing the Command Line Tools (XCode installer) solved the problem, 

Thanks

Olivier
 
Reply all
Reply to author
Forward
0 new messages