Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 553240 - dev-util/ninja-1.5.1 fails to build on systems with uclibc
Summary: dev-util/ninja-1.5.1 fails to build on systems with uclibc
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Chromium Project
URL:
Whiteboard:
Keywords:
Depends on: 614074
Blocks: uclibc-porting
  Show dependency tree
 
Reported: 2015-06-25 16:46 UTC by Tom Stellard
Modified: 2017-04-30 11:42 UTC (History)
3 users (show)

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


Attachments
loadavg() patch working with uclibc (probably any libc anyway) (ninja-1.6.0-uclibc.patch,1.08 KB, patch)
2015-09-29 18:49 UTC, Sven E.
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Stellard 2015-06-25 16:46:07 UTC
On uclibc systems, ninja fails to compile with the following error:

i686-gentoo-linux-uclibc-g++ -O2 -march=i686 -pipe -Wno-deprecated -DNINJA_PYTHON="/usr/bin/python2.7" -DNI/graphviz.cc src/manifest_parser.cc src/eval_env.cc src/line_printer.cc src/subprocess-posix.cc src/debug_fc src/lexer.cc -o ninja.bootstrap
src/util.cc: In function 'double GetLoadAverage()':
src/util.cc:426:28: error: 'getloadavg' was not declared in this scope
   if (getloadavg(loadavg, 3) < 0) {
                            ^

uclibc does not implement getloadavg like glibc does.  Looking at the ninja source, their use of getloadavg is already guarded by an ifdef, but it assumes this function is always present on Linux.


Reproducible: Always
Comment 1 Mike Gilbert gentoo-dev 2015-06-28 04:34:49 UTC
It seems that uclibc has not gained this function in the 10 years since Mike suggested that a patch would be welcome.

http://lists.busybox.net/pipermail/uclibc/2005-November/033909.html

I would suggest that you write a patch for uclibc, or consult with the developers of ninja upstream on a workaround for this.
Comment 2 Tom Stellard 2015-07-06 03:59:25 UTC
I've filed a bug for this upstream in the ninja project:
https://github.com/martine/ninja/issues/985
Comment 3 Sven E. 2015-09-29 18:49:31 UTC
Created attachment 413284 [details, diff]
loadavg() patch working with uclibc (probably any libc anyway)

The Patch is untested but basically a no frills variant of what glibc does on linux, esp since ninja only uses the first loadavg() value anyway - and ninja ignores errors too
Comment 4 Sven E. 2015-09-29 21:03:15 UTC
(In reply to Sven E. from comment #3)
> Created attachment 413284 [details, diff] [details, diff]
> loadavg() patch working with uclibc (probably any libc anyway)
> 
> The Patch is untested but basically a no frills variant of what glibc does
> on linux, esp since ninja only uses the first loadavg() value anyway - and
> ninja ignores errors too

BTW: Patch is against 1.6 as I ran into the same bug for 1.6.
Comment 5 Anthony Basile gentoo-dev 2016-03-01 11:18:52 UTC
(In reply to Mike Gilbert from comment #1)
> It seems that uclibc has not gained this function in the 10 years since Mike
> suggested that a patch would be welcome.
> 
> http://lists.busybox.net/pipermail/uclibc/2005-November/033909.html
> 
> I would suggest that you write a patch for uclibc, or consult with the
> developers of ninja upstream on a workaround for this.

We do have other functions in uClibc not specified in POSIX or SUSv3.  There are other pkgs making use of getloadavg() so maybe its time to think about its implementation.
Comment 6 Paweł Hajdan, Jr. (RETIRED) gentoo-dev 2017-01-02 10:56:44 UTC
Uploaded https://github.com/ninja-build/ninja/pull/1220 .
Comment 7 Paweł Hajdan, Jr. (RETIRED) gentoo-dev 2017-01-15 18:50:46 UTC
Backported the fix in https://gitweb.gentoo.org/repo/gentoo.git/commit/dev-util/ninja?id=39dfff0ac9b8476c238397d90651d2d4309806e5 .

I'll work on getting 1.7.2 stabilized.
Comment 8 Paweł Hajdan, Jr. (RETIRED) gentoo-dev 2017-04-30 11:42:46 UTC
ninja-1.7.2 is now stable on most arches, closing.