public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* how should I configure my buuild for i386-*linux*
@ 2022-05-03 23:31 Vladimir Mezentsev
  2022-05-03 23:42 ` Matthias Klose
  0 siblings, 1 reply; 8+ messages in thread
From: Vladimir Mezentsev @ 2022-05-03 23:31 UTC (permalink / raw)
  To: Binutils

  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.
Is it possible to build on Arm  for Intel platform ?

Thank you,
-Vladimir


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: how should I configure my buuild for i386-*linux*
  2022-05-03 23:31 how should I configure my buuild for i386-*linux* Vladimir Mezentsev
@ 2022-05-03 23:42 ` Matthias Klose
  2022-05-04  7:29   ` Vladimir Mezentsev
  0 siblings, 1 reply; 8+ messages in thread
From: Matthias Klose @ 2022-05-03 23:42 UTC (permalink / raw)
  To: Vladimir Mezentsev, Binutils

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

> Is it possible to build on Arm  for Intel platform ?

I am only building on aarch64, same as above, click the arm64 build log and 
search for --target=x86_64-linux-gnu.

Matthias

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: how should I configure my buuild for i386-*linux*
  2022-05-03 23:42 ` Matthias Klose
@ 2022-05-04  7:29   ` Vladimir Mezentsev
  2022-05-07 13:30     ` Nick Alcock
  0 siblings, 1 reply; 8+ messages in thread
From: Vladimir Mezentsev @ 2022-05-04  7:29 UTC (permalink / raw)
  To: Matthias Klose, Binutils



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 ?

Thank you,
-Vladimir




>
>> Is it possible to build on Arm  for Intel platform ?
>
> I am only building on aarch64, same as above, click the arm64 build 
> log and search for --target=x86_64-linux-gnu.
>
> Matthias

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: how should I configure my buuild for i386-*linux*
  2022-05-04  7:29   ` Vladimir Mezentsev
@ 2022-05-07 13:30     ` Nick Alcock
  2022-05-07 14:21       ` Andreas Schwab
  0 siblings, 1 reply; 8+ messages in thread
From: Nick Alcock @ 2022-05-07 13:30 UTC (permalink / raw)
  To: Vladimir Mezentsev via Binutils

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)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: how should I configure my buuild for i386-*linux*
  2022-05-07 13:30     ` Nick Alcock
@ 2022-05-07 14:21       ` Andreas Schwab
  2022-05-09 12:01         ` Nick Alcock
  0 siblings, 1 reply; 8+ messages in thread
From: Andreas Schwab @ 2022-05-07 14:21 UTC (permalink / raw)
  To: Nick Alcock via Binutils

On Mai 07 2022, Nick Alcock via Binutils wrote:

> Thankfully the answer is pretty simple. Try configuring like this:
>
> configure CC="gcc -m32" ...

That would would conflict with the value of the --host option.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: how should I configure my buuild for i386-*linux*
  2022-05-07 14:21       ` Andreas Schwab
@ 2022-05-09 12:01         ` Nick Alcock
  2022-05-09 12:13           ` Christian Groessler
  0 siblings, 1 reply; 8+ messages in thread
From: Nick Alcock @ 2022-05-09 12:01 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: binutils

On 7 May 2022, Andreas Schwab told this:

> On Mai 07 2022, Nick Alcock via Binutils wrote:
>
>> Thankfully the answer is pretty simple. Try configuring like this:
>>
>> configure CC="gcc -m32" ...
>
> That would would conflict with the value of the --host option.

Well, you'd use --host if you want to trigger a cross-compilation: but
most uses in this case are not cross-compilations at all but different
compiler configurations on a multiarch system capable of executing
x86-32 and x86-64 programs. Just flipping the CC flags is enough in this
case. Obviously before this can work you need a 32-bit libc etc etc
but almost everyone who's even thinking of doing this will either
already have one or will have one trivially available to install.

(It's also enough if you have qemu and binfmt_misc set up to "natively"
execute non-native programs through emulation, though that will almost
always require building a suitable libc etc via conventional
cross-compilation first.)

(aplogies, I know I'm probably teaching my grandfather to suck eggs, but
ti was recently borne in on me how many people don't know this stuff! So
I thought it might be worth reiterating anyway.)

-- 
NULL && (void)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: how should I configure my buuild for i386-*linux*
  2022-05-09 12:01         ` Nick Alcock
@ 2022-05-09 12:13           ` Christian Groessler
  2022-05-17 12:33             ` Nick Alcock
  0 siblings, 1 reply; 8+ messages in thread
From: Christian Groessler @ 2022-05-09 12:13 UTC (permalink / raw)
  To: binutils

On 5/9/22 14:01, Nick Alcock via Binutils wrote:
> On 7 May 2022, Andreas Schwab told this:
>
>> On Mai 07 2022, Nick Alcock via Binutils wrote:
>>
>>> Thankfully the answer is pretty simple. Try configuring like this:
>>>
>>> configure CC="gcc -m32" ...
>> That would would conflict with the value of the --host option.
> Well, you'd use --host if you want to trigger a cross-compilation: but
> most uses in this case are not cross-compilations at all but different
> compiler configurations on a multiarch system capable of executing
> x86-32 and x86-64 programs. Just flipping the CC flags is enough in this
> case. Obviously before this can work you need a 32-bit libc etc etc
> but almost everyone who's even thinking of doing this will either
> already have one or will have one trivially available to install.


If you're on a Debian system (maybe others), run "linux32" and configure 
in this subshell.

It lets the programs think they are running on a 32bit machine.

regards,
chris



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: how should I configure my buuild for i386-*linux*
  2022-05-09 12:13           ` Christian Groessler
@ 2022-05-17 12:33             ` Nick Alcock
  0 siblings, 0 replies; 8+ messages in thread
From: Nick Alcock @ 2022-05-17 12:33 UTC (permalink / raw)
  To: Christian Groessler; +Cc: binutils

On 9 May 2022, Christian Groessler stated:

> On 5/9/22 14:01, Nick Alcock via Binutils wrote:
>> On 7 May 2022, Andreas Schwab told this:
>>
>>> On Mai 07 2022, Nick Alcock via Binutils wrote:
>>>
>>>> Thankfully the answer is pretty simple. Try configuring like this:
>>>>
>>>> configure CC="gcc -m32" ...
>>> That would would conflict with the value of the --host option.
>> Well, you'd use --host if you want to trigger a cross-compilation: but
>> most uses in this case are not cross-compilations at all but different
>> compiler configurations on a multiarch system capable of executing
>> x86-32 and x86-64 programs. Just flipping the CC flags is enough in this
>> case. Obviously before this can work you need a 32-bit libc etc etc
>> but almost everyone who's even thinking of doing this will either
>> already have one or will have one trivially available to install.
>
> If you're on a Debian system (maybe others), run "linux32" and configure in this subshell.
>
> It lets the programs think they are running on a 32bit machine.

This is only enough if you've replaced /usr/bin/gcc etc with wrappers
that detect this and introduce "-m32" etc into the invocations passed to
the real gcc. Debian uses such a wrapper, but it's not guaranteed on all
systems. (But if you are on such a system, it is terribly convenient.)

-- 
NULL && (void)

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-05-17 12:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-03 23:31 how should I configure my buuild for i386-*linux* Vladimir Mezentsev
2022-05-03 23:42 ` Matthias Klose
2022-05-04  7:29   ` Vladimir Mezentsev
2022-05-07 13:30     ` Nick Alcock
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

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).