Page 1 of 1

[CMake] Cannot cross-compile for aarch64 architecture

Posted: Mon Jul 17, 2017 11:37 am
by NeverMine17
So after TONS of tries of fixing the error myself, i gave up.
CMake seems to be angry at variable called: `IMPORT_EXECUTABLES`.

Log is at https://pastebin.com/hCeXzvZp .

Version of GZDoom: g3.1.0

I'm very new at CMake so any help will be appreciated.

Re: [CMake] Cannot cross-compile for aarch64 architecture

Posted: Mon Jul 17, 2017 12:18 pm
by Rachael
This is not a bug.

Re: [CMake] Cannot cross-compile for aarch64 architecture

Posted: Mon Jul 17, 2017 1:15 pm
by NeverMine17
Sorry for posting in the wrong place.
So, do you have any comments on this?

Re: [CMake] Cannot cross-compile for aarch64 architecture

Posted: Sat Aug 25, 2018 7:48 pm
by derkternerks
Bumping this because I have the same problem. Where can this be cross-posted if this is not the proper forum?

Re: [CMake] Cannot cross-compile for aarch64 architecture

Posted: Sat Aug 25, 2018 11:33 pm
by Rachael
I moved it to the correct forum already. This really is the best place for it.

I've never done a cross-compile so I can't help you, I am sorry. As far as I know it's not officially supported - someone (maybe Randi?) added in the definitions in CMake for it, but did not provide any documentation.

All I can tell you is, you have to compile for your host platform first, in order to get the dependency tools (updaterevision, zipdir, etc) first.

Alternatively, you can just run QEMU with binfmt support (usually supported by most Debian distros) and edit the CMake files to force GCC to target your desired platform directly.

Re: [CMake] Cannot cross-compile for aarch64 architecture

Posted: Sat Aug 25, 2018 11:38 pm
by _mental_
Native build creates ImportExecutables.cmake file. Its full path should be specified as a value of IMPORT_EXECUTABLES variable.

Re: [CMake] Cannot cross-compile for aarch64 architecture

Posted: Mon Aug 27, 2018 11:01 pm
by Blzut3
Rachael wrote:someone
I did. It was for building PowerPC binaries on x86 Macs without needing to produce universal binaries (which comes with a lot of limitations since build systems aren't really cut out for that kind of thing). To that end it actually is documented here. Since GZDoom no longer supports that I can't say that the cross compiling feature has ever been tested against anything.

As it so happens I just set up a script to capture how to cross compile on ECWolf so here's the general idea on how to use it to compile with MinGW on Linux (you can find Android in that file as well). For Linux to Linux just with a different arch you should be able to get away with just setting the C and C++ compilers, turning on FORCE_CROSSCOMPILE, and supplying IMPORT_EXECUTABLES but you may have to do more. The main thing to look out for is system include contamination which can be somewhat influenced by CMAKE_FIND_ROOT_PATH. Basically check the advanced options in CMake and make sure that all the INCLUDE_DIR variables are what you expect them to be.

Officially what CMake recommends is building out a toolchain file, and your distro might provide one for its cross compilers.