Skip to content

fix build on non-glibc Linux - #808

Open
edaigle wants to merge 1 commit into
systemed:masterfrom
edaigle:fix-non-glibc-build
Open

edaigle wants to merge 1 commit into
systemed:masterfrom
edaigle:fix-non-glibc-build

Conversation

@edaigle

@edaigle edaigle commented Apr 7, 2025

Copy link
Copy Markdown
  • non-glibc Linux do not have stat64, causing build to fail on e.g. musl/Alpine.
  • this commit adds a check to make sure we are on a glibc system before using stat64.

Closes #807

* non-glibc Linux do not have stat64, causing build to fail on e.g. musl/Alpine.
* this commit adds a check to make sure we are on a glibc system before using stat64.
Comment thread src/helpers.cpp
#endif

#if defined(__APPLE__)
#if defined(__APPLE__) || !defined (__GLIBC__)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that change is correct - it would conflict with the define for stat64 when _MSC_VER is defined (above)

Maybe (assuming that __GLIBC__ isn't defined for __APPLE__ anyway):

#ifdef _MSC_VER
#define stat64 __stat64
#elif !defined(__GLIBC__)
#define stat64 stat
#endif

@dktue

dktue commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Thanks for this! One catch: MSVC doesn't define __GLIBC__, so on Windows this redefines stat64 (already __stat64 a few lines above) to plain stat (C4005 warning). Windows struct stat has a 32-bit st_size, so getFileSize(), used to split GeoJSONSeq files, would fail on files over 2 GB. #952 is the same fix with a !defined(_MSC_VER) guard. Happy for either to be merged with that guard.

dktue added a commit to dktue/tilemaker that referenced this pull request Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build fails on non-glibc Linux due to use of stat64

3 participants