Hello JasonFriday13 and other NSIS developers,
We use NSISBI to package 0 A.D., and we use macOS as our platform for building our packages. The use of NSISBI is mandated by our game assets being bundled in a 3.5GB file.
We experience an issue with recent versions of NSISBI. Up to 3.08.1, we have no issues building NSISBI from source and using it 🙂
With 3.09.2 and 3.10.2 (I haven't tested the .1 versions), we get the following build error:
Source/util.cpp:32:12: fatal error: 'sys/sysinfo.h' file not found
# include <sys/sysinfo.h>
This header is indeed not present in macOS. I can remove this offending include and this doesn't prevent makensis to build correctly. However, if I do so, using makensis to package the game will fail at the large 3.5GB file, with the error message
File: failed creating mmap of "archives/public/public.zip"
I do not know if the mmap issue is caused by the removed include, or if it would also happen on a Linux build of NSISBI.
Thanks in advance for the help, and thanks for the work on NSIS and NSISBI 🙂
NSISBI Build error and issue on macOS
3 posts
I don't have any Apple machines to test this on, so I'm just guessing at what would work and what doesn't. The header file is only used to get the number of logical processors (and it has a fallback), so it shouldn't matter. But we can check that though. In Source/util.cpp at around line 81, add an error line to see which one is being hit, like this:
As for the mmap error, I don't remember if I changed anything related to that (after 3.08.1). I did do big file tests on linux and windows to test the multithreading speed, and those are fine (the windows tests were done using a 32 bit version of the compiler).
Try compiling 3.08.2-beta and see if that fails too (besides the header file mentioned above), because that beta only added multithreading, everything else is the same from 3.08.1.
Depending on which one is hit, you could try switching the #elif statements around so that the apple one comes first. I did add multithreading for the codecs, so there might be something specific for Mac I might have missed....
#elif defined(_SC_NPROCESSORS_ONLN)
#error Linux type call
count = sysconf(_SC_NPROCESSORS_ONLN);
#elif defined(__APPLE__) || defined(__FreeBSD__)
#error Apple type call
int ct;
...
As for the mmap error, I don't remember if I changed anything related to that (after 3.08.1). I did do big file tests on linux and windows to test the multithreading speed, and those are fine (the windows tests were done using a 32 bit version of the compiler).
Try compiling 3.08.2-beta and see if that fails too (besides the header file mentioned above), because that beta only added multithreading, everything else is the same from 3.08.1.
Well, I bought a cheap Mac Mini to test this on. That header file is not needed on macOS, so I just wrapped it in an #if statement to exclude it.
For the mmap error, I found that in Source/util.cpp: get_file_size64() and Platform_GetMaxFileSize() have a bug when compiled on macOS. Mac doesn't define posix specific stuff, even though fstat() is available (and 64 bit capable). So the fix is very simple:
For the mmap error, I found that in Source/util.cpp: get_file_size64() and Platform_GetMaxFileSize() have a bug when compiled on macOS. Mac doesn't define posix specific stuff, even though fstat() is available (and 64 bit capable). So the fix is very simple:
Clang also throws a few warnings in as well, which I'll try and fix in the future. I've attached the diff for this as well.#if _XOPEN_SOURCE >= 500 || _POSIX_C_SOURCE >= 200112L || defined(__APPLE__) || defined(__FreeBSD__)