-
Notifications
You must be signed in to change notification settings - Fork 70
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
Add Cgo support for NetBSD #268
base: main
Are you sure you want to change the base?
Add Cgo support for NetBSD #268
Conversation
@@ -54,7 +54,7 @@ func buildSharedLib(compilerEnv, libFile string, sources ...string) error { | |||
} | |||
|
|||
var args []string | |||
if runtime.GOOS == "freebsd" { | |||
if runtime.GOOS == "freebsd" || runtime.GOOS == "netbsd" { | |||
args = []string{"-shared", "-Wall", "-Werror", "-fPIC", "-o", libFile} | |||
} else { | |||
args = []string{"-shared", "-Wall", "-Werror", "-o", libFile} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just out of curiosity, can't we use -fPIC for other platforms than FreeBSD and NetBSD?
echo "=> go test race" | ||
go test -race -shuffle=on -v -count=10 ./... | ||
fi | ||
netbsd: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add to build tests for NetBSD in other platforms (e.g. Can we build a NetBSD binary in FreeBSD?)
# Check cross-compiling NetBSD binaries.
env GOOS=netbsd GOARCH=amd64 go build -v ./...
env GOOS=netbsd GOARCH=arm64 go build -v ./...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if it's possible. We'd need to explicitly enable cgo since it's a cross compile. I'll try once the build in NetBSD is working
The example still has the dependency on golang.org/x/sys. Updates ebitengine#270
@0-wiz-0 I'm trying to finish up this PR so it can be merged but I can't figure out how to install go in the NetBSD environment. Could you look at the |
Thank you for working on this, @TotallyGamerJet !
(Btw, cross-compilation to NetBSD should also work as usual in go.) |
Thanks for the help. I'm getting some weird error when opening the archive. Thoughts?
This PR currently only supports Cgo. Once I get it in a usable state I can work on getting the entirely go version working which would enable cross compiling |
I see:
you can ignore this, it's a bogus warning that will be fixed in 10.1.
Seems we need to add
before the tar command. |
Not sure what exactly I did to fix it but it's workin now! :D |
What issue is this addressing?
Updates #249
What type of issue is this addressing?
feature
What this PR does | solves
Allows compiling with purego on NetBSD when there is a C compiler