mailing list of musl libc
 help / color / mirror / code / Atom feed
* installation on bi-arch system
@ 2012-06-17 17:24 Bruno Haible
  2012-06-17 23:06 ` Isaac Dunham
  0 siblings, 1 reply; 3+ messages in thread
From: Bruno Haible @ 2012-06-17 17:24 UTC (permalink / raw)
  To: Rich Felker, musl

Hi,

Trying to install musl-0.9.1 as a 32-bit library on a bi-arch x86_64
glibc system. The usual way to configure packages for this configuration
is
  ./configure CC="gcc -m32"
or
  CC="gcc -m32" ./configure
See <http://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Preset-Output-Variables.html>.
But this does not work with musl's configure script:

$ CC="gcc -m32" ./configure --prefix=/arch/x86-linux/inst-musl --exec-prefix=/arch/x86-linux/inst-musl CC="gcc -m32"
checking for C compiler... gcc -m32
checking whether compiler is gcc... no
checking target system type... unknown
./configure: unable to detect target arch; try ./configure --target=...

As a workaround, I have to create a wrapper script that invokes "gcc -m32 ..."
and pass that as CC. This should not be needed.

Additionally, the musl-gcc script that gets created by "make install" looks
like this:

#!/bin/sh
exec gcc "$@" -specs "/arch/x86-linux/inst-musl/lib/musl-gcc.specs"

When invoked with option "-c", it produces 64-bit .o files. To produce
32-bit .o files, it should read like this:

#!/bin/sh
exec gcc-32 "$@" -specs "/arch/x86-linux/inst-musl/lib/musl-gcc.specs"

or like this:

#!/bin/sh
exec gcc -m32 "$@" -specs "/arch/x86-linux/inst-musl/lib/musl-gcc.specs"

Bruno



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

* Re: installation on bi-arch system
  2012-06-17 17:24 installation on bi-arch system Bruno Haible
@ 2012-06-17 23:06 ` Isaac Dunham
  2012-06-18  0:00   ` Rich Felker
  0 siblings, 1 reply; 3+ messages in thread
From: Isaac Dunham @ 2012-06-17 23:06 UTC (permalink / raw)
  To: musl

On Sun, 17 Jun 2012 19:24:01 +0200
Bruno Haible <bruno@clisp.org> wrote:

> Hi,
> 
> Trying to install musl-0.9.1 as a 32-bit library on a bi-arch x86_64
> glibc system. The usual way to configure packages for this
> configuration is
>   ./configure CC="gcc -m32"
> or
>   CC="gcc -m32" ./configure
> See
> <http://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Preset-Output-Variables.html>.
> But this does not work with musl's configure script:
> 
> $ CC="gcc -m32" ./configure --prefix=/arch/x86-linux/inst-musl
> --exec-prefix=/arch/x86-linux/inst-musl CC="gcc -m32" checking for C
> compiler... gcc -m32 checking whether compiler is gcc... no
> checking target system type... unknown
> ./configure: unable to detect target arch; try ./configure
> --target=...

1. musl does not use autoconf, just a handwritten shell script that
accepts similar arguments.
2. I had always thought it was CC=gcc CFLAGS=-m32 ...
3. ./configure uses 
 $ type "$CC"
 to detect whether using $CC will work.
This means that all options must be set in CFLAGS.
Even if $CC did get accepted, gcc -m32 -dumpmachine (how musl detects
$ARCH) may not give i?86-linux-*, thus failing the configure.
> As a workaround, I have to create a wrapper script that invokes "gcc
> -m32 ..." and pass that as CC. This should not be needed.
See 2. Also note the --target= option (--target=i386 in this case).
--target=i386 should properly set CFLAGS to include -march=i486 -m32
(unless otherwise specified in CFLAGS).


> Additionally, the musl-gcc script that gets created by "make install"
> looks like this:
> 
> #!/bin/sh
> exec gcc "$@" -specs "/arch/x86-linux/inst-musl/lib/musl-gcc.specs"
> 
> When invoked with option "-c", it produces 64-bit .o files. To produce
> 32-bit .o files, it should read like this:
> 
> #!/bin/sh
> exec gcc-32 "$@" -specs "/arch/x86-linux/inst-musl/lib/musl-gcc.specs"
> 
> or like this:
> 
> #!/bin/sh
> exec gcc -m32 "$@" -specs
> "/arch/x86-linux/inst-musl/lib/musl-gcc.specs"
Again, I thought the standard was CFLAGS=-m32.
The approach you're proposing won't work when someone has both
architectures cross-building musl. (Although really, the spec file has
to be modified before that works, and that in turn would call for a
multiarch build target, which means VPATH/out-of-tree builds or a
change in object naming...)
> Bruno
> 



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

* Re: installation on bi-arch system
  2012-06-17 23:06 ` Isaac Dunham
@ 2012-06-18  0:00   ` Rich Felker
  0 siblings, 0 replies; 3+ messages in thread
From: Rich Felker @ 2012-06-18  0:00 UTC (permalink / raw)
  To: musl

On Sun, Jun 17, 2012 at 04:06:13PM -0700, Isaac Dunham wrote:
> 2. I had always thought it was CC=gcc CFLAGS=-m32 ...

I think Bruno's command line was more correct. -m32 is essential to
the identity of the compiler and should be in CC.

> 3. ./configure uses 
>  $ type "$CC"
>  to detect whether using $CC will work.

Are you sure? type should only be used when CC is not set and
configure is searching for a default compiler..

> Even if $CC did get accepted, gcc -m32 -dumpmachine (how musl detects
> $ARCH) may not give i?86-linux-*, thus failing the configure.

What does it give?

> > As a workaround, I have to create a wrapper script that invokes "gcc
> > -m32 ..." and pass that as CC. This should not be needed.
> See 2. Also note the --target= option (--target=i386 in this case).
> --target=i386 should properly set CFLAGS to include -march=i486 -m32
> (unless otherwise specified in CFLAGS).

Yes, that may be a good idea, although we'll need to test for
accepting -m32. Some gcc versions probably don't support it.

> > or like this:
> > 
> > #!/bin/sh
> > exec gcc -m32 "$@" -specs
> > "/arch/x86-linux/inst-musl/lib/musl-gcc.specs"

I think having anything before the "$@" will break some oddball gcc
options that need to be first. Can it be after "$@"?

Rich


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

end of thread, other threads:[~2012-06-18  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-17 17:24 installation on bi-arch system Bruno Haible
2012-06-17 23:06 ` Isaac Dunham
2012-06-18  0:00   ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).