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

Go 32-bit compilation fails when grumpc run on a 64-bit system #27

Open
alanjds opened this issue Aug 21, 2018 · 11 comments
Open

Go 32-bit compilation fails when grumpc run on a 64-bit system #27

alanjds opened this issue Aug 21, 2018 · 11 comments
Labels
imported Imported from google/grumpy

Comments

@alanjds
Copy link

alanjds commented Aug 21, 2018

google#165 opened by @luca76 on 19 Jan 2017

See this error:

  [grumpy] $ make

build/src/grumpy/lib/time_test/module.go:59: constant 3000000000 overflows int
Makefile:212: recipe for target 'build/pkg/linux_386/grumpy/lib/time_test.a' failed
make: *** [build/pkg/linux_386/grumpy/lib/time_test.a] Error 1

How can I fix it?

@alanjds
Copy link
Author

alanjds commented Aug 21, 2018

Comment by trotterdylan
Thursday Jan 19, 2017 at 14:36 GMT


That's weird. The compiler is emitting NewInt(3000000000) because the ast module produced a Python int here. So 3000000000 fits in an int in Python which suggests the architecture is 64-bit. But when the Go code is compiled, it's saying the number overflows int, so Go seems to be compiling for 32-bit.

Is your environment set up for some cross compilation or something like that?

@alanjds
Copy link
Author

alanjds commented Aug 21, 2018

Comment by luca76
Thursday Jan 19, 2017 at 14:41 GMT


Yes, I have Go in 32 bit mode and the OS is in 64.

@alanjds
Copy link
Author

alanjds commented Aug 21, 2018

Comment by trotterdylan
Thursday Jan 19, 2017 at 15:05 GMT


I see. We don't support cross compilation of that kind currently. The basic technical problem is that the Python code generator assumes that a Python int on the host platform can be stored as a native int on the target platform. We would have to add some awareness to the grumpc compiler to support this use case.

@alanjds
Copy link
Author

alanjds commented Aug 21, 2018

Comment by luca76
Thursday Jan 19, 2017 at 15:08 GMT


Thank you in advance. Now I can close this bug report.

@alanjds
Copy link
Author

alanjds commented Aug 21, 2018

Comment by trotterdylan
Thursday Jan 19, 2017 at 15:27 GMT


I think it's okay to leave this open. I'm sure it will come up again and supporting cross compilation seamlessly would be nice.

@alanjds
Copy link
Author

alanjds commented Aug 21, 2018

Comment by xyproto
Thursday Sep 07, 2017 at 09:59 GMT


When building the latest master commit of Grumpy (2c8ff4b) for 32-bit Arch Linux (in a chroot, but on a 64-bit host system), I get the following error messages when running make:

 make: Entering directory '/build/grumpy/src/grumpy'
# __python__/__go__/syscall
build/src/__python__/__go__/syscall/module.go:943:54: constant 2147483648 overflows int
build/src/__python__/__go__/syscall/module.go:3215:54: constant 4278190080 overflows int
build/src/__python__/__go__/syscall/module.go:3235:54: constant 4294901760 overflows int
build/src/__python__/__go__/syscall/module.go:3250:54: constant 4294967040 overflows int
build/src/__python__/__go__/syscall/module.go:3355:54: constant 2147483648 overflows int
build/src/__python__/__go__/syscall/module.go:4170:54: constant 2309737967 overflows int
build/src/__python__/__go__/syscall/module.go:4175:54: constant 3454992675 overflows int
build/src/__python__/__go__/syscall/module.go:4195:54: constant 2712847316 overflows int
build/src/__python__/__go__/syscall/module.go:4200:54: constant 3489725666 overflows int
build/src/__python__/__go__/syscall/module.go:4205:54: constant 4276215469 overflows int
build/src/__python__/__go__/syscall/module.go:4205:54: too many errors
make: *** [Makefile:260: build/pkg/linux_386/__python__/__go__/syscall.a] Error 2
make: *** Waiting for unfinished jobs....
# __python__/__go__/math
build/src/__python__/__go__/math/module.go:263:54: constant 9223372036854775807 overflows int
build/src/__python__/__go__/math/module.go:278:54: constant 4294967295 overflows int
build/src/__python__/__go__/math/module.go:308:54: constant -9223372036854775808 overflows int
make: *** [Makefile:259: build/pkg/linux_386/__python__/__go__/math.a] Error 2
make: Leaving directory '/build/grumpy/src/grumpy'

This is with Python 2.7.13 and Go 1.9.

@alanjds alanjds added the imported Imported from google/grumpy label Aug 21, 2018
@alanjds
Copy link
Author

alanjds commented Aug 24, 2018

@xyproto: I may had fixed that after google#399 got merged here. Can you please try the v0.3.0 version on this repo?

@deep-42-thought
Copy link

@alanjds: xyproto is no longer maintaining the package for archlinux on 32-bit - we from archlinux32 are doing this now.
What commit/tag/repository should I try to compile? (I couldn't find a v0.3.0 tag or release, but I'm also not sure into what repository to look).

@alanjds
Copy link
Author

alanjds commented Sep 5, 2018

Sorry for that. I forgot to upload the tags after forking from Google.

You can try the master. Tests are green here and my Android is compiling nicely on Go 1.10 . Had not tested with 1.11 yet.

You can pip install grumpy-runtime too: https://pypi.org/project/grumpy-runtime/

Thanks for testing.

@xyproto
Copy link

xyproto commented Sep 5, 2018

Yes, Arch Linux now only officially supports 64-bit x86.

@deep-42-thought
Copy link

@alanjds: I'm still not sure where I find that repo of yours, but I can confirm, that grumpy builds when I apply the two patches in google#399

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
imported Imported from google/grumpy
Projects
None yet
Development

No branches or pull requests

3 participants