bkaradzic / GENie

GENie - Project generator tool
Other
905 stars 168 forks source link

linux: Set _FILE_OFFSET_BITS=64 #537

Closed mbarnes closed 3 years ago

mbarnes commented 3 years ago

The description below is in the context of building MAME, which vendors GENie into its source tree. (see https://github.com/mamedev/mame/pull/8808) Offering the change here as it may be useful to other projects using GENie.

Compiles GENie with off_t defined as a 64-bit integer to assist with building MAME on a 32-bit operating system like Raspberry Pi OS and a storage volume larger than 2 GB.

Without this, the build can fail with a misleading error:

[string "premake.fields = {}..."]:82: Can't find matching files for pattern :.../mame/scripts/resources/uwp/assets/*.png
stack traceback:
        [C]: in function 'error'
        [string "premake.fields = {}..."]:82: in function 'makeabsolute'
        [string "premake.fields = {}..."]:76: in function 'makeabsolute'
        [string "premake.fields = {}..."]:92: in function <[string "premake.fields = {}..."]:71>
        (...tail calls...)
        .../mame/scripts/src/main.lua:79: in function 'mainProject'
        .../mame/scripts/genie.lua:1566: in main chunk
        [C]: in upvalue 'builtin_dofile'
        [string "premake = { }..."]:109: in function 'dofile'
        [string "_WORKING_DIR        = os.getcwd()..."]:46: in function '_premake_main'
make: *** [makefile:1391: build/projects/sdl/mame/gmake-linux/Makefile] Error 1

The "Can't find matching files for pattern" error message is misleading because GENie's os.matchnext() function doesn't check its readdir() calls for error. But here it's actually failing with EOVERFLOW because the type off_t is only 32-bits.

bkaradzic commented 3 years ago

You're modifying generated files. Modify script instead: https://github.com/bkaradzic/GENie/blob/master/scripts/genie.lua