Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
plugin: -buildmode=plugin not supported on linux/mips #21222
According to https://golang.org/pkg/plugin/ plugins under Linux should be supported.
What version of Go are you using (
My machine is amd64 while I want to build mips binaries with plugin support.
After git cloning golang, I've built it with:
I've noticed in the documentation that "C compiler such as gcc or clang must be installed first", but I guess that refers to cross-compiled GCC not about my "normal" gcc for amd64 (which I have installed in front).
Now I'm building openwrt 15.05 which should supply me with GCC 4.7.3 built to generate mips binaries, which I hope will be useful for the purpose of building go with CGO support. However I couldn't find any ENV variables and instructions how to pass that cross-compiler in order for the "all.bash" to use it.
Please let me know if I'm getting this right!?
Edit: Looking at the code, your point is that there is no internal linking for mips yet, so I need CGO with external linking to have support for plugins?
Edit 2: am I supposed to use CC when I run "go build" and not at the golang compiling phase, like this:
CC=mips-linux-musl-gcc GOOS=linux GOARCH=mips CGO_ENABLED=1 go build -a -o myprogram -ldflags="-extld=$CC"
I'm pretty sure you need CC_FOR_TARGET. Three examples are in the Dockerfiles under:
@bradfitz I've spent some time testing and debugging:
Within Openwrt, I'm building Golang compiler with something like this (command line slightly redacted):
Building a simple program on my amd64 with embedded C builds and runs (later on mips device) fine:
However building a simple plugin (from https://golang.org/pkg/plugin/ does not):
I've tried also with buildmode shared, c-shared, but I'm getting a similar error:
I've tried to patch the source by removing the check for MIPS with the hope that this will work:
Trying to rebuild Golang compiler and my test app I ended up with another error:
Next, I've tried to patch src/cmd/compile/internal/gc/main.go like this:
But then I get the next error:
So, I gave up at this stage. I guess there is something more missing.
@vstefanovic are you aware of those limitations of the mips port?
Currently I can build golang app (with embedding C too) statically or dynamically, but no -buildmode like shared, c-shared or plugin works for GOOS=linux. Are there any known issues that prevent those on mips?
This adds support to compile host and target Go as position-independent executables. Host Go will have PIE enabled if Go supports PIE on the host platform. Target Go will have PIE enabled if Go supports PIE on the target platform and CONFIG_PKG_ASLR_PIE is selected. Go 1.13 supports PIE for x86 and arm targets; mips support is in progress. : golang/go#21222 (comment) Signed-off-by: Jeffery To <firstname.lastname@example.org>
This adds support to compile position-independent executables for packages that use golang-package.mk. Go packages will have PIE enabled if: * Go supports PIE on the target platform; * CONFIG_PKG_ASLR_PIE is selected; and * PKG_ASLR_PIE (for the package) is not set to 0 Go 1.13 supports PIE for x86 and arm targets; mips support is in progress. : golang/go#21222 (comment) Signed-off-by: Jeffery To <email@example.com>