ARMv5 Cross compile error

Hi,

I am trying to compile the latest stable Syncthing release on an x64 Linux host (Ubuntu 16.04 LTS). I installed Go 1.9 from source.

I got this when I executed the build command:

$ GOARM=5 GOOS=linux GOARCH=arm go run ./build.go
qemu: unhandled CPU exception 0x10004 - aborting
R00=00000000 R01=0000001e R02=00000000 R03=00262c28
R04=00000001 R05=00000004 R06=10500194 R07=0019885c
R08=00262ec0 R09=10516220 R10=00262cc0 R11=00273660
R12=00000000 R13=f6ffecd8 R14=0001e388 R15=000694d0
PSR=20000010 --C- A usr32
signal: aborted (core dumped)

What Can I do?

Thanks.

I think arm5 support was dropped in go itself.

Thanks for your quick reply.

Yes, that’s true. But with cross compiling, we Can compile go files for ARMv5.

Actually it seems it’s supported:

I think you are doing it wrong, as you are telling go to run the build script on ARM (which you are not running), not to compile syncthing to arm. You should do: GOARM=5 go run build.go -goos linux -goarch arm, or perhaps even modify build.go to support GOARM.

1 Like

Thanks.

I had to modify the build.go a bit, because “when cross compiling, the GOBIN variable shouldn’t be set”.

After that, I get exactly the same error :frowning: :

github.com/syncthing/syncthing/cmd/syncthing
qemu: unhandled CPU exception 0x10004 - aborting
R00=00000000 R01=0000001e R02=00000000 R03=001d7788
R04=00000001 R05=001c2a40 R06=00130f88 R07=1053de20
R08=001c2a40 R09=00000000 R10=10500460 R11=001e25f4
R12=00000000 R13=1053ddb0 R14=0001da28 R15=0006cadc
PSR=20000010 --C- A usr32
FAIL	github.com/syncthing/syncthing/meta	1.071s
exit status 1
exit status 1

This is the thing, no modifications should be necessary.

BTW how are you building the official ARM binaries? Like this.

Because this build works for me, and the only reason that I am trying to compile Syncthing by myself, because my NAS has a NAND chip where it stores its firmware and the complete FHS comes from a mounted .img file. So the whole system is read only. But there is a symlink from my hard drive to /ffp where I have a complete FHS with r/w permissions and a lot of self compiled things. And I want to adapt the pathes in the Syncthing source and build a package from that. This is the goal so far. :slight_smile:

I think we’re building the same way as the build script, yet since the build server moved, I don’t have credentials to verify that.

We do it the same way.

@AudriusButkevicius you could create an account. :wink:

And you don’t get a GOBIN is set error while cross compiling? Or a qemu error like mine?

Sorry, looking closer you are missing the “build” sub command. Do this:

GOARM=5 go run build.go -goos linux -goarch arm build

The default is “install” which doesn’t do for cross compiles. See also:

https://docs.syncthing.net/dev/building.html

1 Like

Jippie. I Can’t believe it. :smiley::

syncthing: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, not stripped

Thanks a lot.

PS: @calmh there is a mistype in your command. It should be GOARM and not GOARCH. Just mention, for the further ARM packagers.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.