I don't have a windows machine, but the cross compile for 64-bit windows on my machine looks like this:
$ cd build
$ make clean
$ make CC=x86_64-w64-mingw32-gcc
$ wine src/metamath.exe
0024:err:file:init_redirects /home/mario/.wine/dosdevices/c:/windows: No such file or directory
002c:err:wineboot:main Cannot set the dir to L"C:\\windows" (2)
002c:err:wineboot:process_run_key Error running cmd L"C:\\windows\\system32\\winemenubuilder.exe -a -r" (2).
wine: could not open working directory L"unix\\home\\mario\\Documents\\metamath\\metamath-exe\\build\\", starting in the Windows directory.
002c:err:shell:SHGetFolderPathAndSubDirW Failed to create directory L"C:\\users\\mario\\Application Data".
002c:err:shell:SHGetFolderPathAndSubDirW Failed to create directory L"C:\\users\\mario".
002c:err:shell:SHGetFolderPathAndSubDirW Failed to create directory L"C:\\users\\mario\\Local Settings\\Application Data".
wine: could not open working directory L"unix\\home\\mario\\Documents\\metamath\\metamath-exe\\build\\", starting in the Windows directory.
*** BUG #1501
Metamath - Version 0.199.pre 29-Jan-2022 wine: Unhandled page fault on read access to 0000000000000000 at address 00000001C8DFD2B0 (thread 0040), starting debugger...
0040:err:seh:start_debugger Couldn't start debugger L"winedbg --auto 60 60" (2)
Read the Wine Developers Guide on how to set up winedbg or another debugger
Most of the wine errors are harmless, but metamath immediately gives BUG #1501 and then dereferences null shortly afterward. The 32-bit windows build works properly.
I believe the reason is because metamath-exe uses long as an equivalent to size_t, ptrdiff_t and the like, but in 64-bit windows long is 4 bytes while pointers and allocation sizes are 8 bytes, so there is a lot of invalid casting going around.
Thank you for noting this issue. Compiling with clang m*.c -o ../bin/metamath.exe -O3 -funroll-loops -finline-functions -fomit-frame-pointer -m32 (note the -m32) works on my machine.
I don't have a windows machine, but the cross compile for 64-bit windows on my machine looks like this:
Most of the wine errors are harmless, but metamath immediately gives
BUG #1501
and then dereferences null shortly afterward. The 32-bit windows build works properly.I believe the reason is because metamath-exe uses
long
as an equivalent tosize_t
,ptrdiff_t
and the like, but in 64-bit windowslong
is 4 bytes while pointers and allocation sizes are 8 bytes, so there is a lot of invalid casting going around.