Skip to content
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

i386 image faild #16

Closed
boy-hack opened this issue Sep 2, 2021 · 4 comments
Closed

i386 image faild #16

boy-hack opened this issue Sep 2, 2021 · 4 comments

Comments

@boy-hack
Copy link

boy-hack commented Sep 2, 2021

I am running under mac, but I get an error when I execute go version

docker run --rm -it --platform linux/386 x1unix/go-mingw-i386 /bin/sh
/go # go version
fatal error: mallocgc called without a P or outside bootstrapping

runtime stack:
runtime.throw({0x85865b4, 0x34})
	/usr/local/go/src/runtime/panic.go:1198 +0x6a
runtime.mallocgc(0x10, 0x84ea040, 0x1)
	/usr/local/go/src/runtime/malloc.go:977 +0x79d
runtime.growslice(0x84ea040, {0x8c0e008, 0x2, 0x2}, 0x3)
	/usr/local/go/src/runtime/slice.go:267 +0x413
runtime.allgadd(0x8c00780)
	/usr/local/go/src/runtime/proc.go:554 +0x7d
runtime.newproc1(0x85b1730, 0x8c2c684, 0x0, 0x8c001e0, 0x807f75b)
	/usr/local/go/src/runtime/proc.go:4307 +0xae
runtime.newproc.func1()
	/usr/local/go/src/runtime/proc.go:4255 +0x3e
runtime.systemstack()
	/usr/local/go/src/runtime/asm_386.s:376 +0x41

goroutine 1 [running, locked to thread]:
	goroutine running on other thread; stack unavailable
/go #
@boy-hack
Copy link
Author

boy-hack commented Sep 2, 2021

It seems that this image can only be used under 32-bit. If I want to use 32-bit compilation under x64, what should I do?

@x1unix
Copy link
Owner

x1unix commented Sep 2, 2021

@boy-hack that image can be used under 64-bit (I built it on 64-bit machine). This image is based on docker's official golang image for i386 architecture - https://hub.docker.com/r/i386/golang.

i386 instruction set is well supported by Intel chips and 32-bit binaries can be run on x86_64.

What king of mac are you using? (macOS version and model)
Can you try to run it?

docker run --rm -it --platform linux/386 i386/golang sh

I tried to run this on MacBook Pro mid 2015 with macOS Big Sur and unable to reproduce your issue:

image

@x1unix
Copy link
Owner

x1unix commented Sep 2, 2021

@boy-hack I changed approach a bit. Now it's a single image as it was before but based on Debian Bullseye which provides Mingw toolchain for both amd64 and i386.

Use GOARCH=386 variable to build a binary for 32-bit. Also, please re-pull x1unix/go-mingw image.

docker run --rm -it -e GOARCH=386 -v /YourPackageSrc:/go/work \
    -w /go/work \
    x1unix/go-mingw go build .

@boy-hack
Copy link
Author

boy-hack commented Sep 3, 2021

Thank you, the new version solves my problem very well

@boy-hack boy-hack closed this as completed Sep 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants