Host compiler wrongly identified when cross compiling with gcc for i686
Categories
(Firefox Build System :: General, defect)
Tracking
(Not tracked)
People
(Reporter: ray-v, Unassigned)
Details
(Keywords: in-triage)
Cross compiling for i686 on x86_64, configure doesn't identify the host compiler
[...]
0:12.76 checking for the target C compiler... /<path>/bin/i686-linux-gnu-gcc
0:13.02 checking whether the target C compiler can be used... yes
0:13.02 checking the target C compiler version... 9.1.0
0:13.06 checking the target C compiler works... yes
0:13.06 checking for the target C++ compiler... /<path>/bin/i686-linux-gnu-g++
0:13.09 checking whether the target C++ compiler can be used... yes
0:13.09 checking the target C++ compiler version... 9.1.0
0:13.13 checking the target C++ compiler works... yes
0:13.14 checking for the host C compiler... /<path>/bin/i686-linux-gnu-gcc
0:13.20 checking whether the host C compiler can be used...
[...]
0:13.21 DEBUG: Executing:/<path>/bin/i686-linux-gnu-gcc -std=gnu99 -m64 -E /tmp/conftest.U4I8lz.c
0:13.21 DEBUG: The command returned non-zero exit status 1.
0:13.21 DEBUG: Its output was:
0:13.21 DEBUG: | # 1 "/tmp/conftest.U4I8lz.c"
0:13.21 DEBUG: Its error output was:
0:13.21 DEBUG: | cc1: sorry, unimplemented: 64-bit mode not compiled in
0:13.21 ERROR: Command/<path>/bin/i686-linux-gnu-gcc -std=gnu99 -m64 -E /tmp/conftest.U4I8lz.cfailed with exit status 1.
[...]
... although the 'host system type' is correctly identified:
0:11.18 checking for host system type... x86_64-pc-linux-gnu
0:11.20 checking for target system type... i686-unknown-linux-gnu
0:12.21 checking whether cross compiling... yes
It seems build/moz.configure/toolchain.configure can't differentiate between host and target compilers for an x86_64->i686 cross build - it works ok for x86_64->armv7 and x86_64->aarch64.
It will accept user defined HOST_C* options and setting HOST_CC=gcc and HOST_CXX=g++ produces the correct result.
But as gcc is in the PATH and there are no additional flags, I'd expect the script to identify the correct host compiler without user intervention.
Comment 1•6 years ago
|
||
Are you passing that i686-linux-gnu-gcc manually?
Unrelated to this issue, I've tried setting CC/CXX from the console, in mozconfig, and not at all, and in all cases, without HOST_C* set, this error occurs.
Unravelling Python code is beyond me at the moment, otherwise I'd have proposed a solution.
However, according to build/moz.configure/toolchain.configure#817
# If the target C compiler is GCC, and it can't be used with # -m32/-m64 for the host, it's probably toolchain-prefixed, # so we prioritize a raw 'gcc' instead.
In this case, the target C compiler is GCC, and can't be used with -m64 for the host, but the build isn't then using the raw gcc.
If I butcher the code at build/moz.configure/toolchain.configure#814
replacing:
if (target.cpu != host_or_target.cpu and (target.cpu, host_or_target.cpu) not in same_arch and (host_or_target.cpu, target.cpu) not in same_arch):
with:
if (host_or_target.cpu == host_or_target.cpu):
the output is correct:
0:01.48 checking for host system type... x86_64-pc-linux-gnu
0:01.50 checking for target system type... i686-unknown-linux-gnu
0:02.32 checking whether cross compiling... yes
[...]
0:02.81 checking for the target C compiler... /<path>/bin/i686-linux-gnu-gcc
0:02.87 checking whether the target C compiler can be used... yes
0:02.87 checking the target C compiler version... 9.1.0
0:02.92 checking the target C compiler works... yes
0:02.92 checking for the target C++ compiler... /<path>/bin/i686-linux-gnu-g++
0:02.95 checking whether the target C++ compiler can be used... yes
0:02.95 checking the target C++ compiler version... 9.1.0
0:02.99 checking the target C++ compiler works... yes
0:02.99 checking for the host C compiler... /usr/bin/gcc
0:03.05 checking whether the host C compiler can be used... yes
I'm in no way suggesting that what I've done is a solution, just that it might be an indicator of where the problem is.
Does your distro support cross compiling from x86_64 to i686? Mine doesn't if it's a multilib installation, where there's a seperate folder for /usr/lib32 and /usr/lib64 , so check if you're not accidentially breaking the rules here.
You also will need the full foreign rust-std installed.
Does your distro support cross compiling from x86_64 to i686?
Yes - I can cross compile for i686, and have just done so for 68.3.0 and 71.0. My point is that I need to set HOST_CC/HOST_CXX, but I would have expected the configuration to have identified the host compiler without that.
You also will need the full foreign rust-std installed.
I have the full rust-x86_64 [rust-1.37.0-x86_64-unknown-linux-gnu] plus the i686 libraries [rust-std-1.37.0-i686-unknown-linux-gnu] installed, which enables me to cross compile for i686.
I'm in no way suggesting that what I've done is a solution, just that it might be an indicator of where the problem is.
I've gone a stage further and patched toolchain.configure:
--- build/moz.configure/toolchain.configure
+++ build/moz.configure/toolchain.configure
@@ -840,7 +840 @@
- if (target.cpu != host_or_target.cpu and
- (target.cpu, host_or_target.cpu) not in same_arch and
- (host_or_target.cpu, target.cpu) not in same_arch):
- # If the target C compiler is GCC, and it can't be used with
- # -m32/-m64 for the host, it's probably toolchain-prefixed,
- # so we prioritize a raw 'gcc' instead.
- prioritized = info.type
+ prioritized = info.type
and for each case, that is x86_64 native build or armv7/aarch64/i686 cross builds, the host compiler is correctly identified without setting HOST_C*, so what is the purpose of this test?
You haven't answered to comment 1.
I thought I had:
I've tried setting CC/CXX from the console, in mozconfig, and not at all,
so that's yes, yes, no
[no] Without setting CC/CXX or [yes] setting
CC=i686-linux-gnu-gcc
CXX=i686-linux-gnu-g++
the output is:
0:12.76 checking for the target C compiler... /<path>/i686-linux-gnu-gcc
[...]
0:13.14 checking for the host C compiler... /<path>/i686-linux-gnu-gcc
Set:
HOST_CC=gcc
HOST_CXX=g++
or remove that test in toolchain.configure and the output is:
0:02.81 checking for the target C compiler... /<path>/i686-linux-gnu-gcc
[...]
0:02.99 checking for the host C compiler... /usr/bin/gcc
Updated•3 years ago
|
Description
•