Skip to content

unable to compile: _cgo_import.c: throw: out of memory (FixAlloc) #1669

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

Closed
gopherbot opened this issue Apr 6, 2011 · 5 comments
Closed

unable to compile: _cgo_import.c: throw: out of memory (FixAlloc) #1669

gopherbot opened this issue Apr 6, 2011 · 5 comments

Comments

@gopherbot
Copy link
Contributor

by powerman.asdf:

What steps will reproduce the problem?
1. Just follow installation instruction and run ./all.bash (also tried with hg pull -u)

What is the expected output?
Go should finish compiling/installing.

What do you see instead?
make hangs and should be interrupted with Ctrl-C

Which compiler are you using (5g, 6g, 8g, gccgo)?
8g

Which operating system are you using?
Hardened Gentoo Linux

Which revision are you using?  (hg identify)
1268b4436e07 tip

Please provide any additional information below.
…
8g -o _go_.8 download.go main.go make.go parse.go syslist.go 
cgo -dynimport _cgo1_.o >_obj/_cgo_import.c_ && mv -f _obj/_cgo_import.c_
_obj/_cgo_import.c
throw: out of memory (FixAlloc)

rm -f _obj/websocket.a
gopack grc _obj/websocket.a _go_.8 
8l -o goinstall _go_.8
cp _obj/websocket.a "/home/powerman/tmp/go/pkg/linux_386/websocket.a"
make[1]: Leaving directory `/home/powerman/tmp/go/src/pkg/websocket'
make -C rpc/jsonrpc install
make[1]: Entering directory `/home/powerman/tmp/go/src/pkg/rpc/jsonrpc'
8g -o _go_.8 client.go server.go 
rm -f _obj/rpc/jsonrpc.a
gopack grc _obj/rpc/jsonrpc.a _go_.8 
cp _obj/rpc/jsonrpc.a "/home/powerman/tmp/go/pkg/linux_386/rpc/jsonrpc.a"
make[1]: Leaving directory `/home/powerman/tmp/go/src/pkg/rpc/jsonrpc'
8l -o godoc _go_.8
cp -f goinstall /home/powerman/tmp/go/bin
make[1]: Leaving directory `/home/powerman/tmp/go/src/cmd/goinstall'
cp -f godoc /home/powerman/tmp/go/bin
make[1]: Leaving directory `/home/powerman/tmp/go/src/cmd/godoc'

^Cmake[1]: *** [_obj/_cgo_import.c] Interrupt
make: *** [runtime/cgo.install] Interrupt
@gopherbot
Copy link
Contributor Author

Comment 1 by powerman.asdf:

btw, I've 4GB RAM, 2.5GB free, so it's surely not because real 'out of memory' error

@gopherbot
Copy link
Contributor Author

Comment 2 by powerman.asdf:

I've just tried latest version (adc0a3c6cd41 tip). Now output looks different, but I
suppose everything under the cover is still same:
  …
  install websocket
  install ../cmd/godoc
  install rpc/jsonrpc
  ^Cmake: *** [runtime/cgo.install] Interrupt
I've also tried to switch to vanilla gcc-4.4.5 (without hardened patches), but that
doesn't help. I'll try to disable GrSecurity/PaX in kernel later to see is that helps.

@gopherbot
Copy link
Contributor Author

Comment 3 by powerman.asdf:

Yeah, switching off GrSecurity and PaX in kernel helps, both release and tip build ok.
I've read issue #47 and while I'm agree with
https://golang.org/issue/47?c=9 I think it's should be possible to
build and run Go on kernels with mprotect in same way as other similar software - like
browsers, flash, etc. - just use `paxctl -m` to mark Go binaries to disable mprotect.
This probably will require solving issues with ELF header and adding some paxctl into
build process on systems with available paxctl binary.

@gopherbot
Copy link
Contributor Author

Comment 4 by powerman.asdf:

Possible workarounds to build Go on Hardened Gentoo Linux:
1) disable CONFIG_PAX_MPROTECT
2) enable PaX softmode while building Go (untested, but should work)
3) use attached patch (there are different patches for current release c5c62aeb6267 and
tip ffa7af487196) to run chpax (paxctl doesn't compatible with generated ELF headers)
I've tried to minimize changes, and for release I got it to compile without wrapping 8l,
but I suppose for compiling and running user apps 8l wrapper will be needed anyway. And
I had to add it for tip patch because it compile test apps in misc/ and adding chpax to
each of them is just crazy.

Attachments:

  1. go-release-chpax.patch (623 bytes)
  2. go-tip-chpax.patch (828 bytes)

@adg
Copy link
Contributor

adg commented Apr 25, 2011

Comment 5:

Status changed to Duplicate.

Merged into issue #47.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants