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

Unable to build for freebsd arm v7 #627

Closed
efficks opened this issue Jan 10, 2019 · 7 comments
Closed

Unable to build for freebsd arm v7 #627

efficks opened this issue Jan 10, 2019 · 7 comments

Comments

@efficks
Copy link

efficks commented Jan 10, 2019

Describe the bug
When building for freebsd arm7 cpu, I got compilation errors

# github.com/influxdata/telegraf/vendor/github.com/shirou/gopsutil/disk
vendor/github.com/shirou/gopsutil/disk/disk_freebsd.go:154:9: undefined: Bintime
# github.com/influxdata/telegraf/vendor/github.com/shirou/gopsutil/cpu
vendor/github.com/shirou/gopsutil/cpu/cpu_freebsd.go:25:16: undefined: cpuTimes
vendor/github.com/shirou/gopsutil/cpu/cpu_freebsd.go:42:31: undefined: cpuTimes
vendor/github.com/shirou/gopsutil/cpu/cpu_freebsd.go:66:38: undefined: cpuTimes
vendor/github.com/shirou/gopsutil/cpu/cpu_freebsd.go:72:15: undefined: cpuTimes
vendor/github.com/shirou/gopsutil/cpu/cpu_freebsd.go:87:13: undefined: cpuTimes

To Reproduce
env GOOS=freebsd GOARCH=arm GOARM=7 go

Expected behavior
Compilation success

Environment (please complete the following information):
I'm cross compiling on a linux 64 bit for freebsd arm v7.

Additional context
go env

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/fxchoiniere/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/fxchoiniere/go"
GORACE=""
GOROOT="/usr/lib/go-1.10"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.10/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build088163185=/tmp/go-build -gno-record-gcc-switches"
@Lomanic
Copy link
Collaborator

Lomanic commented Jan 10, 2019

Copying the i386 definition to arm successfully compiles (cp cpu/cpu_freebsd_386.go cpu/cpu_freebsd_arm.go), tested with GOOS=freebsd GOARCH=arm go build github.com/shirou/gopsutil/cpu. Can you test that the telegraph binary you will get doesn't crash at runtime on a FreeBSD ARM host? It should still work as both architectures are 32 bit but just to be sure.

@efficks
Copy link
Author

efficks commented Jan 13, 2019

@Lomanic It works like a charm. I also copied the disk_freebsk_386 to arm.
Thank you

@danielnelson
Copy link
Contributor

It would be nice to have support for all the potential FreeBSD platforms, I believe this would be:

GOARM=5 GOARCH=arm GOOS=freebsd
GOARM=6 GOARCH=arm GOOS=freebsd
GOARM=7 GOARCH=arm GOOS=freebsd
GOARM=7 GOARCH=arm64 GOOS=freebsd

@Lomanic
Copy link
Collaborator

Lomanic commented Jan 15, 2019

https://github.com/golang/go/wiki/GoArm#supported-operating-systems

ARM on FreeBSD, OpenBSD, and NetBSD: ARMv6K or above is required.

I still have the plan, for months now, to install FreeBSD on a Rapsberry Pi Model B 512 MB (armv6) to properly fix #543 (and this issue now too). I just did not manage to get around it in my limited free time. Keep in mind that an armv7 host is able to run an armv6 binary without problem (only lacking some optimizations). For arm64, there is this path on Scaleway or buying a Pine64 board.

@danielnelson
Copy link
Contributor

I'm guessing you are hoping to generate the cgo file there in case a simple copy is not completely correct? If so, I think @W0CHP mentioned an arm system with a working buildchain?

@shirou
Copy link
Owner

shirou commented Jan 17, 2019

I have created a PR to add AMR support files. But generate by using cgo on real system is better than just a copy. If you can run cgo on your system please make a comment on #632. Thank you!

@shirou
Copy link
Owner

shirou commented Feb 10, 2019

perhaps this is solved by #632. feel free to re-open this issue if something wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants