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

Cross compilation ignores arch and bits options #24008

Closed
BeayemX opened this issue Nov 27, 2018 · 4 comments
Closed

Cross compilation ignores arch and bits options #24008

BeayemX opened this issue Nov 27, 2018 · 4 comments

Comments

@BeayemX
Copy link
Contributor

BeayemX commented Nov 27, 2018

Godot version:

c23710a

OS/device including version:

Linux Mint 19 - 64 Bit

Issue description:

When trying to cross-compile for Raspberry Pi with the command

scons p=server target=release tools=no arch=arm bits=32

the resulting binary shows x86-64 and 64 bit

$ file bin/godot_server.x11.opt.arm 

bin/godot_server.x11.opt.arm: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=1e49465a67d791c668be1e1007fbb36d319c13c0, not stripped

Edit:

$ gcc --version
gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
@bruvzg
Copy link
Member

bruvzg commented Nov 27, 2018

Out of box Linux cross-compiling does not work at all.

arch option is used only for iOS.
android-arch option is used for Android.
bits is useful only for MinGW, there's some half broken 64/32 x86 Linux cross-compiling code, but it uses hardcoded paths and won't work on half of Linux distros.

You can try to manually set up environment variables for cross compiling, something like (all paths and names may differ):

scons p=server target=release tools=no CXXFLAGS='-D__ARM_ARCH_7__ -D__ARM_ARCH_7A__ -march=armv7-a -mfpu=neon -mfloat-abi=hard' CC='arm-linux-gnueabihf-gcc' CXX='arm-linux-gnueabihf-g++' CPP='arm-linux-gnueabihf-g++' LINKFLAGS='-L/usr/arm-linux-gnueabihf/lib -L/usr/lib/arm-linux-gnueabihf'

This may work for server, but probably won't work for tools/export template (some libs have broken platform detection logic, see #23575 PR).

Native ARM compiling (on real ARM device or inside qemu/chroot) should work without major problems (CXXFLAGS are still necessary for correct optimizations).

@BeayemX
Copy link
Contributor Author

BeayemX commented Nov 27, 2018

Thanks for the insight.

Will easier cross compilation be implemented / supported in the future?

btw, yes, building on the raspberry itself is working, it is just really slow (about 4 hours)

@KoBeWi
Copy link
Member

KoBeWi commented Dec 8, 2020

Can anyone still reproduce this bug in Godot 3.2.3 or any later release?

@aaronfranke
Copy link
Member

aaronfranke commented Feb 20, 2023

This should be fixed as of the proper architecture handling added in #55778. Or it might also need #64366, not sure. If you are still experiencing this issue, feel free to comment, but there has been no activity for years so I am assuming it's fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants