Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/cgo: test fails to build on Mac OS 10.9.4. #8312

Closed
faried opened this issue Jul 2, 2014 · 9 comments
Closed

cmd/cgo: test fails to build on Mac OS 10.9.4. #8312

faried opened this issue Jul 2, 2014 · 9 comments

Comments

@faried
Copy link

faried commented Jul 2, 2014

This is with

go version devel +86b431eeb5c2 Tue Jul 01 18:24:43 2014 -0400 darwin/amd64

gcc -v says

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr
--with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.2.0
Thread model: posix

When I run ./all.bash, the packages and commands are built properly for the platform,
and all the tests pass until it hits misc/cgo/test:

[...]
ok      unicode 0.025s
ok      unicode/utf16   0.021s
ok      unicode/utf8    0.028s
?       unsafe  [no test files]

real    1m47.500s
user    1m43.848s
sys 0m27.704s

# GOMAXPROCS=2 runtime -cpu=1,2,4
ok      runtime 25.623s

# sync -cpu=10
ok      sync    0.075s

# Testing race detector.
ok      runtime/race    4.668s
ok      flag    1.298s

# ../misc/cgo/stdio

# ../misc/cgo/life

# ../misc/cgo/test
# _/Users/fn/go/misc/cgo/test
./cthread_unix.c:17:3: error: implicit declaration of function 'Add' is invalid in C99
[-Werror,-Wimplicit-function-declaration]
FAIL    _/Users/fn/go/misc/cgo/test [build failed]
$
@davecheney
Copy link
Contributor

Comment 1:

I'm sorry if I'm not following the osx update story closely. I run one of the darwin
builders, which is running os x 10.9.something, where something is whatever is the
latest that apple have pushed to this machine. There are no errors with the builder
Could this possibly be a problem with your local machine ? Which version of Xcode are
you using, we pretty much assume you're running the latest available. Is there an
oddball version of clang (or gcc) in your path that the build process could be picking
up ?
Are you 105% sure that you do _not_ have GOOS, GOROOT or GOARCH set. These are not
necessary for building Go from source.

Status changed to WaitingForReply.

@faried
Copy link
Author

faried commented Jul 2, 2014

Comment 2:

I don't have any of the GO env vars set.  I set GOPATH manually when needed.
Over the years I've upgraded this computer from Mac OS 10.6 to 10.9.4, and Xcode
3.whatever to the current 5.1.1.  It likely is something specific to this computer.

@ianlancetaylor
Copy link
Contributor

Comment 3:

Hmmm, yeah, I took a look and this should work independent of compiler.
If you can, please cd to the directory misc/cgo/test.  If you run "go test", you should
see the failure that you reported.  Please run "go test -work".  It will print out a
temporary directory name, and won't delete it.  In that directory, there will be a file
_cgo_export.h.  Please attach that file here.  Thanks.

@ianlancetaylor
Copy link
Contributor

Comment 4:

Labels changed: added release-go1.3.1, repo-main.

@faried
Copy link
Author

faried commented Jul 2, 2014

Comment 5:

Attached.  Thanks!

Attachments:

  1. _cgo_export.h (3385 bytes)

@ianlancetaylor
Copy link
Contributor

Comment 6:

Thanks.  The function Add is indeed declared in that file.  And cthread_unix.c does
#include "_cgo_export.h".  So I have no idea what is going on.  Is it somehow picking up
a different _cgo_export.h?  Do you have a _cgo_export.h anywhere in your Go source tree?
I guess for the next step please run "go test -work -x" and attach the output and also
the complete contents of the temporary directory that it creates.  Thanks.

@faried
Copy link
Author

faried commented Jul 2, 2014

Comment 7:

That was it -- there was a _cgo_export.h in my misc/cgo/test directory, dating back to
Jan 2012.  Removing that fixed the problem.  How annoying.
Thanks for the time.

@ianlancetaylor
Copy link
Contributor

Comment 8:

Thanks for sticking with it, and figuring it out.

Status changed to Invalid.

@rsc
Copy link
Contributor

rsc commented Aug 11, 2014

Comment 9:

Labels changed: added release-none, removed release-go1.3.1.

@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants