Revert "Support cross compiling from host to host (#12859)" #13591
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Original issue #8921 was fixed with #12859 by @nc-x. This attempted to fix cross compilation but ends up with always preferring
$cpu.$os.gcc.exe
even though it is not being requested.Consider nightlies which builds csources with
--cpu arm
in a dockcross armv7a setup. This goes fine and the correct armv7a compiler is used since $CC is set appropriately.Next, nim.cfg is updated to point to $CC for
gcc.exe
so that the correct C cross-compiler is used for all following Nim calls.Next,
nim c koch
is run and even though no cross compilation is requested in the command line or the nim.cfg, Nim tries to usearm.linux.gcc.exe
which is defined in nim.cfg asarm-linux-gnueabihf-gcc
. This is the correct compiler on armv6 but not on armv7a or armv7 and causes those jobs to fail. arm64 passes since we do not have anarm64.linux.gcc.exe
defined in nim.cfg.This fails because hostCPU and targetCPU both are set as
arm
since csources was compiled with--cpu arm
. As a result, the original if condition that was removed in #12859 does not take effect and the defaultgcc.exe
is used and the correct cross-compiler is called.With the #12859 code change, it always changes the compiler based on targetCPU which is
arm
and Nim picks the wrong defaultarm.linux.gcc.exe
compiler defined in nim.cfg.Even besides this specific case, per @alaviss, this code change no longer aligns with the documentation nor is it backwards compatible.
IRC discussion here.