无法在 Mac OS X 10.6.7 上编译 Go 语言

发布于 2024-11-14 17:21:03 字数 1602 浏览 2 评论 0原文

当按照 入门 - Go 编程语言 上的说明进行操作时,我获取了代码并尝试运行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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

画中仙 2024-11-21 17:21:04

您没有明确指出您正在构建哪个版本的 Go。请注意,这是一个动态项目,版本经常更改。

我刚刚在之前成功编译 Go 的目录中运行了 hg pullhg 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 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.

因此...

如果你更改 Go 的版本(可能是更新的版本),那么它有可能也会为你工作。


而且,另一个 FWIW 或仅供参考,今天下午我在另一台同样运行 MacOS X 10.6.7 的机器上重新构建了版本,提示版本略有不同,并且显然有 2 个已知错误。

--- 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

计时信息(构建和测试周期不到 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.

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.


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
冷情妓 2024-11-21 17:21:03

这是一个悬而未决的问题,与 OS X 10.7 和 10.6.7 的新版本 Xcode 相关。

问题 1881:OS X 10.7 上的 cgo const 错误

注意:< a href="http://code.google.com/p/go/source/detail?r=142f0bc0d6e7" rel="nofollow">修订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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文