Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 663216 - dev-util/ninja-1.8.2-r1: error: ‘struct stat’ has no member named ‘st_mtimensec’; did you mean ‘st_mtim’? (amd64-fbsd)
Summary: dev-util/ninja-1.8.2-r1: error: ‘struct stat’ has no member named ‘st_mtimens...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All FreeBSD
: Normal normal (vote)
Assignee: Chromium Project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-08-09 09:17 UTC by Michał Górny
Modified: 2019-04-03 19:49 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
dev-util:ninja-1.8.2-r1:20180809-091057.log (dev-util:ninja-1.8.2-r1:20180809-091057.log,11.38 KB, text/plain)
2018-08-09 09:17 UTC, Michał Górny
Details
e-info.txt (e-info.txt,5.09 KB, text/plain)
2018-08-09 09:17 UTC, Michał Górny
Details
ninja-1.8.2-r2 upstream patch (ninja-1.8.2-musl.patch,2.02 KB, patch)
2019-03-04 03:26 UTC, Jory A. Pratt
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-08-09 09:17:04 UTC
Created attachment 542834 [details]
dev-util:ninja-1.8.2-r1:20180809-091057.log

./src/disk_interface.cc: In member function ‘virtual TimeStamp RealDiskInterface::Stat(const string&, std::__cxx11::string*) const’:
./src/disk_interface.cc:216:51: error: ‘struct stat’ has no member named ‘st_mtimensec’; did you mean ‘st_mtim’?
   return (int64_t)st.st_mtime * 1000000000LL + st.st_mtimensec;
                                                   ^~~~~~~~~~~~
                                                   st_mtim
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-08-09 09:17:22 UTC
Created attachment 542836 [details]
e-info.txt
Comment 2 Sven E. 2018-09-04 17:43:52 UTC
I looked into this since someone on IRC ran into this on musl.

The sourcecode used FTMs as a conditional for its own code. That is total bullock of course - FTMs are to be set by the source and used by sys-headers to determine the interface to use.

Upstream really needs to fix the source - snippet:
#if defined(__APPLE__) && !defined(_POSIX_C_SOURCE)
  return ((int64_t)st.st_mtimespec.tv_sec * 1000000000LL +
          st.st_mtimespec.tv_nsec);
#elif (_POSIX_C_SOURCE >= 200809L || _XOPEN_SOURCE >= 700 || defined(_BSD_SOURCE) || defined(_SVID_SOURCE) || \
       defined(__BIONIC__) || (defined (__SVR4) && defined (__sun)))

_POSIX_C_SOURCE, _XOPEN_SOURCE and _BSD_SOURCE are FTMs and may not be used this way.

And since ninja uses C++ _GNU_SOURCE FTM is defined unconditionally by the compiler anyway, so the assumptions made regarding these FTMs are wrong anyway.
Comment 3 Vincent de Phily 2019-01-27 16:17:13 UTC
Upstream bug is https://github.com/ninja-build/ninja/issues/1510

Apparently this is only tied to musl, not to freebsd, as a matrix user reported the same issue on Musl-Linux-amd64.
Comment 4 Marvin 2019-01-27 16:30:42 UTC
This bug appears not only under fbsd but also Linux. It's still present in 1.8.2-r2 and most likely tied to musl as already mentioned.
Comment 5 Jory A. Pratt gentoo-dev 2019-03-04 03:26:57 UTC
Created attachment 567708 [details, diff]
ninja-1.8.2-r2 upstream patch

Fully tested on musl setup
Comment 6 Mike Gilbert gentoo-dev 2019-03-04 03:30:45 UTC
(In reply to Jory A. Pratt from comment #5)

I'm waiting for upstream to actually merge something.
Comment 7 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-03-04 05:05:15 UTC
(In reply to Mike Gilbert from comment #6)
> (In reply to Jory A. Pratt from comment #5)
> 
> I'm waiting for upstream to actually merge something.

That's going to be a one-in-a-lifetime event indeed.
Comment 8 Mike Gilbert gentoo-dev 2019-03-04 14:35:46 UTC
A link to a pull request upstream would suffice.
Comment 9 Larry the Git Cow gentoo-dev 2019-04-03 19:49:59 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b6ab66e96f36dd162edf26463d9fa93c2f3f131e

commit b6ab66e96f36dd162edf26463d9fa93c2f3f131e
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2019-04-03 19:49:49 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2019-04-03 19:49:49 +0000

    dev-util/ninja: fix build on bsd/musl
    
    Closes: https://bugs.gentoo.org/663216
    Package-Manager: Portage-2.3.62_p4, Repoman-2.3.12_p87
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 dev-util/ninja/files/ninja-1.9.0-musl.patch | 39 +++++++++++++++++++++++++++++
 dev-util/ninja/ninja-1.9.0.ebuild           |  6 ++++-
 dev-util/ninja/ninja-9999.ebuild            |  2 +-
 3 files changed, 45 insertions(+), 2 deletions(-)