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

Revert "Support cross compiling from host to host (#12859)" #13591

Merged
merged 1 commit into from
Mar 10, 2020
Merged

Revert "Support cross compiling from host to host (#12859)" #13591

merged 1 commit into from
Mar 10, 2020

Conversation

genotrance
Copy link
Contributor

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 use arm.linux.gcc.exe which is defined in nim.cfg as arm-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 an arm64.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 default gcc.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 default arm.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.

@narimiran narimiran merged commit ab5d962 into nim-lang:devel Mar 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants