Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fts.h on Linux does not support _FILE_OFFSET_BITS=64 on glibc older than 2015 #3519

Open
siteshwar opened this issue May 3, 2018 · 7 comments
Assignees
Milestone

Comments

@siteshwar
Copy link

Copying my comment from #1455.

Support for 64-bit operations in fts functions was added only a few years ago in glibc through this commit and there are systems that still ship older versions glibc (for e.g. opensuse). Unconditionally enabling this macro on all systems will cause compilation failures. There should be a feature test before this macro is enabled.

@siteshwar
Copy link
Author

For the reference, test case should be pretty simple:

> cat test.c
#include <fts.h>

int main() {
}

> cc -D_FILE_OFFSET_BITS=64 test.c
In file included from test.c:1:0:
/usr/include/fts.h:41:3: error: #error "<fts.h> cannot be used with -D_FILE_OFFSET_BITS==64"
 # error "<fts.h> cannot be used with -D_FILE_OFFSET_BITS==64"
#include <fts.h>

int main() {
}

@nirbheek
Copy link
Member

nirbheek commented May 3, 2018

See also: #3049. Unconditionally enabling this is broken on some platforms (Raspbian armhf) and hilariously broken on other platforms (Android 32-bit).

We do want to fix this properly, but no one has come along who is willing to investigate the edge cases involved. Would you like to work on this?

@siteshwar
Copy link
Author

@nirbheek Is there a way to turn off this flag in builds ? If I am reading the docs correctly, it can not be turned off, so it should not be added to builds by default. I might look at it in my free time, but can not promise a fix at the moment.

@nirbheek
Copy link
Member

nirbheek commented May 3, 2018

@nirbheek Is there a way to turn off this flag in builds ?

Yes, if you pass -U_FILE_OFFSET_BITS in add_project_arguments() (or on the specific target with c_args:) that should do it.

@nirbheek nirbheek self-assigned this May 3, 2018
@nirbheek nirbheek added this to the meson-next milestone May 3, 2018
@nirbheek nirbheek changed the title Add a feature test before enabling _FILE_OFFSET_BITS macro fts.h on Linux does not support _FILE_OFFSET_BITS=64 on glibc older than 2015 May 3, 2018
@siteshwar
Copy link
Author

@nirbheek Thanks for the quick fix.

@nirbheek
Copy link
Member

Notes:

  1. This is a bug in glibc that we have to work around
  2. The Android NDK bug was fixed when targeting Android SDK >=15
  3. The raspbian armhf bug has not been reproduced yet

vaygr referenced this issue in jarun/nnn Sep 3, 2023
according to the manpage, it won't have any effect on 64bit system
anyways. and musl always uses 64bit so this macro doesn't have any
effect there either.
@mid-kid
Copy link

mid-kid commented May 16, 2024

Bumping this, it bit my ass when converting a program from a different build system to meson. I think there should be a toggle at least - no other build system enforces it like that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants