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

largefile (LFS) issues #829

Closed
glensc opened this issue Oct 13, 2014 · 19 comments
Closed

largefile (LFS) issues #829

glensc opened this issue Oct 13, 2014 · 19 comments
Milestone

Comments

@glensc
Copy link
Contributor

glensc commented Oct 13, 2014

looks like ninja build on 32bit system is not largefile safe:

ninja: error: stat(build/build.o): Value too large for defined data type
ninja: error: stat(build/depfile_parser.o): Value too large for defined data type

the files are residing on 64bit-enabled inode (xfs, inode64 enabled since 2.6.35, see here):

➔ LC_ALL=C ls -li build/build.o build/depfile_parser.o misc/ninja_syntax.py
4846763977 -rw-r--r-- 2 glen users 790700 Oct 14 00:08 build/build.o
4846763974 -rw-r--r-- 2 glen users  58240 Oct 14 00:08 build/depfile_parser.o
4309918606 -rw-r--r-- 1 glen users   5428 Jun 28 02:37 misc/ninja_syntax.py

what's worse, build system does not abort but continues with ignoring such errors:

+ ninja -v
ninja: error: stat(misc/ninja_syntax.py): Value too large for defined data type
[1/26] src/inline.sh kBrowsePy < src/browse.py > build/browse_py.h
[2/26] re2c -b -i --no-generation-date -o src/depfile_parser.cc src/depfile_parser.in.cc
[3/26] re2c -b -i --no-generation-date -o src/lexer.cc src/lexer.in.cc
...
[13/26] ccache i686-pld-linux-g++ -MMD -MT build/eval_env.o -MF build/eval_env.o.d -g -Wall -Wextra -Wno-deprecated -Wno-unused-parameter -fno-rtti -fno-exceptions -fvisibility=hidden -pipe -Wno-missing-field-initializers '-DNINJA_PYTHON="python"' -O2 -DNDEBUG -DUSE_PPOLL -O2 -fwrapv -pipe -Wformat -Werror=format-security -gdwarf-4 -fno-debug-types-section -fvar-tracking-assignments -g2 -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -fomit-frame-pointer -march=i686 -fasynchronous-unwind-tables -mtune=pentium4 -gdwarf-4 -fno-debug-types-section -fvar-tracking-assignments -g2  -c src/eval_env.cc -o build/eval_env.o
ninja: error: stat(build/build.o): Value too large for defined data type  
ninja: error: stat(build/depfile_parser.o): Value too large for defined data type  
[14/26] ccache i686-pld-linux-g++ -MMD -MT build/graph.o -MF build/graph.o.d -g -Wall -Wextra -Wno-deprecated -Wno-unused-parameter -fno-rtti -fno-exceptions -fvisibility=hidden -pipe -Wno-missing-field-initializers '-DNINJA_PYTHON="python"' -O2 -DNDEBUG -DUSE_PPOLL -O2 -fwrapv -pipe -Wformat -Werror=format-security -gdwarf-4 -fno-debug-types-section -fvar-tracking-assignments -g2 -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -fomit-frame-pointer -march=i686 -fasynchronous-unwind-tables -mtune=pentium4 -gdwarf-4 -fno-debug-types-section -fvar-tracking-assignments -g2  -c src/graph.cc -o build/graph.o  
@evmar
Copy link
Collaborator

evmar commented Oct 14, 2014

I have never seen 64-bit inodes before! But it appears they're just part of the newer LFS API? (Ninja doesn't care about file sizes so it's a little confusing that this is part of "largefile" support.)

Upon reading http://www.tcm.phy.cam.ac.uk/sw/inodes64.html , it sounds like it should just work if you compile a 64-bit binary. Are you on a 32-bit system?

@glensc
Copy link
Contributor Author

glensc commented Oct 14, 2014

yes, that is 32bit userspace. for autoconf build systems it's just sufficient to add AC_SYS_LARGEFILE to your configure.ac

@glensc
Copy link
Contributor Author

glensc commented Oct 14, 2014

and no, you should not compile 64bit binary, just need to compile 64bit file access pointers (off_t) on 32bit systems (ix86)

@glensc
Copy link
Contributor Author

glensc commented Oct 14, 2014

if you wish to reproduce this and do not have 1TB filesystem filled with files, you can try method described here: https://bugs.php.net/bug.php?id=68209

@evmar
Copy link
Collaborator

evmar commented Oct 14, 2014

I see, thanks for explaining. (I see you mentioned a 32-bit system in your original report, sorry for missing it.)

According to http://people.redhat.com/berrange/notes/largefile.html we can add -D_LARGEFILE_SOURCE to our compile flags and it should work on systems that support it. Could you try that? You'll need it somewhere around here https://github.com/martine/ninja/blob/master/bootstrap.py#L108 and here https://github.com/martine/ninja/blob/master/configure.py#L146 .

PS for Nico: it appears OSX has a similar 64-bit inode variant, but it's handled more implicitly
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man2/stat64.2.html

@glensc
Copy link
Contributor Author

glensc commented Oct 14, 2014

any ideas about errors not triggering build failure?

@evmar
Copy link
Collaborator

evmar commented Oct 14, 2014

I just opened #830 about that.

@arekm
Copy link

arekm commented Oct 14, 2014

-D_LARGEFILE_SOURCE (stat will be wrapper to stat64) and -D_FILE_OFFSET_BITS=64 (off_t and ino_t will be 64bit) - both are needed. Only _LARGEFILE_SOURCE is not enough. On Linux/glibc at least.

@nico
Copy link
Collaborator

nico commented Oct 26, 2014

(the binaries at https://github.com/martine/ninja/releases are built with LFS support I believe)

@glensc
Copy link
Contributor Author

glensc commented Oct 26, 2014

@nico no, there is no 32bit binary for linux, only 64bit, where the problem doesn't exist. at least for 1.5.1 which seems to be latest

@nico
Copy link
Collaborator

nico commented Oct 26, 2014

Oh right, I remember now not uploading the 32bit binary here since I figured nobody would need it :-) There's one with LFS support at curl https://chromium.googlesource.com/chromium/tools/depot_tools.git/+/master/ninja-linux32?format=TEXT | base64 --decode > ninja32 though, I think.

@nico
Copy link
Collaborator

nico commented Oct 26, 2014

(…and I think just adding -D_FILE_OFFSET_BITS=64 to CFLAGS while running ninja's configure.py is enough if I remember correctly. The commit log of http://src.chromium.org/viewvc/chrome?revision=243436&view=revision supports my memory.)

Is there anything for ninja itself to do here (other than failing when stat() fails, which Evan filed another issue for)?

glensc added a commit to pld-linux/ninja that referenced this issue Oct 26, 2014
@glensc
Copy link
Contributor Author

glensc commented Oct 26, 2014

i think ninja should include both flags as you pointed out yourself. referenced a patch just now

@nico
Copy link
Collaborator

nico commented Oct 26, 2014

It's only needed for 32bit linux though, and I'd think that almost nobody uses that on build machines.

@glensc
Copy link
Contributor Author

glensc commented Oct 26, 2014

well, if it's not in ninja upstream, sooner or later some other linux distro will report it again. unless they find this ticket that you strongly refuse to accept any patch :) i use "it" to build 32bit version of chromium on my linux distro.

@glensc
Copy link
Contributor Author

glensc commented Jun 29, 2017

why this is still not merged?

glensc added a commit to glensc/ninja-build that referenced this issue Jun 29, 2017
glensc added a commit to glensc/ninja-build that referenced this issue Jun 29, 2017
@jackpot51
Copy link

This issue is still present. 32-bit builds are still common for libraries like mesa, which uses ninja and must have 32-bit libraries in order to support 32-bit games.

@MagicalTux
Copy link

I use overlayfs which cause inode numbers to be large (64bits) values, which causes ninja to fail by default when running in 32bits env.

Adding -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 to CFLAGS allowed to have ninja works anyway, but this should probably be fixed in ninja I think (configure.py should detect 32bits env and add the appropriate cflags).

jhasse added a commit that referenced this issue Oct 23, 2022
support 32bit system like i386 (#829)
@vcunat
Copy link

vcunat commented Mar 21, 2023

Probably fixed by #2203
but it would be nice to release it.

@jhasse jhasse added this to the 1.12.0 milestone Mar 21, 2023
@jhasse jhasse closed this as completed Mar 21, 2023
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

No branches or pull requests

8 participants