public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Nick Alcock <nick.alcock@oracle.com>
To: Vladimir Mezentsev via Binutils <binutils@sourceware.org>
Subject: Re: how should I configure my buuild for i386-*linux*
Date: Sat, 07 May 2022 14:30:15 +0100	[thread overview]
Message-ID: <87sfpl8o7s.fsf@esperi.org.uk> (raw)
In-Reply-To: <2a2f06b6-5a0c-4cdc-b4ef-2fcd21e3d9f6@oracle.com> (Vladimir Mezentsev via Binutils's message of "Wed, 4 May 2022 00:29:32 -0700")

On 4 May 2022, Vladimir Mezentsev via Binutils outgrape:

> On 5/3/22 16:42, Matthias Klose wrote:
>> On 04.05.22 01:31, Vladimir Mezentsev via Binutils wrote:
>>>   Hi,
>>>
>>>   If I am on x86_64-*-linux* and want to build the i386-*linux* libraries (for example, libopcodes or libbfd),
>>> how should I configure my buuild ?
>>>
>>> The same question is for the aarch64-*-linux* host.
>>
>> you could have a look at the Debian build logs, e.g. look for the amd64 build log which also builds the binutils for i686 and
>> aarch64 hosted on x86_64:
>>
>> https://buildd.debian.org/status/package.php?p=binutils
>> (click on the "Installed" cell for the amd64 build log, then search for --target=i686-linux-gnu and --target=aarch64-linux-gnu
>
>
> I can reproduce a problem in the gprofng build.
>
> But after this configuration:
>
> mkdir builddir-i386
> cd builddir-i386 \
>     && env CC="x86_64-linux-gnu-gcc" CXX="x86_64-linux-gnu-g++" \
>        DEB_TARGET_MULTIARCH=i386-linux-gnu  DEB_TARGET_MULTIARCH64=x86_64-linux-gnu DEB_TARGET_MULTIARCHX32=x86_64-linux-gnux32  \
> 	../configure \
> 	  --disable-silent-rules --enable-obsolete --enable-shared --enable-plugins --enable-threads --with-system-zlib --prefix=/usr --enable-deterministic-archives --disable-compressed-debug-sections --enable-new-dtags --disable-x86-used-note --with-gold-ldflags=-static-libstdc++ --build=x86_64-linux-gnu --host=x86_64-linux-gnu --with-pkgversion="GNU Binutils for Debian" --disable-werror --enable-initfini-array --enable-ld=default --enable-gold \
> 	  --enable-targets=x86_64-linux-gnu,x86_64-linux-gnux32,x86_64-pep \
> 	  --with-sysroot=/ \
> 	  --libdir=/usr/lib/i386-linux-gnu \
> 	  --enable-ld=default --enable-gold \
> 	  --target=i686-linux-gnu
>
>
> All binaries are the 64-bit binaries.
> -m32 is not passed to gcc.
>
> Is it expected ?

Since nothing is telling configure to run GCC with those flags, yes it
is. (IIRC, the sbuild tool that backs buildd.debian.org has special
magic to use the right compiler in this case: since you're not using
sbuild, that won't work for you.)

Thankfully the answer is pretty simple. Try configuring like this:

configure CC="gcc -m32" ...

where ... is your other usual configure flags. (And obviously run
configure like you usually do, ../configure or ../binutils-gdb/configure
or whatever. The important thing is the setting of CC.)

Using CC rather than CFLAGS ensures that every single invocation, even
those that use unusual flags for other reasons, passes -m32; passing CC
as a configure argument rather than just setting it in the environment
ensures that even if the configure script is auto-reinvoked it'll still
pick up the right flags.

-- 
NULL && (void)

  reply	other threads:[~2022-05-07 13:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-03 23:31 Vladimir Mezentsev
2022-05-03 23:42 ` Matthias Klose
2022-05-04  7:29   ` Vladimir Mezentsev
2022-05-07 13:30     ` Nick Alcock [this message]
2022-05-07 14:21       ` Andreas Schwab
2022-05-09 12:01         ` Nick Alcock
2022-05-09 12:13           ` Christian Groessler
2022-05-17 12:33             ` Nick Alcock

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sfpl8o7s.fsf@esperi.org.uk \
    --to=nick.alcock@oracle.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).