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

Missing large file support for older toolchains #1678

Closed
hgy59 opened this issue Jun 28, 2023 · 1 comment
Closed

Missing large file support for older toolchains #1678

hgy59 opened this issue Jun 28, 2023 · 1 comment
Labels

Comments

@hgy59
Copy link

hgy59 commented Jun 28, 2023

nnn requires the option _FILE_OFFSET_BITS==64 on 32 bit archs to handle Large files (> 4GB).

This is forced for 32-bit arm and x86 archs in nnn.c by

#if defined(__arm__) || defined(__i386__)
#define _FILE_OFFSET_BITS 64 /* Support large files on 32-bit */
#endif

This was introduced in #42 and fixed for 32-bit arm with #135

Since nnn.c depends on included fts.h I get a comiler error for the current version (4.8) with older toolchains:

<fts.h> cannot be used with -D_FILE_OFFSET_BITS==64

I can remove the the definition of _FILE_OFFSET_BITS 64 to build nnn successfully with these toolchains, but than it will lack to display large files correctly.

Is it possible to build nnn without the dependency of fts.h to fix this?
i.e. I am searching for a solution to build nnn without multithreading support that was introduced with nnn v4.1.

@hgy59 hgy59 added the bug label Jun 28, 2023
@N-R-K
Copy link
Collaborator

N-R-K commented Jun 30, 2023

This is a bug in glibc, from man 3 fts:

BUGS
       Before  glibc  2.23,  all  of  the  APIs described in this man page are not safe when compiling a program using the LFS APIs
       (e.g., when compiling with -D_FILE_OFFSET_BITS=64).

I don't think we have any plans to workaround libc bugs which have long been fixed (glibc 2.23 was released in 2016). But if you really want to use such old toolchains, maybe projects like fts-standalone interests you.


Also, I think we should remove those ifdefs and define _FILE_OFFSET_BITS 64 unconditionally.

@hgy59 hgy59 closed this as completed Jul 1, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Aug 1, 2023
N-R-K referenced this issue 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.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants