Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 431676 - sys-libs/glibc-2.15-r2: <bits/syscall.h> uses the wrong value when testing for mips n32 abi. Causes sys-fs/udev-188 build fail.
Summary: sys-libs/glibc-2.15-r2: <bits/syscall.h> uses the wrong value when testing fo...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: MIPS Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 430346
  Show dependency tree
 
Reported: 2012-08-16 19:23 UTC by Jim Faulkner
Modified: 2012-08-22 23:02 UTC (History)
1 user (show)

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


Attachments
patch to fix typo (0001-Fix-typo-in-MIPS-abi-n32-condition.patch,1.58 KB, patch)
2012-08-22 19:04 UTC, Matt Turner
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jim Faulkner 2012-08-16 19:23:31 UTC
sys-fs/udev-188 won't build on my MIPS n32 system:

  CC       src/libudev/libudev_private_la-libudev-device.lo
  CC       src/libudev/libudev_private_la-libudev-enumerate.lo
  CC       src/libudev/libudev_private_la-libudev-monitor.lo
src/libudev/libudev-monitor.c: In function 'udev_monitor_receive_device':
src/libudev/libudev-monitor.c:572:16: warning: cast increases required alignment of target type [-Wcast-align]
src/libudev/libudev-monitor.c:580:23: warning: cast increases required alignment of target type [-Wcast-align]
  CC       src/libudev/libudev_private_la-libudev-queue.lo
  CC       src/libudev/libudev_private_la-libudev-device-private.lo
  CC       src/libudev/libudev_private_la-libudev-queue-private.lo
  CC       src/shared/util.lo
In file included from src/shared/util.c:63:0:
src/shared/missing.h: In function 'pivot_root':
src/shared/missing.h:87:24: error: 'SYS_pivot_root' undeclared (first use in this function)
src/shared/missing.h:87:24: note: each undeclared identifier is reported only once for each function it appears in
src/shared/missing.h: In function 'gettid':
src/shared/missing.h:179:32: error: 'SYS_gettid' undeclared (first use in this function)
src/shared/util.c: In function 'acquire_terminal':
src/shared/util.c:2500:29: warning: cast increases required alignment of target type [-Wcast-align]
src/shared/util.c:2513:37: warning: cast increases required alignment of target type [-Wcast-align]
src/shared/util.c: In function 'rm_rf_children':
src/shared/util.c:3380:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
src/shared/util.c: In function 'rm_rf_internal':
src/shared/util.c:3414:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
src/shared/util.c:3434:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
src/shared/util.c: In function 'in_initrd':
src/shared/util.c:5877:54: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
src/shared/util.c: In function 'gettid':
src/shared/missing.h:180:1: warning: control reaches end of non-void function [-Wreturn-type]
make: *** [src/shared/util.lo] Error 1
 * ERROR: sys-fs/udev-188 failed (compile phase):
 *   emake failed
 * 
 * If you need support, post the output of `emerge --info '=sys-fs/udev-188'`,
 * the complete build log and the output of `emerge -pqv '=sys-fs/udev-188'`.
 * The complete build log is located at '/var/tmp/portage/sys-fs/udev-188/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/sys-fs/udev-188/temp/environment'.
 * Working directory: '/var/tmp/portage/sys-fs/udev-188/work/systemd-188'
 * S: '/var/tmp/portage/sys-fs/udev-188/work/systemd-188'

Reproducible: Always




flummox ~ # emerge --info
Portage 2.1.11.10 (default/linux/mips/10.0/multilib/n32, gcc-4.6.3, glibc-2.15-r2, 3.2.27 mips64)
=================================================================
System uname: Linux-3.2.27-mips64-R5000_V2.1_FPU_V1.0-with-gentoo-2.1
Timestamp of tree: Thu, 16 Aug 2012 12:15:01 +0000
app-shells/bash:          4.2_p37
dev-lang/python:          2.7.3-r2, 3.2.3-r1
dev-util/pkgconfig:       0.27
sys-apps/baselayout:      2.1-r1
sys-apps/openrc:          0.10.5
sys-apps/sandbox:         2.6
sys-devel/autoconf:       2.69
sys-devel/automake:       1.11.6
sys-devel/binutils:       2.22.90
sys-devel/gcc:            4.6.3
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r3
sys-kernel/linux-headers: 3.5 (virtual/os-headers)
sys-libs/glibc:           2.15-r2
Repositories: gentoo
ACCEPT_KEYWORDS="mips ~mips"
ACCEPT_LICENSE="* -@EULA"
CBUILD="mips64-unknown-linux-gnu"
CFLAGS="-Os -march=r5000 -fomit-frame-pointer"
CHOST="mips64-unknown-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-Os -march=r5000 -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-Os -march=r5000 -fomit-frame-pointer"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles news parallel-fetch parse-eapi-ebuild-head protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS="-Os -march=r5000 -fomit-frame-pointer"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j1"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://jove.eng.yale.edu/gentoo-portage"
USE="berkdb bzip2 cli cracklib crypt cups cxx device-mapper gdbm gpm iconv ipv6 lzma memlimit mips modules mudflap multilib ncurses nls nptl offensive pam pcre pppd readline session ssl tcpd unicode zlib" ALSA_CARDS="au1x00" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul 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 cgi cgid 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" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" PHP_TARGETS="php5-3" PYTHON_TARGETS="python2_7" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="fbdev impact newport dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 1 William Hubbs gentoo-dev 2012-08-22 16:17:53 UTC
Mips team,

Do you have any suggestions for this?
Comment 2 Matt Turner gentoo-dev 2012-08-22 16:30:07 UTC
I'm not really available for mips stuff at the moment, but my first reaction is to update linux-headers and failing that, glibc.
Comment 3 Anthony Basile gentoo-dev 2012-08-22 18:39:46 UTC
(In reply to comment #2)
> I'm not really available for mips stuff at the moment, but my first reaction
> is to update linux-headers and failing that, glibc.

This is confusing to me, I not sure why its failing.  Here's what's going on:

1) we need to get SYS_pivot_root and SYS_gettid into src/shared/missing.h and they're not getting there.

2) trace through the includes for where these #defines come from:

    src/shared/missing.h

include

    <sys/syscall.h>

which includes

    <asm/unistd.h>     provides #define __NR_pivot_root  (__NR_Linux + 151)
    <bits/syscall.h>   provides #define SYS_pivot_root __NR_pivot_root

3) asm/unistd.h provides three definitions for __NR_pivot_root, one for o32, another for n64 and the final one for n32.  In that order.

4) We want n32, this is triggered by:

    #if _MIPS_SIM == _MIPS_SIM_NABI32

This is actually succeeding (just add a #warning "HERE").

5) In the #if of step 4 we have

#define __NR_Linux                      6000
...
#define __NR_pivot_root                 (__NR_Linux + 151)

6) So all the pieces are there but it still fails.  I'm confused.

And yes I counted the number of leading underscores!  I must be missing something.
Comment 4 Anthony Basile gentoo-dev 2012-08-22 18:48:24 UTC
Okay I got it, its a typo in /usr/include/bits/syscall.h.  Line 367 has

    #if _MIPS_SIM == _MIPS_SIM_ABIN32

as the test for n32, but, it should be

    #if _MIPS_SIM == _MIPS_SIM_NABI32

as it is in <asm/unistd.h>.  If you change that line, then this bug is gone.  I do hit another one:

  CCLD     libsystemd-id128-internal.la
  CCLD     libsystemd-journal.la
  CC       src/shared/libsystemd_dbus_la-dbus-common.lo
src/shared/dbus-common.c:28:23: fatal error: dbus/dbus.h: No such file or directory
compilation terminated.
make[2]: *** [src/shared/libsystemd_dbus_la-dbus-common.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

but that's a different issue.  I'll open a bug if it isn't some artifact of my hacking.

Changing the summary from:

sys-fs/udev-188 on MIPS n32 - In file included from src/shared/util.c:63:0: src/shared/missing.h: In function 'pivot_root': src/shared/missing.h:87:24: error: 'SYS_pivot_root' undeclared (first use in this function)

to

sys-libs/glibc-2.15-r2: <bits/syscall.h> uses the wrong values when testing for mips n32 abi.  Causes sys-fs/udev-188 build fail.
Comment 5 Anthony Basile gentoo-dev 2012-08-22 18:53:45 UTC
(In reply to comment #4)
> Okay I got it, its a typo in /usr/include/bits/syscall.h.  Line 367 has
> 
>     #if _MIPS_SIM == _MIPS_SIM_ABIN32
> 
> as the test for n32, but, it should be
> 
>     #if _MIPS_SIM == _MIPS_SIM_NABI32
> 

Just to be clear, here it is as a trivial patch which I'll just inline:

--- /usr/include/bits/syscall.h.orig	2012-08-22 18:49:35.000000000 +0000
+++ /usr/include/bits/syscall.h	2012-08-22 18:49:43.000000000 +0000
@@ -364,7 +364,7 @@
 #define SYS_write __NR_write
 #define SYS_writev __NR_writev
 #endif
-#if _MIPS_SIM == _MIPS_SIM_ABIN32
+#if _MIPS_SIM == _MIPS_SIM_NABI32
 #define SYS_64_Linux __NR_64_Linux
 #define SYS_64_Linux_syscalls __NR_64_Linux_syscalls
 #define SYS_Linux __NR_Linux
Comment 6 SpanKY gentoo-dev 2012-08-22 19:02:46 UTC
already fixed in glibc-2.16.  here's the fix we can apply to 2.15:
http://sourceware.org/git/?p=glibc.git;a=commit;h=12139ca306df26046c14c98c6dc13bd15d3071a2
Comment 7 Matt Turner gentoo-dev 2012-08-22 19:04:08 UTC
Created attachment 321970 [details, diff]
patch to fix typo

(In reply to comment #5)
> (In reply to comment #4)
> > Okay I got it, its a typo in /usr/include/bits/syscall.h.  Line 367 has
> > 
> >     #if _MIPS_SIM == _MIPS_SIM_ABIN32
> > 
> > as the test for n32, but, it should be
> > 
> >     #if _MIPS_SIM == _MIPS_SIM_NABI32

Nice. Already fixed upstream by the attached patch.
Comment 8 Anthony Basile gentoo-dev 2012-08-22 19:13:03 UTC
>   CCLD     libsystemd-id128-internal.la
>   CCLD     libsystemd-journal.la
>   CC       src/shared/libsystemd_dbus_la-dbus-common.lo
> src/shared/dbus-common.c:28:23: fatal error: dbus/dbus.h: No such file or
> directory
> compilation terminated.
> make[2]: *** [src/shared/libsystemd_dbus_la-dbus-common.lo] Error 1
> make[1]: *** [all-recursive] Error 1
> make: *** [all] Error 2
> 

This "second" issue was just and artifact of what I was doing as I was debugging this bug.  Once bits/syscall.h is fixed, udev-188 builds and works fine.  Its running on my lemote yeeloong now.
Comment 10 SpanKY gentoo-dev 2012-08-22 23:02:50 UTC
should be all set now in the tree; thanks for the report!

Commit message: Add fix from upstream for typo in mips n32 define
http://sources.gentoo.org/sys-libs/glibc/glibc-2.15-r2.ebuild?r1=1.20&r2=1.21