英文:
Cannot compile Go language on Mac OS X 10.6.7
问题
在按照Getting Started - The Go Programming Language上的指示操作时,我获取了代码并尝试运行all.bash
脚本。
但是在很多其他成功的输出之后,我得到了以下错误信息:
INSTALL FAIL net
CGOPKGPATH= cgo -- cgo_bsd.go cgo_unix.go
touch _obj/_cgo_run
6g -o _go_.6 dial.go dnsmsg.go fd_darwin.go hosts.go ip.go ipsock.go iprawsock.go lookup.go net.go parse.go pipe.go sock.go tcpsock.go udpsock.go unixsock.go newpollserver.go fd.go file.go dnsconfig.go dnsclient.go port.go _obj/cgo_bsd.cgo1.go _obj/cgo_unix.cgo1.go _obj/_cgo_gotypes.go
6c -FVw -I/Users/matryer/Work/go/pkg/darwin_amd64 -I . -o "_cgo_defun.6" _obj/_cgo_defun.c
gcc -m64 -I . -g -fPIC -O2 -o _cgo_main.o -c _obj/_cgo_main.c
gcc -m64 -I . -g -fPIC -O2 -o cgo_bsd.cgo2.o -c _obj/cgo_bsd.cgo2.c
gcc -m64 -I . -g -fPIC -O2 -o cgo_unix.cgo2.o -c _obj/cgo_unix.cgo2.c
gcc -m64 -I . -g -fPIC -O2 -o _cgo_export.o -c _obj/_cgo_export.c
gcc -m64 -g -fPIC -O2 -o _cgo1_.o _cgo_main.o cgo_bsd.cgo2.o cgo_unix.cgo2.o _cgo_export.o
cgo -dynimport _cgo1_.o >_obj/_cgo_import.c_ && mv -f _obj/_cgo_import.c_ _obj/_cgo_import.c
6c -FVw -I . -o "_cgo_import.6" _obj/_cgo_import.c
cgo_bsd.go:5[_obj/cgo_bsd.cgo1.go:8]: undefined: _Cconst_AI_MASK
cgo_unix.go:69[_obj/cgo_unix.cgo1.go:72]: undefined: _Cconst_AI_ALL
cgo_unix.go:69[_obj/cgo_unix.cgo1.go:72]: undefined: _Cconst_AI_V4MAPPED
cgo_unix.go:69[_obj/cgo_unix.cgo1.go:72]: undefined: _Cconst_AI_CANONNAME
make[1]: *** [_go_.6] Error 1
make: *** [net.install] Error 1
有其他人遇到过这个问题并解决了吗?
我正在运行Snow Leopard(10.6.7)版本10J869
。
英文:
When following instructions on Getting Started - The Go Programming Language, I get the code and try to run the all.bash
script.
But I get this error after a lot of other successful looking output:
INSTALL FAIL net
CGOPKGPATH= cgo -- cgo_bsd.go cgo_unix.go
touch _obj/_cgo_run
6g -o _go_.6 dial.go dnsmsg.go fd_darwin.go hosts.go ip.go ipsock.go iprawsock.go lookup.go net.go parse.go pipe.go sock.go tcpsock.go udpsock.go unixsock.go newpollserver.go fd.go file.go dnsconfig.go dnsclient.go port.go _obj/cgo_bsd.cgo1.go _obj/cgo_unix.cgo1.go _obj/_cgo_gotypes.go
6c -FVw -I/Users/matryer/Work/go/pkg/darwin_amd64 -I . -o "_cgo_defun.6" _obj/_cgo_defun.c
gcc -m64 -I . -g -fPIC -O2 -o _cgo_main.o -c _obj/_cgo_main.c
gcc -m64 -I . -g -fPIC -O2 -o cgo_bsd.cgo2.o -c _obj/cgo_bsd.cgo2.c
gcc -m64 -I . -g -fPIC -O2 -o cgo_unix.cgo2.o -c _obj/cgo_unix.cgo2.c
gcc -m64 -I . -g -fPIC -O2 -o _cgo_export.o -c _obj/_cgo_export.c
gcc -m64 -g -fPIC -O2 -o _cgo1_.o _cgo_main.o cgo_bsd.cgo2.o cgo_unix.cgo2.o _cgo_export.o
cgo -dynimport _cgo1_.o >_obj/_cgo_import.c_ && mv -f _obj/_cgo_import.c_ _obj/_cgo_import.c
6c -FVw -I . -o "_cgo_import.6" _obj/_cgo_import.c
cgo_bsd.go:5[_obj/cgo_bsd.cgo1.go:8]: undefined: _Cconst_AI_MASK
cgo_unix.go:69[_obj/cgo_unix.cgo1.go:72]: undefined: _Cconst_AI_ALL
cgo_unix.go:69[_obj/cgo_unix.cgo1.go:72]: undefined: _Cconst_AI_V4MAPPED
cgo_unix.go:69[_obj/cgo_unix.cgo1.go:72]: undefined: _Cconst_AI_CANONNAME
make[1]: *** [_go_.6] Error 1
make: *** [net.install] Error 1
Has anybody else seen this and fixed it?
I am running Snow Leopard (10.6.7) build 10J869
.
答案1
得分: 2
这是一个开放的问题,与Xcode的新版本有关,适用于OS X 10.7和10.6.7。
问题1881:在OS X 10.7上出现cgo常量错误
注意:修订版本142f0bc0d6e7已经关闭了问题1881。要更新Go以包括此修订版本及之前的所有更改,请运行:
$ cd $GOROOT/src
$ hg pull
$ hg update 142f0bc0d6e7
$ ./all.bash
英文:
It's an open issue, relating to a new version of Xcode, for OS X 10.7 and 10.6.7.
Issue 1881: cgo const error on OS X 10.7
NOTE: Revision 142f0bc0d6e7 has been made to close issue 1881. To update Go for all changes up to and including this revision, run:
$ cd $GOROOT/src
$ hg pull
$ hg update 142f0bc0d6e7
$ ./all.bash
答案2
得分: 0
你没有明确指出你正在构建哪个版本的Go。请注意,Go是一个动态的项目,版本经常变化。
我刚刚在一个我之前成功编译Go的目录中运行了hg pull
和hg update
(在MacOS X 10.6.7上)。然后我运行了sh all.bash
,在构建或测试阶段没有遇到任何问题(尽管现在构建时间比Go首次发布时要长)。
FWIW,hg tags
给出了以下结果:
tip 8715:599657138e00
weekly.2011-06-09 8703:c81944152e97
weekly 8703:c81944152e97
weekly.2011-06-02 8623:3418f22c39eb
weekly.2011-05-22 8483:c98449d685d2
release.r57.1 8294:95d2ce135523
构建周期结束时显示:
--- cd ../test
0个已知错误;0个意外错误
所有测试通过
---
在 /Users/jleffler/go 中安装了适用于darwin/amd64的Go。
在 /Users/jleffler/bin 中安装了命令。
编译器是6g。
因此...
如果你改变Go的版本(可能是更近期的版本),那么它也有可能对你起作用。
另外,我在今天下午在另一台运行MacOS X 10.6.7的机器上重新构建了Go,tip版本略有不同,并且显然有2个已知错误。
--- cd ../test
2个已知错误;0个意外错误
所有测试通过
---
在 /Users/jleffler/External-Source-Repositories/hg/go 中安装了适用于darwin/amd64的Go。
在 /Users/jleffler/External-Source-Repositories/hg/go/bin 中安装了命令。
*** 你需要将 /Users/jleffler/External-Source-Repositories/hg/go/bin 添加到你的 $PATH 中。***
编译器是6g。
在OS X上,调试器必须安装setgrp procmod。
阅读并运行 ./sudo.bash 以安装调试器。
real 4m55.695s
user 2m52.436s
sys 1m10.222s
Osiris-9 JL: hg tags | sed 15q
tip 8716:164ef168486b
weekly.2011-06-09 8703:c81944152e97
weekly 8703:c81944152e97
weekly.2011-06-02 8623:3418f22c39eb
weekly.2011-05-22 8483:c98449d685d2
release.r57.1 8294:95d2ce135523
计时信息(构建和测试周期约为5分钟)来自于运行:
time all.bash
英文:
You don't indicate exactly which version of Go you are building. Note that it is a dynamic project where the versions change frequently.
I just ran hg pull
and hg update
in a directory where I've previously compiled Go successfully (on MacOS X 10.6.7). Then I ran sh all.bash
and I didn't see any issues during the build or test phases (though it takes longer to build now than it did when Go was first announced).
FWIW, hg tags
gives me:
tip 8715:599657138e00
weekly.2011-06-09 8703:c81944152e97
weekly 8703:c81944152e97
weekly.2011-06-02 8623:3418f22c39eb
weekly.2011-05-22 8483:c98449d685d2
release.r57.1 8294:95d2ce135523
And the end of the build cycle gives:
--- cd ../test
0 known bugs; 0 unexpected bugs
ALL TESTS PASSED
---
Installed Go for darwin/amd64 in /Users/jleffler/go.
Installed commands in /Users/jleffler/bin.
The compiler is 6g.
<hr>
Therefore...
There is a chance that if you change the version of Go (possibly to a more recent one), then it will work for you, too.
<hr>
And, another FWIW or FYI, I redid the build on a different machine also running MacOS X 10.6.7 this afternoon, and the tip version is slightly different, and there are apparently 2 known bugs.
--- cd ../test
2 known bugs; 0 unexpected bugs
ALL TESTS PASSED
---
Installed Go for darwin/amd64 in /Users/jleffler/External-Source-Repositories/hg/go.
Installed commands in /Users/jleffler/External-Source-Repositories/hg/go/bin.
*** You need to add /Users/jleffler/External-Source-Repositories/hg/go/bin to your $PATH. ***
The compiler is 6g.
On OS X the debuggers must be installed setgrp procmod.
Read and run ./sudo.bash to install the debuggers.
real 4m55.695s
user 2m52.436s
sys 1m10.222s
Osiris-9 JL: hg tags | sed 15q
tip 8716:164ef168486b
weekly.2011-06-09 8703:c81944152e97
weekly 8703:c81944152e97
weekly.2011-06-02 8623:3418f22c39eb
weekly.2011-05-22 8483:c98449d685d2
release.r57.1 8294:95d2ce135523
The timing information (just under 5 minutes for the build and test cycle) is from running:
time all.bash
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论