Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 270767 - mipsel-unknown-linux-uclibc-g++ unable to compile c++ code
Summary: mipsel-unknown-linux-uclibc-g++ unable to compile c++ code
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal with 1 vote (vote)
Assignee: Embedded Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-21 21:08 UTC by zabuzzman
Modified: 2009-07-03 05:43 UTC (History)
1 user (show)

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


Attachments
eclass/toolchain.eclass patch (toolchain.eclass-patch,694 bytes, patch)
2009-05-23 23:45 UTC, zabuzzman
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description zabuzzman 2009-05-21 21:08:27 UTC
An error is generated on the C++ code of ncurses:

# ./xemerge.sh  coreutils
Calculating dependencies... done!

>>> Verifying ebuild manifests

>>> Starting parallel fetch

>>> Emerging (1 of 2) sys-libs/ncurses-5.7 for /usr/mipsel-unknown-linux-uclibc/
 * ncurses-5.7.tar.gz RMD160 SHA1 SHA256 size ;-) ...                                                                             
a - ../obj_s/cursslk.o
a - ../obj_s/cursesapp.o
a - ../obj_s/cursesmain.o
mipsel-unknown-linux-uclibc-ranlib ../lib/libncurses++.a
mipsel-unknown-linux-uclibc-g++  -o demo ../obj_s/demo.o -L../lib -lncurses++ -L../lib -lform -lmenu -lpanel -lncurses    -Wl,-O1 -Wl,-rpath,/var/tmp/portage/sys-libs/ncurses-5.7/work/narrowc/lib  -I../c++ -I../include -I/var/tmp/portage/sys-libs/ncurses-5.7/work/ncurses-5.7/c++ -DHAVE_CONFIG_H -I/var/tmp/portage/sys-libs/ncurses-5.7/work/ncurses-5.7/c++/../include -I. -I../include  -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64  -DXTSTRINGDEFINES -DNDEBUG -Os -pipe -W -Wall -Wabi -fabi-version=0 -Woverloaded-virtual -Wsign-promo -Wsynth -Wold-style-cast -Wcast-align -Wcast-qual -Wpointer-arith -Wshadow -Wundef -Wwrite-strings -Weffc++ -Wno-unused -fPIC 
/usr/lib/gcc/mipsel-unknown-linux-uclibc/4.4.0/libstdc++.so: undefined reference to `__tls_get_addr'
/usr/libexec/gcc/mipsel-unknown-linux-uclibc/ld: warning: creating a DT_TEXTREL in object.
collect2: ld returned 1 exit status
make[1]: *** [demo] Error 1
make[1]: Leaving directory `/var/tmp/portage/sys-libs/ncurses-5.7/work/narrowc/c++'
make: *** [all] Error 2
Comment 1 zabuzzman 2009-05-21 21:09:15 UTC
Portage 2.1.6.11 (uclibc/mips, gcc-4.4.0, unavailable, 2.6.29-gentoo-r3 i686)
=================================================================
System uname: Linux-2.6.29-gentoo-r3-i686-Intel-R-_Core-TM-2_Duo_CPU_T7100_@_1.80GHz-with-glibc2.0
Timestamp of tree: Thu, 21 May 2009 18:45:01 +0000
distcc 3.0 i686-pc-linux-gnu [disabled]
app-shells/bash:     3.2_p39
dev-java/java-config: 2.1.7
dev-lang/python:     2.5.4-r2
dev-python/pycrypto: 2.0.1-r8
dev-util/cmake:      2.6.2-r1
sys-apps/baselayout: 1.12.11.1
sys-apps/sandbox:    1.6-r2
sys-devel/autoconf:  2.13, 2.63
sys-devel/automake:  1.5, 1.6.3, 1.7.9-r1, 1.9.6-r2, 1.10.2
sys-devel/binutils:  2.18-r3
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.27-r2
ACCEPT_KEYWORDS="mips ~mips"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-Os -pipe"
CHOST="mipsel-unknown-linux-uclibc"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf"
CXXFLAGS="-Os -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks fixpackages nodoc noinfo noman parallel-fetch protect-owned sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
LANG="C"
LDFLAGS="-Wl,-O1"
MAKEOPTS="-j4"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/usr/mipsel-unknown-linux-uclibc/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="minimal mips uclibc" 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 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="keyboard" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="dummy fbdev v4l"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
Comment 2 zabuzzman 2009-05-23 19:14:37 UTC
Actually the environment created by "crossdev --target mipsel-unknown-linux-uclibc" is not able to compile c++ code whatsoever:

# echo "main() { return 0; }" > nothing.cpp 
# mipsel-unknown-linux-uclibc-g++ ./nothing.cpp 
/usr/lib/gcc/mipsel-unknown-linux-uclibc/4.4.0/libstdc++.so: undefined reference to `__tls_get_addr'
/usr/libexec/gcc/mipsel-unknown-linux-uclibc/ld: warning: creating a DT_TEXTREL in object.
collect2: ld returned 1 exit status
Comment 3 zabuzzman 2009-05-23 23:45:05 UTC
Created attachment 192247 [details, diff]
eclass/toolchain.eclass patch

Builds gcc with --disable-tls for all *-uclibc CTARGETs (assuming that is the right choice)
Comment 4 Mike Auty (RETIRED) gentoo-dev 2009-05-25 15:02:43 UTC
This appears to be a known issue with tls and uclibc (see bug 204102).  I don't believe the toolchain folks want to push --disable-tls on every ebuild (since that wasn't the solution selected for the other bug).  Unfortunately I can't tell whether this is an issue with ncurses or with stdc++ and hence gcc (which seems to be the one with the undefined reference).

I'm going to assign it to the Embedded team for now, but if this turns out to be an ncurses specific problem, then feel free to reassign it to them...
Comment 5 zabuzzman 2009-05-26 20:09:42 UTC
There are similarities, but its not really the same bug, nor is it ncurses specific. 

gcc is built with --enable-tls by default, although uclibc doesn't support this. This avoids any c++ to be compiled by the mipsel-unknown-linux-uclibc-g++ generated by crossdev.

The supplied patch adds --disable-tls only when building gcc for uclibc targets.
Comment 6 SpanKY gentoo-dev 2009-07-03 05:43:52 UTC
for uClibc w/out NPTL, this is correct.  but for NPTL users, we dont want to block them.  ive leveraged the NPTL USE flag instead.

http://sources.gentoo.org/eclass/toolchain.eclass?r1=1.400&r2=1.401