Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 299316 - sys-process/psmisc-22.9 fails to compile
Summary: sys-process/psmisc-22.9 fails to compile
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL: http://sourceforge.net/tracker/?func=...
Whiteboard:
Keywords:
Depends on:
Blocks: 319559
  Show dependency tree
 
Reported: 2010-01-02 11:28 UTC by Philipp
Modified: 2010-05-14 16:13 UTC (History)
0 users

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


Attachments
Patch to fix the problem (locale-include.patch,264 bytes, patch)
2010-01-02 11:30 UTC, Philipp
Details | Diff
psmisc-22.9-locale.patch (psmisc-22.9-locale.patch,463 bytes, patch)
2010-01-02 13:21 UTC, Samuli Suominen (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Philipp 2010-01-02 11:28:57 UTC
killall.c: In function 'uptime':
killall.c:132: warning: implicit declaration of function 'setlocale'
killall.c:132: error: 'LC_NUMERIC' undeclared (first use in this function)
killall.c:132: error: (Each undeclared identifier is reported only once
killall.c:132: error: for each function it appears in.)

The file clearly misses #include <locale.h>. I believe this problem can only be seen with >=gcc-4.4 as the headers are even more minimal than those of earlier versions.
Comment 1 Philipp 2010-01-02 11:30:01 UTC
Created attachment 214910 [details, diff]
Patch to fix the problem
Comment 2 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2010-01-02 12:13:56 UTC
You know that psmisc-22.9 is p.masked because of bug #297423?
Comment 3 Diego Elio Pettenò (RETIRED) gentoo-dev 2010-01-02 12:54:27 UTC
If you're using -O0, glibc will not include locale.h for you…

OTOH uclibc might require a test HAVE_LOCALE_H to put it under conditional. Given that there is already code that calls setlocale() you should look for the same conditional here, rather than adding a new one.
Comment 4 Samuli Suominen (RETIRED) gentoo-dev 2010-01-02 13:21:21 UTC
Created attachment 214924 [details, diff]
psmisc-22.9-locale.patch

Include locale.h only if it's required and found.

Try this.
Comment 5 Samuli Suominen (RETIRED) gentoo-dev 2010-01-02 13:30:16 UTC
(In reply to comment #4)
> Created an attachment (id=214924) [details]
> psmisc-22.9-locale.patch

Or perhaps that's too much, just 

#ifdef HAVE_LOCALE_H
#include <locale.h>
#endif

should be enough
Comment 6 Diego Elio Pettenò (RETIRED) gentoo-dev 2010-01-02 13:56:43 UTC
Is HAVE_LOCALE_H already handled by autotools? In general if you have setlocale() you also have locale.h (they are both mandated by C99 standard), so the logic in the patch seem to be inverted.
Comment 7 Samuli Suominen (RETIRED) gentoo-dev 2010-01-02 14:16:34 UTC
(In reply to comment #6)
> Is HAVE_LOCALE_H already handled by autotools? In general if you have
> setlocale() you also have locale.h (they are both mandated by C99 standard), so
> the logic in the patch seem to be inverted.
> 

Yep, configure.ac has AC_CHECK_HEADERS for locale.h and AC_CHECK_FUNCS for setlocale, so both are available in config.h{,.in}
Comment 8 Diego Elio Pettenò (RETIRED) gentoo-dev 2010-01-02 14:17:52 UTC
Then the short alternative is fine ;)
Comment 9 Samuli Suominen (RETIRED) gentoo-dev 2010-01-02 14:25:08 UTC
thanks diego ;)

+  02 Jan 2010; Samuli Suominen <ssuominen@gentoo.org> psmisc-22.9.ebuild,
+  +files/psmisc-22.9-locale.patch:
+  Fix building with -O0 where glibc doesn't include locale.h by itself wrt
+  #299316.