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

Unable to cross-compile for Windows from Linux using MINGW64. #504

Open
devinamatthews opened this issue May 24, 2021 · 13 comments
Open

Unable to cross-compile for Windows from Linux using MINGW64. #504

devinamatthews opened this issue May 24, 2021 · 13 comments

Comments

@devinamatthews
Copy link
Member

devinamatthews commented May 24, 2021

Reposted from #463, as reported by @isuruf:

There are more errors with that cross compiling build though.

  1. Needs -fno-asynchronous-unwind-tables (we should check __MINGW64__ macro and add that flag). gcc bug link
  2. Next error is,
x86_64-w64-mingw32-gcc -O2 -O3 -fomit-frame-pointer -mavx2 -mfma -mfpmath=sse -march=haswell -fno-asynchronous-unwind-tables -Wall -Wno-unused-function -Wfatal-errors -std=c99 -D_POSIX_C_SOURCE=200112L -Iinclude/x86_64 -I./frame/3/ -I./frame/ind/ukernels/ -I./frame/3/ -I./frame/1m/ -I./frame/1f/ -I./frame/1/ -I./frame/include -DBLIS_VERSION_STRING=\"0.8.1-17\" -DBLIS_IS_BUILDING_LIBRARY -Wl,--exclude-all-symbols -c kernels/haswell/3/sup/bli_gemmsup_rv_haswell_asm_d6x8m.c -o obj/x86_64/kernels/haswell/3/sup/bli_gemmsup_rv_haswell_asm_d6x8m.o
kernels/haswell/3/sup/bli_gemmsup_rv_haswell_asm_d6x8m.c: In function ‘bli_dgemmsup_rv_haswell_asm_6x6m’:
kernels/haswell/3/sup/bli_gemmsup_rv_haswell_asm_d6x8m.c:1763:1: error: bp cannot be used in asm here
 }
 ^
compilation terminated due to -Wfatal-errors.
Makefile:601: recipe for target 'obj/x86_64/kernels/haswell/3/sup/bli_gemmsup_rv_haswell_asm_d6x8m.o' failed
make: *** [obj/x86_64/kernels/haswell/3/sup/bli_gemmsup_rv_haswell_asm_d6x8m.o] Error 1
@devinamatthews
Copy link
Member Author

devinamatthews commented May 24, 2021

# 1 is easy, but # 2 will require some real work.

@devinamatthews
Copy link
Member Author

Is -fno-asynchronous-unwind-tables necessary for any Windows build or just cross-compilation? Can it be used safely on actual Windows builds if not?

@isuruf
Copy link
Contributor

isuruf commented May 24, 2021

It should be for any windows build with CC_VENDOR is gcc and it is x86_64 and gcc version is <=7.

@devinamatthews
Copy link
Member Author

gcc version <= 7? That sounds like a bit of a pain but doable.

@isuruf
Copy link
Contributor

isuruf commented May 24, 2021

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65782 indicates that this fixed in GCC 8

@devinamatthews
Copy link
Member Author

Do you know why -fomit-frame-pointer is not sufficient here (problem # 2)?

@isuruf
Copy link
Contributor

isuruf commented May 24, 2021

No idea

@devinamatthews
Copy link
Member Author

@isuruf can you compile with make -k and report all files that fail?

@isuruf
Copy link
Contributor

isuruf commented May 25, 2021

$ x86_64-w64-mingw32-gcc -O2 -O3 -fomit-frame-pointer -mavx2 -mfma -mfpmath=sse -march=haswell -fno-asynchronous-unwind-tables -Wall -Wno-unused-function -Wfatal-errors -std=c99 -D_POSIX_C_SOURCE=200112L -Iinclude/x86_64 -I./frame/3/ -I./frame/ind/ukernels/ -I./frame/3/ -I./frame/1m/ -I./frame/1f/ -I./frame/1/ -I./frame/include -DBLIS_VERSION_STRING=\"0.8.1-17\" -DBLIS_IS_BUILDING_LIBRARY -Wl,--exclude-all-symbols -c kernels/haswell/3/sup/bli_gemmsup_rv_haswell_asm_s6x16n.c -o obj/x86_64/kernels/haswell/3/sup/bli_gemmsup_rv_haswell_asm_s6x16n.o -fomit-frame-pointer
kernels/haswell/3/sup/bli_gemmsup_rv_haswell_asm_s6x16n.c: In function ‘bli_sgemmsup_rv_haswell_asm_6x16n’:
kernels/haswell/3/sup/bli_gemmsup_rv_haswell_asm_s6x16n.c:1083:1: error: bp cannot be used in asm here
 }
 ^
compilation terminated due to -Wfatal-errors.
(base) isuru@isuru:~/projects/blis$ make -k V=1
x86_64-w64-mingw32-gcc -O2 -O3 -fomit-frame-pointer -mavx2 -mfma -mfpmath=sse -march=haswell -fno-asynchronous-unwind-tables -Wall -Wno-unused-function -Wfatal-errors -std=c99 -D_POSIX_C_SOURCE=200112L -Iinclude/x86_64 -I./frame/3/ -I./frame/ind/ukernels/ -I./frame/3/ -I./frame/1m/ -I./frame/1f/ -I./frame/1/ -I./frame/include -DBLIS_VERSION_STRING=\"0.8.1-17\" -DBLIS_IS_BUILDING_LIBRARY -Wl,--exclude-all-symbols -c kernels/haswell/3/sup/bli_gemmsup_rv_haswell_asm_d6x8m.c -o obj/x86_64/kernels/haswell/3/sup/bli_gemmsup_rv_haswell_asm_d6x8m.o
kernels/haswell/3/sup/bli_gemmsup_rv_haswell_asm_d6x8m.c: In function ‘bli_dgemmsup_rv_haswell_asm_6x6m’:
kernels/haswell/3/sup/bli_gemmsup_rv_haswell_asm_d6x8m.c:1763:1: error: bp cannot be used in asm here
 }
 ^
compilation terminated due to -Wfatal-errors.
Makefile:601: recipe for target 'obj/x86_64/kernels/haswell/3/sup/bli_gemmsup_rv_haswell_asm_d6x8m.o' failed
make: *** [obj/x86_64/kernels/haswell/3/sup/bli_gemmsup_rv_haswell_asm_d6x8m.o] Error 1
x86_64-w64-mingw32-gcc -O2 -O3 -fomit-frame-pointer -mavx2 -mfma -mfpmath=sse -march=haswell -fno-asynchronous-unwind-tables -Wall -Wno-unused-function -Wfatal-errors -std=c99 -D_POSIX_C_SOURCE=200112L -Iinclude/x86_64 -I./frame/3/ -I./frame/ind/ukernels/ -I./frame/3/ -I./frame/1m/ -I./frame/1f/ -I./frame/1/ -I./frame/include -DBLIS_VERSION_STRING=\"0.8.1-17\" -DBLIS_IS_BUILDING_LIBRARY -Wl,--exclude-all-symbols -c kernels/haswell/3/sup/bli_gemmsup_rv_haswell_asm_d6x8n.c -o obj/x86_64/kernels/haswell/3/sup/bli_gemmsup_rv_haswell_asm_d6x8n.o
kernels/haswell/3/sup/bli_gemmsup_rv_haswell_asm_d6x8n.c: In function ‘bli_dgemmsup_rv_haswell_asm_6x8n’:
kernels/haswell/3/sup/bli_gemmsup_rv_haswell_asm_d6x8n.c:948:1: error: bp cannot be used in asm here
 }
 ^
compilation terminated due to -Wfatal-errors.
Makefile:601: recipe for target 'obj/x86_64/kernels/haswell/3/sup/bli_gemmsup_rv_haswell_asm_d6x8n.o' failed
make: *** [obj/x86_64/kernels/haswell/3/sup/bli_gemmsup_rv_haswell_asm_d6x8n.o] Error 1
x86_64-w64-mingw32-gcc -O2 -O3 -fomit-frame-pointer -mavx2 -mfma -mfpmath=sse -march=haswell -fno-asynchronous-unwind-tables -Wall -Wno-unused-function -Wfatal-errors -std=c99 -D_POSIX_C_SOURCE=200112L -Iinclude/x86_64 -I./frame/3/ -I./frame/ind/ukernels/ -I./frame/3/ -I./frame/1m/ -I./frame/1f/ -I./frame/1/ -I./frame/include -DBLIS_VERSION_STRING=\"0.8.1-17\" -DBLIS_IS_BUILDING_LIBRARY -Wl,--exclude-all-symbols -c kernels/haswell/3/sup/bli_gemmsup_rv_haswell_asm_s6x16m.c -o obj/x86_64/kernels/haswell/3/sup/bli_gemmsup_rv_haswell_asm_s6x16m.o
kernels/haswell/3/sup/bli_gemmsup_rv_haswell_asm_s6x16m.c: In function ‘bli_sgemmsup_rv_haswell_asm_6x12m’:
kernels/haswell/3/sup/bli_gemmsup_rv_haswell_asm_s6x16m.c:1985:1: error: bp cannot be used in asm here
 }
 ^
compilation terminated due to -Wfatal-errors.
Makefile:601: recipe for target 'obj/x86_64/kernels/haswell/3/sup/bli_gemmsup_rv_haswell_asm_s6x16m.o' failed
make: *** [obj/x86_64/kernels/haswell/3/sup/bli_gemmsup_rv_haswell_asm_s6x16m.o] Error 1
x86_64-w64-mingw32-gcc -O2 -O3 -fomit-frame-pointer -mavx2 -mfma -mfpmath=sse -march=haswell -fno-asynchronous-unwind-tables -Wall -Wno-unused-function -Wfatal-errors -std=c99 -D_POSIX_C_SOURCE=200112L -Iinclude/x86_64 -I./frame/3/ -I./frame/ind/ukernels/ -I./frame/3/ -I./frame/1m/ -I./frame/1f/ -I./frame/1/ -I./frame/include -DBLIS_VERSION_STRING=\"0.8.1-17\" -DBLIS_IS_BUILDING_LIBRARY -Wl,--exclude-all-symbols -c kernels/haswell/3/sup/bli_gemmsup_rv_haswell_asm_s6x16n.c -o obj/x86_64/kernels/haswell/3/sup/bli_gemmsup_rv_haswell_asm_s6x16n.o
kernels/haswell/3/sup/bli_gemmsup_rv_haswell_asm_s6x16n.c: In function ‘bli_sgemmsup_rv_haswell_asm_6x16n’:
kernels/haswell/3/sup/bli_gemmsup_rv_haswell_asm_s6x16n.c:1083:1: error: bp cannot be used in asm here
 }
 ^
compilation terminated due to -Wfatal-errors.
Makefile:601: recipe for target 'obj/x86_64/kernels/haswell/3/sup/bli_gemmsup_rv_haswell_asm_s6x16n.o' failed
make: *** [obj/x86_64/kernels/haswell/3/sup/bli_gemmsup_rv_haswell_asm_s6x16n.o] Error 1
make: Target 'all' not remade because of errors.

@devinamatthews
Copy link
Member Author

So there wasn't an error compiling kernels/haswell/3/bli_gemm_haswell_asm_d6x8.o?

@isuruf
Copy link
Contributor

isuruf commented May 25, 2021

Nope. That compiled fine.

@devinamatthews
Copy link
Member Author

devinamatthews commented May 25, 2021

Can you take one of those files, produce an asm file and then try compiling that? Maybe we can get an actual line location for the error. Actually, it looks like I can install mingw-w64 in macOS, so I'll see if I can reproduce.

@devinamatthews
Copy link
Member Author

Those files compile fine with a recent version on macOS:

[dmatthews@Devin's MacBook Pro ~]$x86_64-w64-mingw32-gcc --version
x86_64-w64-mingw32-gcc (GCC) 11.1.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants