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

build: use clang instead of gcc on OS X #5822

Closed
rsc opened this issue Jul 1, 2013 · 5 comments
Closed

build: use clang instead of gcc on OS X #5822

rsc opened this issue Jul 1, 2013 · 5 comments
Milestone

Comments

@rsc
Copy link
Contributor

rsc commented Jul 1, 2013

Should we use clang instead of gcc for the OS X build? It seems increasingly clear that
Apple's focus on clang means the gcc in Xcode is being left behind.

For example it has been true for at least a year now that gcc -O2 -Wall does not report
use of uninitialized variables. The back end converts them to ud2a and the code crashes
at run time. Compiling with clang does report them. (The underlying bug appears to be
that the gcc back end assumes the clang front end reported them.)
@davecheney
Copy link
Contributor

Comment 1:

I think it is worth a try. There is one issue with test/cgo and clang, but I think that
can be solved.

@rsc
Copy link
Contributor Author

rsc commented Jul 30, 2013

Comment 2:

OS X 10.9 Mavericks is going to ship a "gcc" that just runs clang.
If we say gcc we expect gcc.
If we say clang we expect clang.
Getting clang when we expect gcc does not work.
Therefore we need to start using clang by default.
See issue #5926.

Status changed to Accepted.

@rsc
Copy link
Contributor Author

rsc commented Jul 30, 2013

Comment 3:

Labels changed: added feature.

@fsouza
Copy link
Contributor

fsouza commented Aug 1, 2013

Comment 4:

Which version of clang comes with Mavericks?
FWIW, clang trunk (future 3.4), fails to run make.bash with the following error:
% $CC --version
clang version 3.4 (trunk 187311)
Target: x86_64-apple-darwin12.4.0
Thread model: posix
% ./all.bash
# Building C bootstrap tool.
cmd/dist
# usual output
#
# ...
image/draw
image/gif
image/jpeg
image/png
runtime/debug
runtime/race
net
os/user
testing
testing/iotest
testing/quick
text/scanner
# os/user
lookup_unix.go:98: pwd.pw_uid undefined (type [0]byte has no field or method pw_uid)
lookup_unix.go:99: pwd.pw_gid undefined (type [0]byte has no field or method pw_gid)
lookup_unix.go:100: pwd.pw_name undefined (type [0]byte has no field or method pw_name)
lookup_unix.go:101: pwd.pw_gecos undefined (type [0]byte has no field or method pw_gecos)
lookup_unix.go:102: pwd.pw_dir undefined (type [0]byte has no field or method pw_dir)
# net
cgo_unix.go:42: hints.ai_socktype undefined (type [0]byte has no field or method
ai_socktype)
cgo_unix.go:43: hints.ai_protocol undefined (type [0]byte has no field or method
ai_protocol)
cgo_unix.go:45: hints.ai_socktype undefined (type [0]byte has no field or method
ai_socktype)
cgo_unix.go:46: hints.ai_protocol undefined (type [0]byte has no field or method
ai_protocol)
cgo_unix.go:53: hints.ai_family undefined (type [0]byte has no field or method ai_family)
cgo_unix.go:55: hints.ai_family undefined (type [0]byte has no field or method ai_family)
cgo_unix.go:63: r.ai_next undefined (type *[0]byte has no field or method ai_next)
cgo_unix.go:64: r.ai_family undefined (type *[0]byte has no field or method ai_family)
cgo_unix.go:68: r.ai_addr undefined (type *[0]byte has no field or method ai_addr)
cgo_unix.go:72: r.ai_addr undefined (type *[0]byte has no field or method ai_addr)
cgo_unix.go:72: too many errors

@rsc
Copy link
Contributor Author

rsc commented Aug 2, 2013

Comment 5:

This issue was closed by revision 2ddb672.

Status changed to Fixed.

@rsc rsc added fixed labels Aug 2, 2013
@rsc rsc added this to the Go1.2 milestone Apr 14, 2015
@rsc rsc removed the go1.2 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 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

4 participants