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

make it possible to cross-compile the toolchain from linux for windows #509

Open
niXman opened this issue May 5, 2020 · 3 comments
Open

Comments

@niXman
Copy link
Owner

niXman commented May 5, 2020

subj.

look at this branch: https://github.com/niXman/mingw-builds/tree/cross-build

now I can build everything up to GCS stage.
then I faced with this error:

x86_64-w64-mingw32-gcc -L/mingw64/x86_64-w64-mingw32/lib -L/mingw64/mingw/lib -isystem /mingw64/x86_64-w64-mingw32/include -isystem /mingw64/mingw/include   -fno-checking -g -O2 -pipe -fno-ident -I/home/nixman/mingw-gcc-9.3.0/x86_64-930-posix-seh-rt_v7-s/mingw64/opt/include -I/home/nixman/mingw-gcc-9.3.0/prerequisites/x86_64-zlib-static/include -I/home/nixman/mingw-gcc-9.3.0/prerequisites/x86_64-w64-mingw32-static/include -O2 -I../../../../../src/gcc-9.3.0/libgcc/../winsup/w32api/include -g -O2 -pipe -fno-ident -I/home/nixman/mingw-gcc-9.3.0/x86_64-930-posix-seh-rt_v7-s/mingw64/opt/include -I/home/nixman/mingw-gcc-9.3.0/prerequisites/x86_64-zlib-static/include -I/home/nixman/mingw-gcc-9.3.0/prerequisites/x86_64-w64-mingw32-static/include -DIN_GCC    -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector   -I. -I. -I../.././gcc -I../../../../../src/gcc-9.3.0/libgcc -I../../../../../src/gcc-9.3.0/libgcc/. -I../../../../../src/gcc-9.3.0/libgcc/../gcc -I../../../../../src/gcc-9.3.0/libgcc/../include -I../../../../../src/gcc-9.3.0/libgcc/config/libbid -DENABLE_DECIMAL_BID_FORMAT -DHAVE_CC_TLS -DUSE_EMUTLS -Wno-missing-prototypes -Wno-type-limits -o divtf3.o -MT divtf3.o -MD -MP -MF divtf3.dep  -c ../../../../../src/gcc-9.3.0/libgcc/soft-fp/divtf3.c 
../../../../../src/gcc-9.3.0/libgcc/config/i386/cpuinfo.c: In function ‘get_intel_cpu’:
../../../../../src/gcc-9.3.0/libgcc/config/i386/cpuinfo.c:222:20: error: ‘bit_AVX512VNNI’ undeclared (first use in this function); did you mean ‘bit_AVX512VBMI’?
          if (ecx & bit_AVX512VNNI)
                    ^~~~~~~~~~~~~~
                    bit_AVX512VBMI
../../../../../src/gcc-9.3.0/libgcc/config/i386/cpuinfo.c:222:20: note: each undeclared identifier is reported only once for each function it appears in
../../../../../src/gcc-9.3.0/libgcc/config/i386/cpuinfo.c: In function ‘get_available_features’:
../../../../../src/gcc-9.3.0/libgcc/config/i386/cpuinfo.c:372:14: error: ‘bit_AVX512VBMI2’ undeclared (first use in this function); did you mean ‘bit_AVX512VBMI’?
    if (ecx & bit_AVX512VBMI2)
              ^~~~~~~~~~~~~~~
              bit_AVX512VBMI
../../../../../src/gcc-9.3.0/libgcc/config/i386/cpuinfo.c:374:14: error: ‘bit_GFNI’ undeclared (first use in this function); did you mean ‘bit_BMI’?
    if (ecx & bit_GFNI)
              ^~~~~~~~
              bit_BMI
../../../../../src/gcc-9.3.0/libgcc/config/i386/cpuinfo.c:376:14: error: ‘bit_VPCLMULQDQ’ undeclared (first use in this function); did you mean ‘bit_PCLMUL’?
    if (ecx & bit_VPCLMULQDQ)
              ^~~~~~~~~~~~~~
              bit_PCLMUL
../../../../../src/gcc-9.3.0/libgcc/config/i386/cpuinfo.c:378:14: error: ‘bit_AVX512VNNI’ undeclared (first use in this function); did you mean ‘bit_AVX512VBMI’?
    if (ecx & bit_AVX512VNNI)
              ^~~~~~~~~~~~~~
              bit_AVX512VBMI
../../../../../src/gcc-9.3.0/libgcc/config/i386/cpuinfo.c:380:14: error: ‘bit_AVX512BITALG’ undeclared (first use in this function); did you mean ‘bit_AVX5124FMAPS’?
    if (ecx & bit_AVX512BITALG)
              ^~~~~~~~~~~~~~~~
              bit_AVX5124FMAPS
../../../../../src/gcc-9.3.0/libgcc/static-object.mk:17: recipe for target 'cpuinfo.o' failed
make[3]: *** [cpuinfo.o] Error 1

ATM I have no ideas why...

cmd line was used: ./build --mode=gcc-9.3.0 --arch=x86_64 --jobs=4 --rt-version=v7 --exceptions=seh --no-multilib --static-gcc --enable-languages=c,c++

tested on ubuntu 18.04 using MinGW-W64 cross-compiler provided by distro.

@Furniel maybe you have the time and desire to continue this ;)

@ghost
Copy link

ghost commented Oct 10, 2022

@niXman Is there any progress? I'm a pkgsrc user and I have built this cross compiler many times. I'm sure this is possible. Please have a look at this, maybe you could learn something: https://pkgsrc.se/cross/mingw-w64 The drawback of pkgsrc is it's overly complex, if you could get your scripts working then I definitely prefer yours from pkgsrc.

@eko5624
Copy link

eko5624 commented Jun 12, 2023

Is cross-compile available here now?
I can cross-compile gcc with posix thread.
LINK here: https://github.com/eko5624/toolchain-test/discussions/6#discussion-5289277

But I tried to cross-compile gcc with mcf, something is wrong.
LINK here: https://github.com/eko5624/toolchain-test/discussions/5#discussioncomment-6144234
Any suggestions?

@Peter0x44
Copy link

@niXman I had exactly this issue, it is likely caused by not using a gcc version >= the one you are cross compiling.
In my case I was trying to cross-compile gcc 14 with gcc 12.

The solution is to make a native cross compiler first, and then use that to cross-compile.
It's what w64devkit does here:
https://github.com/skeeto/w64devkit/blob/35f275416eea18f78f6ee7f1e19ea740d8d812ce/Dockerfile#L65-L123

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

No branches or pull requests

3 participants