public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/67728] New: Build fails when cross-compiling with in-tree GMP
@ 2015-09-26 22:18 bneumeier at gmail dot com
  2015-09-26 22:45 ` [Bug bootstrap/67728] Build fails when cross-compiling with in-tree GMP and ISL pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: bneumeier at gmail dot com @ 2015-09-26 22:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67728

            Bug ID: 67728
           Summary: Build fails when cross-compiling with in-tree GMP
           Product: gcc
           Version: 5.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bneumeier at gmail dot com
  Target Milestone: ---

Created attachment 36399
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36399&action=edit
Don't disable assembly when building GMP in-tree

GMP has an issue when it is being cross-compiled for certain machine
architectures without assembly loops: x86_64 to MIPS works fine, but x86_64 to
ARM and x86_64 to Sparc32 both fail to build correctly. I've verified that the
issue is triggered with GMP 5.1.3 and 6.0.0a; it may or may not apply with
older versions of GMP.

When GMP is being built as part of the GCC build with in-tree sources, GCC
disables assembly by configuring GMP with:

--host=none-${host_vendor}-${host_os} and
--target=none-${host_vendor}-${host_os}

This evokes the GMP issue, leading to the GCC build failing when it's being
cross-compiled (for the problematic architectures) and GMP is built in-tree.
The precise error I encountered was when linking ISL; the command:

/bin/bash ./libtool  --tag=CC   --mode=link arm-cbl-linux-gnueabihf-gcc  -g -O2
 -static-libstdc++ -static-libgcc  -o isl_test isl_test.o libisl.la
/tmp/build/build-gcc-4/./gmp/libgmp.la

fails with undefined references to __gmpn_invert_limb.

In Makefile.def, I see a comment saying that the reason that asm optimizations
are disabled for the GMP build is that it makes the bootstrap test of the
compiler more rigorous, which makes sense. On the other hand, breaking the
build for some machine architectures seems problematic!

I don't know enough about the build machinery in GCC to try to figure out how
to detect the particular problematic situation I've found and re-enable
assembly only for that case. All I did was verify that removing the configure
flags that disable assembly entirely from Makefile.def and then regenerating
Makefile.in corrects the problem -- which it does!

I don't know whether re-enabling assembly is the best solution, but it is the
best one I could come up with.


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

* [Bug bootstrap/67728] Build fails when cross-compiling with in-tree GMP and ISL
  2015-09-26 22:18 [Bug c/67728] New: Build fails when cross-compiling with in-tree GMP bneumeier at gmail dot com
@ 2015-09-26 22:45 ` pinskia at gcc dot gnu.org
  2015-09-27  2:18 ` bneumeier at gmail dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2015-09-26 22:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67728

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |bootstrap
            Summary|Build fails when            |Build fails when
                   |cross-compiling with        |cross-compiling with
                   |in-tree GMP                 |in-tree GMP and ISL

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Sounds like the bug is an issue with ISL rather than GMP itself.  I don't
normally building with ISL so I have never noticed the issue.

Also I think your patch is incorrect since there is a reason why we disable the
assembly version is because GMP nativelly tries to detect the current processor
and then use the assembler version for that.


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

* [Bug bootstrap/67728] Build fails when cross-compiling with in-tree GMP and ISL
  2015-09-26 22:18 [Bug c/67728] New: Build fails when cross-compiling with in-tree GMP bneumeier at gmail dot com
  2015-09-26 22:45 ` [Bug bootstrap/67728] Build fails when cross-compiling with in-tree GMP and ISL pinskia at gcc dot gnu.org
@ 2015-09-27  2:18 ` bneumeier at gmail dot com
  2015-09-28 11:06 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: bneumeier at gmail dot com @ 2015-09-27  2:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67728

--- Comment #2 from Brett Neumeier <bneumeier at gmail dot com> ---
Thanks for your swift comment!

I disagree that the bug is in ISL.  The problem is that gmp, although the build
appears successful, is *not* correctly built.  Six object files that should be
compiled and linked into gmplib.a are not built because they are only built
correctly when assembly is enabled. One of those is invert_limb.o, which
contains the symbol __gmpn_invert_limb, which is needed by ISL.

So the *bug* is in the GMP build, but the *consequence* of the bug is that ISL
cannot be linked.

I agree that my patch is not adequate, though -- I just tested and found that I
couldn't build an x86_64-to-arm cross-gcc when my patch is installed. The
configure for GMP crashes with:

configure: error: --target is not appropriate for GMP
Use --build=CPU-VENDOR-OS if you need to specify your CPU and/or system
explicitly.  Use --host if cross-compiling (see "Installing GMP" in the
manual for more on this).

Obviously the best way to address this situation is by getting GMP to build
properly for all architectures regardless of whether assembly is enabled. Until
or unless that's done, though, it seems like it would be worthwhile to do
*something* to address the issue on the GCC side, since that's where I (and
others, according to google) have tripped over it. Maybe a documentation
change, to say that GMP shouldn't be built in-tree when cross-compiling GCC? Or
something of that sort?


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

* [Bug bootstrap/67728] Build fails when cross-compiling with in-tree GMP and ISL
  2015-09-26 22:18 [Bug c/67728] New: Build fails when cross-compiling with in-tree GMP bneumeier at gmail dot com
  2015-09-26 22:45 ` [Bug bootstrap/67728] Build fails when cross-compiling with in-tree GMP and ISL pinskia at gcc dot gnu.org
  2015-09-27  2:18 ` bneumeier at gmail dot com
@ 2015-09-28 11:06 ` rguenth at gcc dot gnu.org
  2015-09-28 13:06 ` bernd.edlinger at hotmail dot de
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-09-28 11:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67728

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Is __gmpn_invert_limb supposed to be exported?  Or is ISL using private APIs
here?


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

* [Bug bootstrap/67728] Build fails when cross-compiling with in-tree GMP and ISL
  2015-09-26 22:18 [Bug c/67728] New: Build fails when cross-compiling with in-tree GMP bneumeier at gmail dot com
                   ` (2 preceding siblings ...)
  2015-09-28 11:06 ` rguenth at gcc dot gnu.org
@ 2015-09-28 13:06 ` bernd.edlinger at hotmail dot de
  2015-09-28 17:01 ` joseph at codesourcery dot com
  2015-10-03 16:19 ` bneumeier at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: bernd.edlinger at hotmail dot de @ 2015-09-28 13:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67728

Bernd Edlinger <bernd.edlinger at hotmail dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bernd.edlinger at hotmail dot de

--- Comment #4 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
at least this configuration works when doing cross-builds from X86_64 => ARM:


gmp -> ../gmp-4.3.2
mpc -> ../mpc-0.8.1
mpfr -> ../mpfr-2.4.2
isl -> ../isl-0.12.2


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

* [Bug bootstrap/67728] Build fails when cross-compiling with in-tree GMP and ISL
  2015-09-26 22:18 [Bug c/67728] New: Build fails when cross-compiling with in-tree GMP bneumeier at gmail dot com
                   ` (3 preceding siblings ...)
  2015-09-28 13:06 ` bernd.edlinger at hotmail dot de
@ 2015-09-28 17:01 ` joseph at codesourcery dot com
  2015-10-03 16:19 ` bneumeier at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: joseph at codesourcery dot com @ 2015-09-28 17:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67728

--- Comment #5 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
GMP does, or did, select an ABI at configuration time that may not be the 
same as that used by default by the compiler used to build it.  For 
example, if building on an x86_64 processor it might select a 64-bit ABI 
even if you have configured GCC for a 32-bit host.  If your goal is to 
make multiple-precision computations as fast as possible, choosing the ABI 
for that purpose makes sense - but for GCC's uses the requirement is to 
choose the same ABI as for the selected host, even if that's slower than 
some other ABI available on the processor.


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

* [Bug bootstrap/67728] Build fails when cross-compiling with in-tree GMP and ISL
  2015-09-26 22:18 [Bug c/67728] New: Build fails when cross-compiling with in-tree GMP bneumeier at gmail dot com
                   ` (4 preceding siblings ...)
  2015-09-28 17:01 ` joseph at codesourcery dot com
@ 2015-10-03 16:19 ` bneumeier at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: bneumeier at gmail dot com @ 2015-10-03 16:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67728

--- Comment #6 from Brett Neumeier <bneumeier at gmail dot com> ---
Created attachment 36441
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36441&action=edit
document symptoms of problem and workaround

Since the issue is a corner-case (it's only triggered when cross-compiling for
certain architectures, using recent versions of GMP, and with in-tree GMP and
ISL sources), and since there's an easy and obvious workaround, it seems
pointless to spend a lot of time trying to adjust the build machinery.

On the other hand, a something search reveals I'm not the only person to run
into this situation, so it seems worthwhile to at least document the
workaround. Here's a suggested paragraph -- it would have saved *me* a headache
and a few hours of frustration when I tripped across the problem, so perhaps it
will be helpful to someone else in the future?


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

end of thread, other threads:[~2015-10-03 16:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-26 22:18 [Bug c/67728] New: Build fails when cross-compiling with in-tree GMP bneumeier at gmail dot com
2015-09-26 22:45 ` [Bug bootstrap/67728] Build fails when cross-compiling with in-tree GMP and ISL pinskia at gcc dot gnu.org
2015-09-27  2:18 ` bneumeier at gmail dot com
2015-09-28 11:06 ` rguenth at gcc dot gnu.org
2015-09-28 13:06 ` bernd.edlinger at hotmail dot de
2015-09-28 17:01 ` joseph at codesourcery dot com
2015-10-03 16:19 ` bneumeier at gmail dot com

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