Unable to cross-compile for Windows from Linux using MINGW64.
Reposted from #463, as reported by @isuruf:
There are more errors with that cross compiling build though.
- Needs -fno-asynchronous-unwind-tables (we should check
__MINGW64__macro and add that flag). gcc bug link - 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
# 1 is easy, but # 2 will require some real work.
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?
It should be for any windows build with CC_VENDOR is gcc and it is x86_64 and gcc version is <=7.
gcc version <= 7? That sounds like a bit of a pain but doable.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65782 indicates that this fixed in GCC 8
Do you know why -fomit-frame-pointer is not sufficient here (problem # 2)?
No idea
@isuruf can you compile with make -k and report all files that fail?
$ 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.
So there wasn't an error compiling kernels/haswell/3/bli_gemm_haswell_asm_d6x8.o?
Nope. That compiled fine.
~~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.
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.