Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 205576 - sys-power/cpufrequtils fails to compile against uclibc
Summary: sys-power/cpufrequtils fails to compile against uclibc
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Embedded Gentoo Team
Depends on:
Reported: 2008-01-13 11:07 UTC by
Modified: 2011-08-14 03:07 UTC (History)
1 user (show)

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

Realy disable NLS (cpufrequtils-002-nls.patch,2.48 KB, patch)
2008-03-13 12:54 UTC, Sergey Dryabzhinsky
Details | Diff
Without garbage (cpufrequtils-002-nls.patch,1.86 KB, patch)
2008-03-16 09:47 UTC, Sergey Dryabzhinsky
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description 2008-01-13 11:07:27 UTC
I'm building a small (~70MB) Gentoo Linux setup using uclibc for my Nagasaki MS-2100, a miniature PC (once used as a wifi AP by a local ISP) with a Geode GX1 processor. To my surprise, the thing turns out to be capable of frequency scaling using the gx-suspmod driver.

However, unfortunately cpufrequtils fails to build in my uclibc development environment. I'm suspecting it's because it tries to use internationalization code even though the nls flag is (forced) off.

Reproducible: Always

Steps to Reproduce:
1. chroot into uclibc build environment (made using stage3-x86-uclibc-2006.1)
2. emerge cpufrequtils

Actual Results:  
The ebuild fails as follows:

 * Messages for package sys-power/cpufrequtils-002-r3:

 * ERROR: sys-power/cpufrequtils-002-r3 failed.
 * Call stack:
 *          , line 1701:  Called dyn_compile
 *          , line 1039:  Called qa_call 'src_compile'
 *          , line   44:  Called src_compile
 *   cpufrequtils-002-r3.ebuild, line   32:  Called die
 * The specific snippet of code:
 *      emake V=true DEBUG=${debug} NLS=${nls} \
 *              CC=$(tc-getCC) LD=$(tc-getCC) AR=$(tc-getAR) STRIP=echo RANLIB=$(tc-getRANLIB) \
 *              || die "emake failed"
 *  The die message:
 *   emake failed
 * If you need support, post the topmost build error, and the call stack if relevant.
 * A complete build log is located at '/var/tmp/portage/sys-power/cpufrequtils-002-r3/temp/build.log'.

Looking further in the log, I see the following. It looks to me like it expects libintl to be there, but it isn't because I use uclibc with no internationalization code.

utils/info.c:13:21: error: libintl.h: No such file or directory
utils/set.c:15:21: error: libintl.h: No such file or directory
utils/info.c: In function 'count_cpus':
utils/info.c:36: warning: implicit declaration of function 'gettext'
utils/info.c:36: warning: incompatible implicit declaration of built-in function 'gettext'
utils/set.c: In function 'print_header':
utils/set.c:30: warning: implicit declaration of function 'gettext'
utils/set.c:30: warning: incompatible implicit declaration of built-in function 'gettext'
utils/set.c: In function 'print_help':
utils/set.c:34: warning: incompatible implicit declaration of built-in function 'gettext'
utils/info.c: In function 'proc_cpufreq_output':
utils/info.c:67: warning: incompatible implicit declaration of built-in function 'gettext'
utils/set.c: In function 'print_unknown_arg':
utils/set.c:79: warning: incompatible implicit declaration of built-in function 'gettext'
utils/info.c: In function 'debug_output_one':
utils/info.c:125: warning: incompatible implicit declaration of built-in function 'gettext'
(And so on, there are ton of warnings about gettext like these.)

Expected Results:  
Cpufrequtils should have compiled normally.

Portage (uclibc/x86/2005.1, gcc-4.1.2, uclibc-, 2.6.23-gentoo-r3 i686)
System uname: 2.6.23-gentoo-r3 i686 unknown
Timestamp of tree: Sun, 13 Jan 2008 01:16:01 +0000
app-shells/bash:     3.2_p17-r1
dev-lang/python:     2.4.4-r6
dev-python/pycrypto: 2.0.1-r6
sys-apps/baselayout: 1.12.10-r5
sys-devel/autoconf:  2.61-r1
sys-devel/automake:  1.4_p6, 1.10
sys-devel/binutils:  2.18-r1
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.24
virtual/os-headers:  2.6.23-r3
CFLAGS="-Os -march=pentium-mmx -fomit-frame-pointer -pipe"
CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/revdep-rebuild /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-Os -march=pentium-mmx -fomit-frame-pointer -pipe"
FEATURES="autoconfig buildpkg distlocks metadata-transfer nodoc noinfo noman sandbox sfperms strict unmerge-orphans userfetch userpriv"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
USE="bitmap-fonts cli cracklib dri midi minimal mmx mudflap ncurses openmp pcre readline reflection session spl truetype-fonts type1-fonts uclibc x86 xorg zlib" ALSA_CARDS="none" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="uclibc" INPUT_DEVICES="none" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="none"
Comment 1 solar (RETIRED) gentoo-dev 2008-01-14 05:39:35 UTC
try this.

uClibc foobar # cat /usr/include/libintl.h 
#ifndef _LIBINTL_H
#define _LIBINTL_H      1

#include <features.h>

/* Stubs for gettext/locale bullshit... */

#undef gettext
#undef dgettext
#undef dcgettext
#undef ngettext
#undef dngettext
#undef dcngettext
#undef textdomain
#undef bindtextdomain
#undef bind_textdomain_codeset
/* this fucker seems to be installed  in /usr/include/locale.h */
/* #undef setlocale */
#undef _
#undef N_

#define gettext(String) (String)
#define dgettext(Domain, String) (String)
#define dcgettext(Domain, String, Type) (String)
#define ngettext(msgid1, msgid2, n) (msgid1)
#define dngettext(Domain, msgid1, msgid2, n) (Domain)
#define dcngettext(Domain, msgid1, msgid2, n, Category) (Domain)
#define dgettext(Domain, String) (String)
#define dcgettext(Domain, String, Type) (String)

#ifndef _LOCALE_H
/* #define setlocale(Category, Locale) ((char *)NULL) */
#define bindtextdomain(Domain, Directory) (Domain)
#define bind_textdomain_codeset(Domain, Codeset)
#define textdomain(String)

#define _(String) (String)
#define N_(String) (String)

Comment 2 2008-01-14 09:33:53 UTC
That seems to have done the trick, although it causes some weird warnings when compiling the kernel. But at least cpufrequtils compiles now.
Comment 3 solar (RETIRED) gentoo-dev 2008-01-14 16:46:17 UTC
Move the file out of the way when not needed. 
It will cause false detection of nls related things. 
Those stub functions are suited to become something that an eclass takes 
care of some day.
Comment 4 Sergey Dryabzhinsky 2008-03-13 12:54:42 UTC
Created attachment 145993 [details, diff]
Realy disable NLS

Patch add:
1. Definition NLS to CFLAGS
2. Wrappers on gettext which do nothing if NLS not defined.
Comment 5 Sergey Dryabzhinsky 2008-03-16 09:47:06 UTC
Created attachment 146273 [details, diff]
Without garbage

Sorry for garbage in previous patch
Comment 6 SpanKY gentoo-dev 2008-10-21 21:20:49 UTC
ive merged your fix in 005-r1 ... thanks!
Comment 7 Matt Turner gentoo-dev 2011-08-14 03:07:26 UTC
This patch listed incorrect authorship in portage. I've fixed that and I also sent the patch upstream for inclusion into cpufrequtils. Thanks again.