Bug 196623 - lang/go: Won't build on armv6 because of limitation in Makefile
Summary: lang/go: Won't build on armv6 because of limitation in Makefile
Status: Closed Overcome By Events
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Julien Laffaye
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-12 17:50 UTC by Erik Nordstrøm
Modified: 2015-11-28 14:49 UTC (History)
5 users (show)

See Also:


Attachments
unbreak on arm (644 bytes, patch)
2015-01-13 09:56 UTC, Mikael Urankar
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Erik Nordstrøm 2015-01-12 17:50:21 UTC
Hello,

I was trying to build go from ports on my Raspberry Pi running FreeBSD 10.1 and
at first, it told me "go-1.4,1 is only for i386 amd64, while you are running
armv6".

I made a forum post about it at
https://forums.freebsd.org/threads/go-1-4-1-is-only-for-i386-amd64-while-you-are-running-armv6.49901/

It turned out that with minor changes to the Makefile, go was able to build,
install and run on my armv6 computer.

Here is my change of the Makefile:

27c27
< ONLY_FOR_ARCHS=   i386 amd64
---
> ONLY_FOR_ARCHS=   armv6
31,38c31,32
< .if ${ARCH} == "i386"
< GOARCH=386
< GOOBJ=8
< PLIST_SUB+=   I386_ONLY=""
< PLIST_SUB+=   AMD64_ONLY="@comment "
< .else
< GOARCH=amd64
< GOOBJ=6
---
> GOARCH=arm
> GOOBJ=5
40,41c34
< PLIST_SUB+=   AMD64_ONLY=""
< .endif
---
> PLIST_SUB+=   AMD64_ONLY="@comment "

As you can see, I removed i386 and amd64, which is obviously not what I want
you to do in the actual ports, but I was hoping that you could make similar
changes to what I did.

This is my first time reporting something to FreeBSD so my appologies if I've
done anything wrong.
Comment 1 Gavin Atkinson freebsd_committer freebsd_triage 2015-01-12 18:49:02 UTC
Hi,

Due to an issue with the backend FreeBSD Bugzilla database, your original PR and any updates to it since have been lost.  I've recreated the original PR as best as I can, however any attachments and updates you submitted to the PR have been lost.  Please could you resubmit them?

Thanks, and apologies.
Comment 2 Mikael Urankar freebsd_committer freebsd_triage 2015-01-13 09:56:16 UTC
Created attachment 151537 [details]
unbreak on arm

Hi,

I confirm that lang/go works fine on armv6.

It doesn't build with poudriere though:
# Building packages and commands for freebsd/arm.
runtime
go build runtime: /wrkdirs/usr/ports/lang/go/work/go/pkg/tool/freebsd_arm/5g: wait: interrupted system call

Julien, any reasons to keep I386_ONLY / AMD64_ONLY as it is not used in pkg-plist?
Comment 3 Vanilla I. Shu freebsd_committer freebsd_triage 2015-03-05 02:38:29 UTC
Assign to maintainer
Comment 4 Peter Jeremy freebsd_committer freebsd_triage 2015-03-16 10:14:13 UTC
I am unable to get lang/go to compile on my RPi running -current/arm6hf r279807:

...
# Building packages and commands for freebsd/arm.
...
crypto/x509/pkix
encoding/hex
encoding/pem
runtime/cgo
net
# net
net/cgo_bsd.go:15:25: type C.int: undefined C type 'int'
net/cgo_bsd.go:16:10: unable to find value of constant C.AI_CANONNAME
net/cgo_bsd.go:16:27: unable to find value of constant C.AI_V4MAPPED
net/cgo_bsd.go:16:43: unable to find value of constant C.AI_ALL
net/cgo_bsd.go:16:55: unable to find value of constant C.AI_MASK
mime
net/http/internal
...
os/user
# os/user
os/user/lookup_unix.go:49:10: type C.struct_passwd: undefined C type 'struct passwd'
os/user/lookup_unix.go:50:14: type C.struct_passwd: undefined C type 'struct passwd'
os/user/lookup_unix.go:52:14: type C.long: undefined C type 'long'
os/user/lookup_unix.go:59:13: call of non-function C.sysconf
os/user/lookup_unix.go:64:9: call of non-function C.malloc
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x0 addr=0x0 pc=0x1d9ec]

goroutine 1 [running]:
main.(*Package).rewriteRef(0x303c25b0, 0x303900c0)
        /usr/local/go/src/cmd/cgo/gcc.go:610 +0xee4
main.(*Package).Translate(0x303c25b0, 0x303900c0)
        /usr/local/go/src/cmd/cgo/gcc.go:184 +0x188
main.main()
        /usr/local/go/src/cmd/cgo/main.go:231 +0xf54
runtime/debug
runtime/race
testing
testing/iotest
testing/quick
text/scanner
*** Error code 2
Comment 5 Mikael Urankar freebsd_committer freebsd_triage 2015-03-16 13:22:57 UTC
(In reply to Peter Jeremy from comment #4)
Compilation on ARM seems broken with clang-3.5 but it works fine with gcc-4.8.
There is a PR about this issue on github but no fix yet:
https://github.com/golang/go/issues/8980
Comment 6 Michael Moll freebsd_committer freebsd_triage 2015-11-28 14:49:33 UTC
lang/go14 is OK since some time. lang/go (1.5) has other problems, tracked in #204883