Debian Bug report logs - #644986
i386: Compiling gcc-snapshots from upstream with multiarch-toolchain?

Package: general; Maintainer for general is debian-devel@lists.debian.org;

Reported by: sedat.dilek@gmail.com

Date: Tue, 11 Oct 2011 12:42:29 UTC

Severity: important

Merged with 637232, 639214, 648889, 682678

Reply or subscribe to this bug.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, GNU Libc Maintainers <debian-glibc@lists.debian.org>:
Bug#644986; Package libc6-dev. (Tue, 11 Oct 2011 12:42:32 GMT) Full text and rfc822 format available.

Acknowledgement sent to sedat.dilek@gmail.com:
New Bug report received and forwarded. Copy sent to GNU Libc Maintainers <debian-glibc@lists.debian.org>. (Tue, 11 Oct 2011 12:42:34 GMT) Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Sedat Dilek <sedat.dilek@googlemail.com>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Cc: debian-gcc <debian-gcc@lists.debian.org>
Subject: i386: Compiling gcc-snapshots from upstream with multiarch-toolchain?
Date: Tue, 11 Oct 2011 14:41:10 +0200
[Message part 1 (text/plain, inline)]
Package: libc6-dev
Version: 2.13-21
Severity: normal

[ CCing debian-gcc ML ]

Dear Maintainer,

these problems here were already discussed on #multiarch and reported
by me (see for example #636116 or #637218), but still exist.
I did not check for a while the progress on the issues, so I am sorry
for being uninformed and tapping on your nerves by unseen
re-reporting.
Personally, I am interested in helping to get the issues solved (for
me this looks like a multiarch problem, but CCing debian-gcc folks as
well).

Again I tried to compile a gcc-4.7 snapshot tarball [1] with my
(updated) build-script.

### Workaround #1: /usr/include/gnu/stubs-32.h

# ls -l /usr/include/gnu/stubs-32.h
lrwxrwxrwx 1 root root 32 Sep  5 17:19 /usr/include/gnu/stubs-32.h ->
../i386-linux-gnu/gnu/stubs-32.h

# dpkg -S /usr/include/gnu/
libc6-dev-amd64: /usr/include/gnu

# dpkg -S /usr/include/i386-linux-gnu/gnu/stubs-32.h
libc6-dev: /usr/include/i386-linux-gnu/gnu/stubs-32.h

Q: Is it possible to have this symlink when both (libc6-dev-amd64 and
libc6-dev) packages are installed?

### Workaround #2: /usr/lib/crt*.o

# ls -l /usr/lib/crt*.o
lrwxrwxrwx 1 root root 21 Sep  5 18:24 /usr/lib/crt1.o -> i386-linux-gnu/crt1.o
lrwxrwxrwx 1 root root 21 Sep  5 18:24 /usr/lib/crti.o -> i386-linux-gnu/crti.o
lrwxrwxrwx 1 root root 21 Sep  5 18:24 /usr/lib/crtn.o -> i386-linux-gnu/crtn.o

# dpkg -S /usr/lib/i386-linux-gnu/crt*.o
libc6-dev: /usr/lib/i386-linux-gnu/crt1.o
libc6-dev: /usr/lib/i386-linux-gnu/crti.o
libc6-dev: /usr/lib/i386-linux-gnu/crtn.o

# dpkg -S /usr/lib64/crt*.o
libc6-dev-amd64: /usr/lib64/crt1.o
libc6-dev-amd64: /usr/lib64/crti.o
libc6-dev-amd64: /usr/lib64/crtn.o

# locate crt1.o crti.o crtn.o | grep ^/usr/lib | egrep -v
'gcrt1.o|Mcrt1.o|Scrt1.o' | sort
/usr/lib64/crt1.o
/usr/lib64/crti.o
/usr/lib64/crtn.o
/usr/lib/crt1.o <--- SELF-CREATED symlink
/usr/lib/crti.o <--- SELF-CREATED symlink
/usr/lib/crtn.o <--- SELF-CREATED symlink
/usr/lib/i386-linux-gnu/crt1.o
/usr/lib/i386-linux-gnu/crti.o
/usr/lib/i386-linux-gnu/crtn.o

Q: As you can see libc6-dev-amd64 places its crt*.o in /usr/lib64/, so
why should libc6-dev NOT (logically) place same files below /usr/lib/
(as symlinks)?

CONCLUSION:
I am unsure if I should split this bug-report, but both issues affect
the same Debian package and could IMHO easily solved by creating
appropriate symlinks.

NOTE:
A succesfully compiled gcc upstream snapshot tarballs is a testcase
for me before I start any compilation of a MIPSEL toolchain for a
router project called freetz.

Regards,
- Sedat (dileks) -

P.S.: ATTACHMENTS: 1. build-script 2. make logs

[1] ftp://sourceware.org/pub/gcc/snapshots/LATEST-4.7/gcc-4.7-20111008.tar.bz2
[2] http://freetz.org


-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (200, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 3.1.0-rc4-next20110831.9-686-small (SMP w/1 CPU core)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages libc6-dev depends on:
ii  libc-dev-bin    2.13-21
ii  libc6           2.13-21
ii  linux-libc-dev  3.0.0-5

Versions of packages libc6-dev recommends:
ii  gcc [c-compiler]      4:4.6.1-3
ii  gcc-4.4 [c-compiler]  4.4.6-11
ii  gcc-4.5 [c-compiler]  4.5.3-9
ii  gcc-4.6 [c-compiler]  4.6.1-15
ii  gcc-4.7 [c-compiler]  20111008-1 <--- SELF-CREATED dummy package
(done with equivs)

Versions of packages libc6-dev suggests:
pn  glibc-doc     <none>
pn  manpages-dev  <none>

-- no debconf information
[build_gcc-snapshot.sh (application/x-sh, attachment)]
[make.log.xz (application/octet-stream, attachment)]
[make.log_continue.xz (application/octet-stream, attachment)]
[make.log_continue-2.xz (application/octet-stream, attachment)]
[make.log_continue-3.xz (application/octet-stream, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, GNU Libc Maintainers <debian-glibc@lists.debian.org>:
Bug#644986; Package libc6-dev. (Tue, 11 Oct 2011 12:54:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to sedat.dilek@gmail.com:
Extra info received and forwarded to list. Copy sent to GNU Libc Maintainers <debian-glibc@lists.debian.org>. (Tue, 11 Oct 2011 12:54:05 GMT) Full text and rfc822 format available.

Message #10 received at 644986@bugs.debian.org (full text, mbox):

From: Sedat Dilek <sedat.dilek@googlemail.com>
To: 644986@bugs.debian.org
Cc: debian-gcc <debian-gcc@lists.debian.org>
Subject: Re: i386: Compiling gcc-snapshots from upstream with multiarch-toolchain?
Date: Tue, 11 Oct 2011 14:50:21 +0200
Some additional informations on created gcc-4.7 compiler:

# which gcc-4.7
/usr/bin/gcc-4.7

# l /usr/bin/gcc-4.7
lrwxrwxrwx 1 root root 24 Jul 31 14:28 /usr/bin/gcc-4.7 ->
/opt/gcc-4.7/bin/gcc-4.7

# gcc-4.7 -v
Using built-in specs.
COLLECT_GCC=gcc-4.7
COLLECT_LTO_WRAPPER=/opt/gcc-4.7/lib/gcc/i486-linux-gnu/4.7.0/lto-wrapper
Target: i486-linux-gnu
Configured with: ../gcc-4.7-20111008/configure --prefix=/opt/gcc-4.7
--libdir=/opt/gcc-4.7/lib --libexecdir=/opt/gcc-4.7/lib
--program-suffix=-4.7 --enable-clocale=gnu --enable-languages=c,c++
--enable-shared --enable-threads=posix --disable-bootstrap
--disable-libssp --disable-multilib --disable-nls --with-system-zlib
--without-cloog --without-ppl --with-arch-32=i586 --with-tune=generic
--build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.7.0 20111008 (experimental) (GCC)




Information forwarded to debian-bugs-dist@lists.debian.org, GNU Libc Maintainers <debian-glibc@lists.debian.org>:
Bug#644986; Package libc6-dev. (Tue, 11 Oct 2011 15:45:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to sedat.dilek@gmail.com:
Extra info received and forwarded to list. Copy sent to GNU Libc Maintainers <debian-glibc@lists.debian.org>. (Tue, 11 Oct 2011 15:45:04 GMT) Full text and rfc822 format available.

Message #15 received at 644986@bugs.debian.org (full text, mbox):

From: Sedat Dilek <sedat.dilek@googlemail.com>
To: 644986@bugs.debian.org
Cc: debian-gcc <debian-gcc@lists.debian.org>
Subject: Re: i386: Compiling gcc-snapshots from upstream with multiarch-toolchain?
Date: Tue, 11 Oct 2011 17:41:51 +0200
[Message part 1 (text/plain, inline)]
[ RESEND ]

I played again with CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET by exporting them.

-I/usr/include/${HOST_SYSTEM_MULTIARCH_TYPE} ...
...catches the gnu/stub-32.h issue.

-B/usr/lib/${HOST_SYSTEM_MULTIARCH_TYPE} ...
...does NOT catch the problem with crt*.o files.

-B/lib/${HOST_SYSTEM_MULTIARCH_TYPE}
-B/usr/lib/${HOST_SYSTEM_MULTIARCH_TYPE} ...
... NOPE, too.

- Sedat -
[build_gcc-snapshot.sh.diff (text/x-diff, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, GNU Libc Maintainers <debian-glibc@lists.debian.org>:
Bug#644986; Package libc6-dev. (Tue, 11 Oct 2011 19:51:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jonathan Nieder <jrnieder@gmail.com>:
Extra info received and forwarded to list. Copy sent to GNU Libc Maintainers <debian-glibc@lists.debian.org>. (Tue, 11 Oct 2011 19:51:06 GMT) Full text and rfc822 format available.

Message #20 received at 644986@bugs.debian.org (full text, mbox):

From: Jonathan Nieder <jrnieder@gmail.com>
To: 644986@bugs.debian.org
Cc: sedat.dilek@gmail.com
Subject: Re: i386: Compiling gcc-snapshots from upstream with multiarch-toolchain?
Date: Tue, 11 Oct 2011 14:48:21 -0500
Hi Sedat,

Sedat Dilek wrote:

> these problems here were already discussed on #multiarch and reported
> by me (see for example #636116 or #637218), but still exist.

Those look like different bugs.  #636116 was about libc6-dev-amd64
failing to unpack!  #629819 was about crti.o et al moving to the
multiarch location without any warning about the need for build
scripts to be adjusted and was fixed by adding a NEWS.Debian.gz
describing that need and giving some advice.  #637218 was the
corresponding problem for headers.  Similarly, #634821 was about
libgcc_s.so.1 et al moving and breaking old gcc installations without
warning and was fixed by adding a Breaks.

This time, you are reporting that you needed workarounds to build
upstream gcc without patching it or adding special ./configure
options:

[...]
> # ls -l /usr/include/gnu/stubs-32.h
> lrwxrwxrwx 1 root root 32 Sep  5 17:19 /usr/include/gnu/stubs-32.h -> ../i386-linux-gnu/gnu/stubs-32.h
[...]
> # ls -l /usr/lib/crt*.o
> lrwxrwxrwx 1 root root 21 Sep  5 18:24 /usr/lib/crt1.o -> i386-linux-gnu/crt1.o
> lrwxrwxrwx 1 root root 21 Sep  5 18:24 /usr/lib/crti.o -> i386-linux-gnu/crti.o
> lrwxrwxrwx 1 root root 21 Sep  5 18:24 /usr/lib/crtn.o -> i386-linux-gnu/crtn.o

This is #637232, which is about finding some way to get these things
working without making each user spend too much time.

More and more headers and libraries (not just those provided by
libc6-dev!) are moving to the multiarch locations, so adding symlinks
one by one does not seem like a viable strategy for that.  See
http://bugs.debian.org/637232 for more details.

[...]
> Again I tried to compile a gcc-4.7 snapshot tarball [1] with my
> (updated) build-script.

Something that might be useful is to add a
"building-premultiarch-toolchain.txt" to libc6-dev or some similar
package, explaining how to tell the gcc build system where the
bootstrap compiler should look for multiarch libs and headers.

Because gcc's configure script is a little insane, this
is more complicated than the incantation described in NEWS.Debian.gz,
though only cosmetically so.  Something like:

  make FLAGS_FOR_TARGET='-B$(build_tooldir)/bin/ '\
'-B$(build_tooldir)/lib/ -isystem $(build_tooldir)/include '\
'-isystem $(build_tooldir)/sys-include '\
"-B/usr/lib/$DEB_HOST_MULTIARCH" \
"-I/usr/include/$DEB_HOST_MULTIARCH" \
	install

Yes, this has to be set through a makefile variable, not the configure
script, since no one bothered to wire the latter up for it.

Yes, presumably the settings that come before '-B/usr/lib/i386-linux-gnu'
are needed.  They are the default from the toplevel Makefile, and the
Makefile does not provide a way to add extra FLAGS_FOR_TARGET
without overriding the existing ones.

When I tried this[*], I also had set CFLAGS_FOR_TARGET and
CXXFLAGS_FOR_TARGET as configure arguments and BOOT_CFLAGS on the
"make" command line, but I believe you tested with just
FLAGS_FOR_TARGET and found it to work ok.

> A succesfully compiled gcc upstream snapshot tarballs is a testcase
> for me before I start any compilation of a MIPSEL toolchain for a
> router project called freetz.

Good luck!  You might also want to look into the gcc-snapshot package,
which is already patched to handle the multiarch paths both at build
time and at runtime.

Will respond to your other message separately.

Hope that helps,
Jonathan

[*] http://bugs.debian.org/637218




Information forwarded to debian-bugs-dist@lists.debian.org, GNU Libc Maintainers <debian-glibc@lists.debian.org>:
Bug#644986; Package libc6-dev. (Tue, 11 Oct 2011 19:57:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jonathan Nieder <jrnieder@gmail.com>:
Extra info received and forwarded to list. Copy sent to GNU Libc Maintainers <debian-glibc@lists.debian.org>. (Tue, 11 Oct 2011 19:57:03 GMT) Full text and rfc822 format available.

Message #25 received at 644986@bugs.debian.org (full text, mbox):

From: Jonathan Nieder <jrnieder@gmail.com>
To: sedat.dilek@gmail.com
Cc: 644986@bugs.debian.org
Subject: Re: i386: Compiling gcc-snapshots from upstream with multiarch-toolchain?
Date: Tue, 11 Oct 2011 14:53:58 -0500
reassign 644986 general
severity 644986 critical
merge 637232 644986
quit

Sedat Dilek wrote:

> I played again with CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET by exporting them.
[...]
> -B/usr/lib/${HOST_SYSTEM_MULTIARCH_TYPE} ...
> ...does NOT catch the problem with crt*.o files.

Last time we went through this, didn't we discover that one has to set

 FLAGS_FOR_TARGET (instead of CFLAGS_FOR_TARGET or CXXFLAGS_FOR_TARGET)

and

 on the "make" command line (instead of through the environment or as
 a ./configure argument)

?  Yes, I know it is clunky.

Reassigning to "general" because the underlying problem (Debian as a
whole is moving to multiarch paths, and we don't provide enough help
with building upstream toolchains that don't know about that) is not
at all specific to libc6-dev.  Progress in the form of code or
documentation, in Debian or upstream, would be welcome as always.

Cheers,
Jonathan




Bug reassigned from package 'libc6-dev' to 'general'. Request was from Jonathan Nieder <jrnieder@gmail.com> to control@bugs.debian.org. (Tue, 11 Oct 2011 19:57:05 GMT) Full text and rfc822 format available.

Bug No longer marked as found in versions eglibc/2.13-21. Request was from Jonathan Nieder <jrnieder@gmail.com> to control@bugs.debian.org. (Tue, 11 Oct 2011 19:57:06 GMT) Full text and rfc822 format available.

Severity set to 'critical' from 'normal' Request was from Jonathan Nieder <jrnieder@gmail.com> to control@bugs.debian.org. (Tue, 11 Oct 2011 19:57:06 GMT) Full text and rfc822 format available.

Forcibly Merged 637232 639214 644986. Request was from Jonathan Nieder <jrnieder@gmail.com> to control@bugs.debian.org. (Tue, 11 Oct 2011 20:00:06 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, debian-devel@lists.debian.org:
Bug#644986; Package general. (Tue, 11 Oct 2011 21:45:07 GMT) Full text and rfc822 format available.

Acknowledgement sent to sedat.dilek@gmail.com:
Extra info received and forwarded to list. Copy sent to debian-devel@lists.debian.org. (Tue, 11 Oct 2011 21:45:07 GMT) Full text and rfc822 format available.

Message #38 received at 644986@bugs.debian.org (full text, mbox):

From: Sedat Dilek <sedat.dilek@googlemail.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: 644986@bugs.debian.org, debian-gcc <debian-gcc@lists.debian.org>
Subject: Re: i386: Compiling gcc-snapshots from upstream with multiarch-toolchain?
Date: Tue, 11 Oct 2011 23:13:42 +0200
[Message part 1 (text/plain, inline)]
On Tue, Oct 11, 2011 at 9:53 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
> reassign 644986 general
> severity 644986 critical
> merge 637232 644986
> quit
>
> Sedat Dilek wrote:
>
>> I played again with CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET by exporting them.
> [...]
>> -B/usr/lib/${HOST_SYSTEM_MULTIARCH_TYPE} ...
>> ...does NOT catch the problem with crt*.o files.
>
> Last time we went through this, didn't we discover that one has to set
>
>  FLAGS_FOR_TARGET (instead of CFLAGS_FOR_TARGET or CXXFLAGS_FOR_TARGET)
>
> and
>
>  on the "make" command line (instead of through the environment or as
>  a ./configure argument)
>
> ?  Yes, I know it is clunky.
>
> Reassigning to "general" because the underlying problem (Debian as a
> whole is moving to multiarch paths, and we don't provide enough help
> with building upstream toolchains that don't know about that) is not
> at all specific to libc6-dev.  Progress in the form of code or
> documentation, in Debian or upstream, would be welcome as always.
>
> Cheers,
> Jonathan
>

I re-reflected on experiences from #637218 and #629819.

Attached is v7 of my build-script.

I had success with:

HOST_SYSTEM_MULTIARCH_TYPE=$(dpkg-architecture -qDEB_HOST_MULTIARCH)

MULTIARCH_FLAGS="-B/usr/lib/${HOST_SYSTEM_MULTIARCH_TYPE}
-I/usr/include/${HOST_SYSTEM_MULTIARCH_TYPE}"

export CFLAGS="-g -O2"
export CXXFLAGS="${CFLAGS}"
export CFLAGS_FOR_TARGET="${CFLAGS} ${MULTIARCH_FLAGS}"
export CXXFLAGS_FOR_TARGET="${CXXFLAGS} ${MULTIARCH_FLAGS}"

...and...

make FLAGS_FOR_TARGET="${FLAGS_FOR_TARGET} ${MULTIARCH_FLAGS}"
-j${MAKE_JOBS} 2>&1 | tee ${BUILD_LOG_FILE}

...and...

# cat /usr/bin/gcc-4.7
#!/bin/sh

exec /opt/gcc-4.7/bin/gcc-4.7 -B/usr/lib/i386-linux-gnu
-I/usr/include/i386-linux-gnu "$@"

...and...

# cat /usr/bin/g++-4.7
#!/bin/sh

exec /opt/gcc-4.7/bin/g++-4.7 -B/usr/lib/i386-linux-gnu
-I/usr/include/i386-linux-gnu "$@"

Building mesa-from-git was fine.

- Sedat -

P.S.: build-script (v7) and make-log (v7) attached

$ egrep 'CFLAGS|CXXFLAGS|FLAGS_FOR_TARGET' gcc-build/config.log
ac_cv_env_CFLAGS_set=set
ac_cv_env_CFLAGS_value='-g -O2'
ac_cv_env_CXXFLAGS_set=set
ac_cv_env_CXXFLAGS_value='-g -O2'
CFLAGS='-g -O2'
CFLAGS_FOR_BUILD='-g -O2'
CFLAGS_FOR_TARGET='-g -O2 -B/usr/lib/i386-linux-gnu
-I/usr/include/i386-linux-gnu'
CXXFLAGS='-g -O2'
CXXFLAGS_FOR_BUILD='-g -O2'
CXXFLAGS_FOR_TARGET='-g -O2 -B/usr/lib/i386-linux-gnu
-I/usr/include/i386-linux-gnu'
DEBUG_PREFIX_CFLAGS_FOR_TARGET=''
FLAGS_FOR_TARGET=' -B$(build_tooldir)/bin/ -B$(build_tooldir)/lib/
-isystem $(build_tooldir)/include -isystem
$(build_tooldir)/sys-include'
LDFLAGS_FOR_TARGET=''
SYSROOT_CFLAGS_FOR_TARGET=''
[build_gcc-snapshot_v7.sh (application/x-sh, attachment)]
[make_v7.log.xz (application/octet-stream, attachment)]

Forcibly Merged 637232 639214 644986 648889. Request was from Jonathan Nieder <jrnieder@gmail.com> to control@bugs.debian.org. (Tue, 15 Nov 2011 22:03:12 GMT) Full text and rfc822 format available.

Severity set to 'important' from 'critical' Request was from Holger Levsen <holger@layer-acht.org> to control@bugs.debian.org. (Tue, 29 May 2012 08:03:07 GMT) Full text and rfc822 format available.

Added indication that 644986 affects release-notes Request was from Jonathan Nieder <jrnieder@gmail.com> to control@bugs.debian.org. (Sun, 22 Jul 2012 17:54:14 GMT) Full text and rfc822 format available.

Merged 637232 639214 644986 648889 682678 Request was from Jonathan Nieder <jrnieder@gmail.com> to control@bugs.debian.org. (Tue, 24 Jul 2012 16:51:06 GMT) Full text and rfc822 format available.

Merged 637232 639214 644986 648889 682678 Request was from Aurelien Jarno <aurel32@debian.org> to control@bugs.debian.org. (Wed, 25 Jul 2012 07:15:03 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Thu Apr 17 15:27:58 2014; Machine Name: beach.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.