I started to write a package definition for buildroot:
However, the compilation fails with:
can't load package: package github.com/syncthing/syncthing: build constraints exclude all Go files in /[...]/build/syncthing-1.13.1/_gopath/src/github.com/syncthing/syncthing
However, activating CGO as mentioned in the buildroot documentation does not solve my problem.
Until now, nobody could help me at the buildroot mailing list.
Therefore, any hints how I could track down the issue would be highly appreciated, as I never used GOLANG before.
I don’t know, but the error mentions gopath which is a build method we haven’t used in a couple of years. I’d suggest you get it building locally first using our build instructions, to make sure you understand how it works, and then try to accomplish the same thing in buildroot, whatever that is.
I haven’t looked at your packaging, but that error usually happens in you just try to do go build . or go build github.com/syncthing/syncthing, which are wrong.
Ah, thanks.
Is it possible to instruct build.go to just create the host build script and thereafter I manually trigger the host build script to build the target binary? With this I can use different environments as mentioned here.
As I don’t want to just find a solution for myself but provide the results also to mainstream.
No idea what “mainstream” is and what its requirements are, and without that information one cannot answer that. There’s two general approaches: Do it our way, i.e. use build.go how it’s supposed to be used, or redo whatever build.go does in whatever build-system your “mainstream” uses. Basically build.go is our “makefile”.
Sorry, I made a mistake: I wanted to say “upstream” and I meant that I want to create a Syncthing package for Buildroot which is integrated into their official repository.
I got Syncthing compiled using build.go by hand and I do not put this approach into question. I want to integrate it into the Buildroot-Toolchain. As far as I understood I have two different environments in Buildroot: one host and one target environment and thus I want to execute build.go in two stages. Something like this:
$(GO_HOST_ENV) $(GO_BIN) run build.go build --stop-after-creating-build-script
$(GO_TARGET_ENV) newbuildscript -arch arm --continue
Not necessarily. If you can figure it out together with whoever works with Go in Buildroot then that’s great of course. However I hope I didn’t give the impression that I don’t want any packaging questions here. I’d just like to have an overview of the relevant information here in the forum (what’s the problem/requirement, …), and not having to search for them in linked email threads. So if needed, now or in the future, feel free to explain what the problem is with modules and maybe we can help