Compilation failing on Windows
benstt opened this issue · 1 comments
The build.bat
script used to compile in Windows is not working properly. It seems we have a piece of code missing from one of the include libraries:
F:\onyx_src_benji\shared\include\bh.h(1930): error C2039: 'st_mtim': is not a member of 'stat'
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\sys/stat.h(87): note: see declaration of 'stat'
F:\onyx_src_benji\shared\include\bh.h(1930): error C2198: 'timespec_to_ms': too few arguments for call
F:\onyx_src_benji\shared\include\bh.h(1931): error C2039: 'st_atim': is not a member of 'stat'
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\sys/stat.h(87): note: see declaration of 'stat'
F:\onyx_src_benji\shared\include\bh.h(1931): error C2198: 'timespec_to_ms': too few arguments for call
F:\onyx_src_benji\shared\include\bh.h(1932): error C2039: 'st_ctim': is not a member of 'stat'
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\sys/stat.h(87): note: see declaration of 'stat'
F:\onyx_src_benji\shared\include\bh.h(1932): error C2198: 'timespec_to_ms': too few arguments for call
In particular, it seems we're missing a check for _BH_WINDOWS
here:
#if defined(_BH_DARWIN)
// Apple just has to be different.
out->modified_time = timespec_to_ms(s.st_mtimespec);
out->accessed_time = timespec_to_ms(s.st_atimespec);
out->change_time = timespec_to_ms(s.st_ctimespec);
#else
out->modified_time = timespec_to_ms(s.st_mtim);
out->accessed_time = timespec_to_ms(s.st_atim);
out->change_time = timespec_to_ms(s.st_ctim);
#endif
Additionally, the batch script does not exit with an error code after compilation fails, so CI succeeds. The following pipeline passed, even though it couldn't build an onyx
executable: https://github.com/onyx-lang/onyx/actions/runs/7946470284/job/21694237022
"Build Onyx for windows-amd64-" also tells us there was a problem copying the executable. Adding a few echo
s helps us diagnose the problem:
Trying to copy onyx.exe to dist...
The system cannot find the file specified.
!! Seems there wasn't any onyx.exe!
Thanks for the issue and the fix! I'll get your pull request merged in soon. I forgot that the Windows script does not stop if one of the commands fails to complete successfully. This will definitely help in the future!