public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* how to enable -m64 on x86-linux for building ATLAS
@ 2008-04-03  9:02 Dennis Wassel
  2008-04-03 10:27 ` Andrew Haley
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Dennis Wassel @ 2008-04-03  9:02 UTC (permalink / raw)
  To: gcc-help; +Cc: Dennis Wassel

Hi,

I've been trying to compile the ATLAS library on an 32-bit Linux
system with my self-compiled gcc 4.3.0, but this fails.
It boils down to the ATLAS config utility noticing that I have a
64-bit processor and trying to compile some low-level stuff with -m64,
which doesn't work because I have not compiled in 64-bit support. [I
could force 32-bit mode, but I feel that 64-bit mode surely improves
performance, which is what ATLAS is for in the first place]

Ok, so I try and recompile gcc, telling it that I do indeed have a
64-bit processor, and it "profiledbootstrap"s itself merrily, until at
some point ld whines that it cannot find a compatible libc.

Fine. I'm now going to try to build a 64-bit glibc (and worry where to
put it later, because I'm not root), and possible the full-fledged
binutils toolchain and so on, but now I feel this
chicken-and-egg-problem creeping up to me - wouldn't I need 64-bit
support in my compiler to create the corresponding glibc?

D'oh!

Any pointers, docs or howtos anyone? Much appreciated!

Cheers,
Dennis

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

* Re: how to enable -m64 on x86-linux for building ATLAS
  2008-04-03  9:02 how to enable -m64 on x86-linux for building ATLAS Dennis Wassel
@ 2008-04-03 10:27 ` Andrew Haley
  2008-04-03 17:22 ` Matthew Woehlke
  2008-04-05  5:40 ` Brian Dessent
  2 siblings, 0 replies; 7+ messages in thread
From: Andrew Haley @ 2008-04-03 10:27 UTC (permalink / raw)
  To: Dennis Wassel; +Cc: gcc-help

Dennis Wassel wrote:

> I've been trying to compile the ATLAS library on an 32-bit Linux
> system with my self-compiled gcc 4.3.0, but this fails.
> It boils down to the ATLAS config utility noticing that I have a
> 64-bit processor and trying to compile some low-level stuff with -m64,
> which doesn't work because I have not compiled in 64-bit support. [I
> could force 32-bit mode, but I feel that 64-bit mode surely improves
> performance, which is what ATLAS is for in the first place]
> 
> Ok, so I try and recompile gcc, telling it that I do indeed have a
> 64-bit processor, and it "profiledbootstrap"s itself merrily, until at
> some point ld whines that it cannot find a compatible libc.
> 
> Fine. I'm now going to try to build a 64-bit glibc (and worry where to
> put it later, because I'm not root), and possible the full-fledged
> binutils toolchain and so on, but now I feel this
> chicken-and-egg-problem creeping up to me - wouldn't I need 64-bit
> support in my compiler to create the corresponding glibc?
> 
> D'oh!
> 
> Any pointers, docs or howtos anyone? Much appreciated!

In the 64-bit Linux system we have a backwards compatibility mode that
allows us to run 32-bit applications.  We don't have a corresponding
64-bit mode on 32-bit systems.

Andrew.

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

* Re: how to enable -m64 on x86-linux for building ATLAS
  2008-04-03  9:02 how to enable -m64 on x86-linux for building ATLAS Dennis Wassel
  2008-04-03 10:27 ` Andrew Haley
@ 2008-04-03 17:22 ` Matthew Woehlke
  2008-04-05  5:40 ` Brian Dessent
  2 siblings, 0 replies; 7+ messages in thread
From: Matthew Woehlke @ 2008-04-03 17:22 UTC (permalink / raw)
  To: gcc-help

Dennis Wassel wrote:
> Fine. I'm now going to try to build a 64-bit glibc (and worry where to
> put it later, because I'm not root), and possible the full-fledged
> binutils toolchain and so on, but now I feel this
> chicken-and-egg-problem creeping up to me - wouldn't I need 64-bit
> support in my compiler to create the corresponding glibc?
> 
> D'oh!
> 
> Any pointers, docs or howtos anyone? Much appreciated!

It sounds like you want to look into how to build a cross-compiler. I've 
never attempted to do so, but surely there is documentation on how to 
bootstrap a cross compiler targeting a clean environment.

(As far a binutils, since you want cross-binutils, you are building 
32-bit binaries - i.e. your existing compiler is fine - that will 
generate 64-bit binaries. I'm not sure about libc, I guess it must be 
possible to build a "bare metal" cross compiler that you can use to 
build a libc; maybe you have to build a bare metal cross compiler first 
and then a cross compiler that uses that libc.)

Apologies for the not-very-helpful answer, but maybe this will at least 
point you in the right direction to go looking for further information.

-- 
Matthew
I don't see what C++ has to do with keeping people from shooting 
themselves in the foot.  C++ will happily load the gun, offer you a 
drink to steady your nerves, and help you aim. -- Peter da Silva (from 
cluefire.net)

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

* Re: how to enable -m64 on x86-linux for building ATLAS
  2008-04-03  9:02 how to enable -m64 on x86-linux for building ATLAS Dennis Wassel
  2008-04-03 10:27 ` Andrew Haley
  2008-04-03 17:22 ` Matthew Woehlke
@ 2008-04-05  5:40 ` Brian Dessent
  2008-04-05 13:01   ` Dennis Wassel
  2 siblings, 1 reply; 7+ messages in thread
From: Brian Dessent @ 2008-04-05  5:40 UTC (permalink / raw)
  To: Dennis Wassel; +Cc: gcc-help

Dennis Wassel wrote:

> I've been trying to compile the ATLAS library on an 32-bit Linux
> system with my self-compiled gcc 4.3.0, but this fails.
> It boils down to the ATLAS config utility noticing that I have a
> 64-bit processor and trying to compile some low-level stuff with -m64,
> which doesn't work because I have not compiled in 64-bit support. [I
> could force 32-bit mode, but I feel that 64-bit mode surely improves
> performance, which is what ATLAS is for in the first place]

You could build a cross compiler, but what would be the point?  You're
running a 32 bit operating system which means you can't run 64 bit
binaries, even if you have a processor capable of doing so.  The
resulting output would be totally useless.  As Andrew said it only works
in the other direction.

It is also possible to build a native gcc that supports -m64 on a 32 bit
host.  To do so requires first installing the 64 bit libc headers and
libraries in the appropriate places (normally done through your distro's
package manager) as well as an x86_64 binutils in the same prefix and
then using --enable-targets=all when configuring.  If you're not root
this will likely be impossible since you can't write to /usr/lib64 or
whatever, so you'll have to go with the cross-compiler method.  But
again, simply switching to a 64 bit operating system is what is actually
required here since then gcc will generate 64 bit binaries by default,
and you'll actually be able to run the resulting binary.

Brian

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

* Re: how to enable -m64 on x86-linux for building ATLAS
  2008-04-05  5:40 ` Brian Dessent
@ 2008-04-05 13:01   ` Dennis Wassel
  2008-04-05 23:53     ` Brian Dessent
  0 siblings, 1 reply; 7+ messages in thread
From: Dennis Wassel @ 2008-04-05 13:01 UTC (permalink / raw)
  To: gcc-help

2008/4/5, Brian Dessent <brian@dessent.net>:
> Dennis Wassel wrote:
>
>  > I've been trying to compile the ATLAS library on an 32-bit Linux
>  > system with my self-compiled gcc 4.3.0, but this fails.
>  > It boils down to the ATLAS config utility noticing that I have a
>  > 64-bit processor and trying to compile some low-level stuff with -m64,
>  > which doesn't work because I have not compiled in 64-bit support. [I
>  > could force 32-bit mode, but I feel that 64-bit mode surely improves
>  > performance, which is what ATLAS is for in the first place]
>
>
> You could build a cross compiler, but what would be the point?  You're
>  running a 32 bit operating system which means you can't run 64 bit
>  binaries, even if you have a processor capable of doing so.  The
>  resulting output would be totally useless.  As Andrew said it only works
>  in the other direction.
>
>  It is also possible to build a native gcc that supports -m64 on a 32 bit
>  host.  To do so requires first installing the 64 bit libc headers and
>  libraries in the appropriate places (normally done through your distro's
>  package manager) as well as an x86_64 binutils in the same prefix and
>  then using --enable-targets=all when configuring.  If you're not root
>  this will likely be impossible since you can't write to /usr/lib64 or
>  whatever, so you'll have to go with the cross-compiler method.  But
>  again, simply switching to a 64 bit operating system is what is actually
>  required here since then gcc will generate 64 bit binaries by default,
>  and you'll actually be able to run the resulting binary.
>
>
>  Brian
>

I've had a feeling that a cross-compiler is what I need -- you confirm
that, thanks a lot!
What strikes me about this is the fact that ATLAS' configure (all by
itself, no options given) thinks that using -m64 on a 32-bit system
might be a good idea (not to actually link something executable,
probably just some low-level assembler-ish stuff, no clue), since I'm
using a 64-bit compiler - am I up to something here, or do you think
it's just One Of Those Things?

Dennis

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

* Re: how to enable -m64 on x86-linux for building ATLAS
  2008-04-05 13:01   ` Dennis Wassel
@ 2008-04-05 23:53     ` Brian Dessent
  2008-04-06  6:37       ` Brian Dessent
  0 siblings, 1 reply; 7+ messages in thread
From: Brian Dessent @ 2008-04-05 23:53 UTC (permalink / raw)
  To: Dennis Wassel; +Cc: gcc-help

Dennis Wassel wrote:

> What strikes me about this is the fact that ATLAS' configure (all by
> itself, no options given) thinks that using -m64 on a 32-bit system
> might be a good idea (not to actually link something executable,
> probably just some low-level assembler-ish stuff, no clue), since I'm
> using a 64-bit compiler - am I up to something here, or do you think
> it's just One Of Those Things?

It seems common for numeric computation libraries to have configure
checks to detect the specific processor variant so that they will be
built with the best optimization, cf. gmp/mpfr.  The problem is that
they tend to do this without regard for the flavor of operating system. 
For example I seem to recall a recent PR in which gmp was configured on
e.g. sparc-sun-solaris2.10 but it detected that the machine was really
sparc64-* and built binaries of the wrong flavor, leading to an error in
the gcc build when it tried to link the stage 1 xgcc.

I think in all these cases you can simply spell out the --host=
explicitly to override the autodetection logic.

Brian

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

* Re: how to enable -m64 on x86-linux for building ATLAS
  2008-04-05 23:53     ` Brian Dessent
@ 2008-04-06  6:37       ` Brian Dessent
  0 siblings, 0 replies; 7+ messages in thread
From: Brian Dessent @ 2008-04-06  6:37 UTC (permalink / raw)
  To: gcc-help; +Cc: Dennis Wassel

Brian Dessent wrote:

> For example I seem to recall a recent PR in which gmp was configured on
> e.g. sparc-sun-solaris2.10 but it detected that the machine was really
> sparc64-* and built binaries of the wrong flavor, leading to an error in
> the gcc build when it tried to link the stage 1 xgcc.

For the sake of the archives, it was PR 35628 and it was powerpc-darwin
not sparc: <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35628>.  In any
case, the solution was to configure gmp and mpfr with explicit
--host=powerpc-darwin so that they didn't try to build 64 bit libraries.

Brian

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

end of thread, other threads:[~2008-04-05 23:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-03  9:02 how to enable -m64 on x86-linux for building ATLAS Dennis Wassel
2008-04-03 10:27 ` Andrew Haley
2008-04-03 17:22 ` Matthew Woehlke
2008-04-05  5:40 ` Brian Dessent
2008-04-05 13:01   ` Dennis Wassel
2008-04-05 23:53     ` Brian Dessent
2008-04-06  6:37       ` Brian Dessent

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