Fix building with musl libc
On musl lib fseeko64 is not supported, and building on musl gives the following error:
In file included from util.h:10, from device_file.c:9: device_file.c: In function 'DeviceFile_ReadContigious': oscompatibility.h:159:46: error: implicit declaration of function 'fseeko64'; did you mean 'fseeko'? [-Wimplicit-function-declaration] 159 | #define _fseeki64(f, o, w) (fseeko64(f, o, w)) | ^~~~~~~~ device_file.c:197:13: note: in expansion of macro '_fseeki64' 197 | if(0 == _fseeki64(ctx->File[0].h, ctxRC->paBase, SEEK_SET)) { | ^~~~~~~~~
For now I've wrapped the definitions around #ifdef's, so that fseeko64 and other similar fucntions are only used under GLIBC and on musl we can use the supported fseeko (and other supported) functions. But I'm open to better approach as this could lead to macro hell.
First reported on Gentoo Linux on musl profile. Please refer: https://bugs.gentoo.org/935917
Thank you for reporting this.
I'll probably try an alternative approach by setting _FILE_OFFSET_BITS to 64 instead of relying on GLIBC specific #ifdef's.
I'm currently on vacation though and I would have to test this properly before making the change. I expect to be able to look into this next week.
I'll keep this PR open until it's fixed either way.
I've now included the fix which is slightly different than this PR. I'm setting #define _FILE_OFFSET_BITS 64 instead which I found to be cleaner rather than relying on separate GLIBC checks.
Since the issue is now hopefully resolved I'm closing this issue. Please let me know if there should be any lingering issues (of which I hope there should be none).
Once again, Thank You for reporting this issue.