Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 361779 - cross-sparc-unknown-linux-gnu/glibc does not set CC correctly when cross-compiling
Summary: cross-sparc-unknown-linux-gnu/glibc does not set CC correctly when cross-comp...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
: 379787 388779 513848 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-04-03 11:13 UTC by Alex Buell
Modified: 2016-01-16 09:49 UTC (History)
6 users (show)

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


Attachments
cross-sparc-unknown-linux-gnu-info.log (cross-sparc-unknown-linux-gnu-info.log,16.27 KB, text/plain)
2011-04-03 11:14 UTC, Alex Buell
Details
cross-sparc-unknown-linux-gnu-glibc.log (cross-sparc-unknown-linux-gnu-glibc.log,15.67 KB, text/plain)
2011-04-03 11:15 UTC, Alex Buell
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Buell 2011-04-03 11:13:19 UTC
# crossdev -S sparc
------------------------------------------------------------------------------------------------------------------------------------
 * crossdev version:      20110310
 * Host Portage ARCH:     x86
 * Target Portage ARCH:   sparc
 * Target System:         sparc-unknown-linux-gnu
 * Stage:                 4 (C/C++ compiler)
 * ABIs:                  default

 * binutils:              binutils-[stable]
 * gcc:                   gcc-[stable]
 * headers:               linux-headers-[stable]
 * libc:                  glibc-[stable]

 * PORTDIR_OVERLAY:       /var/lib/layman
 * PORT_LOGDIR:           /var/log/portage
 * PORTAGE_CONFIGROOT:    
  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -  _  -  ~  -
 * Forcing the latest versions of {binutils,gcc}-config/gnuconfig ...                                                         [ ok ]
 * Log: /var/log/portage/cross-sparc-unknown-linux-gnu-binutils.log
 * Emerging cross-binutils ...                                                                                                [ ok ]
 * Log: /var/log/portage/cross-sparc-unknown-linux-gnu-linux-headers-quick.log
 * Emerging cross-linux-headers-quick ...                                                                                     [ ok ]
 * Log: /var/log/portage/cross-sparc-unknown-linux-gnu-glibc-headers.log
 * Emerging cross-glibc-headers ...                                                                                           [ ok ]
 * Log: /var/log/portage/cross-sparc-unknown-linux-gnu-gcc-stage1.log
 * Emerging cross-gcc-stage1 ...                                                                                              [ ok ]
 * Log: /var/log/portage/cross-sparc-unknown-linux-gnu-linux-headers.log
 * Emerging cross-linux-headers ...                                                                                           [ ok ]
 * Log: /var/log/portage/cross-sparc-unknown-linux-gnu-glibc.log
 * Emerging cross-glibc ...

 * glibc failed :(
 * If you file a bug, please attach the following logfiles:
 * /var/log/portage/cross-sparc-unknown-linux-gnu-info.log
 * /var/log/portage/cross-sparc-unknown-linux-gnu-glibc.log
Comment 1 Alex Buell 2011-04-03 11:14:35 UTC
Created attachment 268311 [details]
cross-sparc-unknown-linux-gnu-info.log
Comment 2 Alex Buell 2011-04-03 11:15:06 UTC
Created attachment 268315 [details]
cross-sparc-unknown-linux-gnu-glibc.log
Comment 3 Alex Buell 2011-04-03 11:17:32 UTC
Looking through the logs, I just saw this:

checking for sparcv9-unknown-linux-gnu-gcc... (cached) i686-pc-linux-gnu-gcc 
checking version of i686-pc-linux-gnu-gcc ... 4.4.5, ok

also,

checking whether i686-pc-linux-gnu-gcc  -pipe -ggdb -fcall-used-g6 -O2 -fno-strict-aliasing -fno-unwind-tables supports -mlong-double-128... no
configure: error: this configuration requires -mlong-double-128 support
 * ERROR: cross-sparc-unknown-linux-gnu/glibc-2.11.3 failed (compile phase):

Seems it thinks I'm building a multilibbed gcc on 32bit x86?

I'm sure this might be related to the failures to build 32bit x86 stage2 g++ on SPARC?
Comment 4 SpanKY gentoo-dev 2011-04-04 15:56:27 UTC
is your tree up-to-date ?  this issue should already be fixed
Comment 5 Alex Buell 2011-04-04 20:00:36 UTC
I'm afraid not, with a fresh sync of the tree, and a crossdev -C sparc, then reran crossdev -S sparc. Same error. :(
Comment 6 SpanKY gentoo-dev 2011-04-15 15:56:16 UTC
seems to be due to the wonky CTARGET_OPT munging that is done specifically for sparc targets.
Comment 7 seraph@xs4all.nl 2011-05-22 20:31:43 UTC
This issue seems to be unresolved still, crossdev still cannot build any glibc for sparc or sparc64 targets. It seems like the compiler confusion is indeed the cause for this.

I have found the following work-around:


1. Start your toolchain build with crossdev as normal.

2. After crossdev fails to build glibc, run this command to properly build glibc for your target:

env CC=<your target compiler> HOSTCC=<your native compiler> emerge --resume

Example: env CC=sparc-unknown-linux-gnu-gcc HOSTCC=x86_64-pc-linux-gnu-gcc emerge --resume

3. Run crossdev again to build the final gcc compiler and finish the toolchain.
Comment 8 Alex Buell 2011-05-23 06:45:21 UTC
THanks, that has now got the sparc cross compiler working again on x86. Now if I can get the x86 cross compiler working on sparc...

Much appreciated.
Comment 9 Kim B. Sindalsen 2011-06-16 15:14:43 UTC
Just ran into this problem now when trying to upgrade to 2.12.26 on a stable x86-system (haven't encountered any problems upgrading during the previous last six months though when I setup this system...).
Comment 10 Kim B. Sindalsen 2011-06-17 15:52:30 UTC
(In reply to comment #9)
> Just ran into this problem now when trying to upgrade to 2.12.26 on a stable
> x86-system (haven't encountered any problems upgrading during the previous last
> six months though when I setup this system...).´

Don't know where that last 6 came from.... it should be 2.12.2 only ofcourse ;)

And manually setting the CC and HOSTCC seems to work fine.
Comment 11 SpanKY gentoo-dev 2011-08-21 16:31:23 UTC
*** Bug 379787 has been marked as a duplicate of this bug. ***
Comment 12 Alex Buell 2011-10-27 23:07:50 UTC
This problem is also present on AMD64 platforms.
Comment 13 SpanKY gentoo-dev 2011-10-27 23:23:41 UTC
i don't think it does.  if you have evidence of the contrary, please file a new bug report with full logs/info attached.
Comment 14 seraph@xs4all.nl 2011-10-28 05:43:03 UTC
The bug is specific to having sparc as a target for crossdev. It doesn't matter what the host is, I've seen the problem on x86-, amd64- and powerpc hosts.
Comment 15 SpanKY gentoo-dev 2011-10-28 06:21:30 UTC
yes, CHOST does not matter, only CTARGET (sparc*)
Comment 16 Alex Buell 2011-10-28 14:51:12 UTC
Bug report has been filed for SPARC target on AMD64.
Comment 17 SpanKY gentoo-dev 2011-11-01 16:12:47 UTC
*** Bug 388779 has been marked as a duplicate of this bug. ***
Comment 18 Sergei Trofimovich (RETIRED) gentoo-dev 2012-10-14 11:07:00 UTC
Similar bug here.

Due to #397449 had to force an ABI:

    crossdev -A default sparc-unknown-linux-gnu

glibc fails here as:

    configure: error: linker with -z relro support required
     * ERROR: cross-sparc-unknown-linux-gnu/glibc-2.15-r3 failed (compile phase):
     *   failed to configure glibc

It's config.log is quite clear (note the --host v9 skew):
(comes from gentoo-x86/sys-libs/glibc/files/eblits/common.eblit)

    setup_target_flags() {
    ...
     case $(tc-arch) in

      sparc)
    ...
        elif { is_crosscompile && want_nptl; } || ...; then
            CTARGET_OPT="sparcv9-unknown-linux-gnu"
        fi

      $ /subvolumes/var_tmp/portage/cross-sparc-unknown-linux-gnu/glibc-2.15-r3/work/glibc-2.15/configure --disable-stackguard-rand
omization --enable-add-ons=nptl,c_stubs,libidn,ports --enable-kernel=2.6.9 --without-selinux --without-cvs --enable-bind-now --
build=x86_64-pc-linux-gnu --host=sparcv9-unknown-linux-gnu --disable-profile --without-gd --with-headers=/usr/sparc-unknown-lin
ux-gnu/usr/include --prefix=/usr --libdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --libexecdir=/usr/lib/misc
/glibc --enable-obsolete-rpc

    ...

    configure:2444: checking for sparcv9-unknown-linux-gnu-gcc
    configure:2471: result: x86_64-pc-linux-gnu-gcc

And from now on it thinks x86_64 is it's host:

(Easily notable with 'cc1: warning: unknown register name: g6 [enabled by default]' in every test it runs)

    configure:6365: checking for -z relro option
    configure:6406: x86_64-pc-linux-gnu-gcc  -pipe -fcall-used-g6 -O2 -fno-strict-aliasing -U_FORTIFY_SOURCE -U_FORTIFY_SOURCE -U_F
ORTIFY_SOURCE -Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu
                        -fPIC -shared -o conftest.so conftest.c
                        -nostartfiles -nostdlib
                        -Wl,-z,relro 1>&5
    cc1: warning: unknown register name: g6 [enabled by default]
    configure:6409: $? = 0
    configure:6412: readelf -Wl conftest.so > conftest.ph
    configure:6415: $? = 0
    configure:6421: 
          gawk -v commonpagesize=0x2000 -f conftest.awk
               conftest.ph > conftest.cps
    
    ...

    configure:6424: $? = 0
    configure:6429: result: broken
    configure:6435: error: linker with -z relro support required


Worth a separate bug report?
Comment 19 Sergei Trofimovich (RETIRED) gentoo-dev 2012-12-15 19:28:50 UTC
Current ~arch 'crossdev sparc' fails thusly:

    configure:6406: x86_64-pc-linux-gnu-gcc  -pipe -fcall-used-g6 -O2 -fno-strict-aliasing -U_FORTIFY_SOURCE -U_FORTIFY_SOURCE -U_F
ORTIFY_SOURCE -Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu
                    -fPIC -shared -o conftest.so conftest.c
                    -nostartfiles -nostdlib
                    -Wl,-z,relro 1>&5
    cc1: warning: unknown register name: g6 [enabled by default]
    configure:6409: $? = 0
    configure:6412: readelf -Wl conftest.so > conftest.ph
    configure:6415: $? = 0
    configure:6421: 
          gawk -v commonpagesize=0x2000 -f conftest.awk
               conftest.ph > conftest.cps

(the same reason as in comment #18)
Comment 20 Sergei Trofimovich (RETIRED) gentoo-dev 2012-12-15 19:40:33 UTC
glibc-2.16/configure.in snippet:
> test -n "$base_machine" || case "$machine" in

Looks like for glibc-2.16 is will be easier to set
machine=/base_machine= for configure by hands instead of --host faking.
Comment 21 Raúl Porcel (RETIRED) gentoo-dev 2013-01-20 18:09:18 UTC
@toolchain, any news on this?

Thanks
Comment 22 Luca Barbato gentoo-dev 2013-01-27 07:39:47 UTC
tested currently and

checking for sparc64-unknown-linux-gnu-gcc... (cached) gcc

Could reproduce it.
Comment 23 Austin S. Hemmelgarn 2013-04-03 15:15:41 UTC
Seems to be fixed for sparc64-unknown-linux-gnu when using unstable sources, just did a successful build on amd64 with:
    crossdev -v --ex-gcc -t sparc64-unknown-linux-gnu
Comment 24 seraph@xs4all.nl 2013-04-03 17:44:40 UTC
Indeed, unstable sources builds just fine here too.
Comment 25 SpanKY gentoo-dev 2014-06-20 20:50:41 UTC
*** Bug 513848 has been marked as a duplicate of this bug. ***
Comment 26 SpanKY gentoo-dev 2016-01-16 08:19:23 UTC
i've finally sat down, absorbed this code, and rewrote it.  i think the result should work now.  at least, it does for me using `crossdev -S sparc`.

please let us know if it still fails for you.

http://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6f8a59c05ff00ddafbfbfffecdac6e71cf175fbd
Comment 27 Alex Buell 2016-01-16 09:49:09 UTC
Works for me now. Thanks.