-
Notifications
You must be signed in to change notification settings - Fork 17.6k
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
plugin: -buildmode=plugin not supported on linux/mips #21222
Comments
I suppose we could document this limitation in the meantime, if this is known. I believe it is. |
Does the feature also ARCH dependent and not just OS dependent? |
@juliandroid, it needs cgo. But that happened in https://go-review.googlesource.com/34318 already. Ah, I bet you're not getting cgo support (and thus no plugin support) because you're cross-compiling. Is your host machine actually amd64? |
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:
main.go:
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: src/cmd/go/build.go
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. |
The worst thing here is that even -buildmode=shared doesn't work, so I cannot provide go libraries to C programs. |
@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? Thanks! |
Hi @juliandroid, indeed, these three modes aren't supported for mips. |
Thanks Vladimir! Good to know those are on the todo list! |
@vstefanovic I'm curious about plugin support and shared mode, are there any good news? :) |
Hi Julian, |
@vstefanovic I'm also curious about plugin support for mips, are there any good news now? thanks a lot~ |
@vstefanovic is there a milestone for |
Seems it was not integrated in 1.12 (go1.12.5), is it still work in progress ? |
@bradfitz @MIPSbkirby @ianlancetaylor any update? |
No updates I've seen. Plus they'd almost certainly be mentioned here if there were any. |
@bradfitz BTW, |
I'm not the domain expert here but I also don't see any update from the last time where it was declared that it didn't work. Try it and confirm, though. |
@daixiang0 @bradfitz I've just rebased changes for |
@milanknezevic happy to hear it! |
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[1]. [1]: golang/go#21222 (comment) Signed-off-by: Jeffery To <jeffery.to@gmail.com>
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[1]. [1]: golang/go#21222 (comment) Signed-off-by: Jeffery To <jeffery.to@gmail.com>
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
Are there technical challenges that is preventing this feature to be implemented in mips? |
According to https://golang.org/pkg/plugin/ plugins under Linux should be supported.
What version of Go are you using (
go version
)?go version go1.8.3 linux/amd64
go version devel +ac29f30dbb Fri Jul 28 00:29:08 2017 +0000 linux/amd64
What did you do?
GOOS=linux GOARCH=mips ./go build -a -buildmode=plugin main.go
What did you expect to see?
Successfully building mips(32) plugin
What did you see instead?
"-buildmode=plugin not supported on linux/mips"
The text was updated successfully, but these errors were encountered: