Bug 39747 - Installation documentation should suggest building libgmp as PIC for building with libjava
Summary: Installation documentation should suggest building libgmp as PIC for building...
Status: RESOLVED WONTFIX
Alias: None
Product: classpath
Classification: Unclassified
Component: classpath (show other bugs)
Version: 0.98
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: build, documentation
Depends on:
Blocks: 44415
  Show dependency treegraph
 
Reported: 2009-04-13 05:32 UTC by Andrew Pinski
Modified: 2021-10-19 07:08 UTC (History)
7 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2009-10-05 20:06:26


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2009-04-13 05:32:55 UTC
I compiled GMP as a static library only on darwin.
So when compiling the trunk or the 4.4 branch on powerpc-darwin, I get:
/usr/bin/ld: /usr/local/lib/libgmp.a(popcount.o) has local relocation entries in non-writable section (__TEXT,__text)

This started to happen between 134948 and 144367.
Comment 1 Andrew Pinski 2009-04-13 05:34:39 UTC
So it looks like GMP is needed now as a target library for libgcj to work and this is not documented anywhere I think.
Comment 2 Richard Biener 2009-04-13 08:17:44 UTC
It is?  Anyway, you should build static gmp with -fPIC.
Comment 3 Jakub Jelinek 2009-04-27 06:54:35 UTC
This doesn't look like a GCC bug, but user error.
Comment 4 pinskia@gmail.com 2009-04-27 07:16:56 UTC
Subject: Re:  [4.4/4.5 Regression] libjavamath is linking against libgmp



Sent from my iPhone

On Apr 26, 2009, at 11:54 PM, "jakub at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org 
 > wrote:

>
>
> ------- Comment #3 from jakub at gcc dot gnu dot org  2009-04-27  
> 06:54 -------
> This doesn't look like a GCC bug, but user error.

It is a gcc bug as this dependency is not documented this way. At  
least I could not find the documention for this one.

>
>
>
> -- 
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39747
>
Comment 5 Andrew Pinski 2009-10-05 20:06:26 UTC
Confirmed.
Comment 6 David Biesack 2010-01-15 16:45:42 UTC
I had this problem on a Linux x86_64 build, manifested with the error
 /usr/local/lib/libgmp.so: could not read symbols: File in wrong format
 collect2: ld returned 1 exit status

( http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42750 )

I'm adding that text here so that if someone else has that problem
and searches for it, they can find this bug entry.

How does one configure gmp to build correctly so that it can be used by gcc?
I can't find any doc in the gmp configure/texinfo that describes how to do that.
I ran configure for it and it says -fPIC works in the log, but it does not put -fPIC in the Makefile. I explicitly added it to the CFLAGS in my Makefile 

 CFLAGS = -O2 -pedantic -m64 -mtune=k8 -fPIC

and rebuilt it; make check work (in gmp).

Comment 7 Richard Biener 2012-01-16 13:41:15 UTC
Classpath install requirements are not documented in install.texi at all so
there is no precedent for a classpath related change to qualify as GCC
regression.  What is at fault is that when building a shared library
classpath configury does not properly test for a usable libgmp.

Re-targeting to classpath, removing regression markers.

install.texi could have an enhancement bug to mention classpath and its
configury.
Comment 8 Eric Gallager 2021-10-19 01:40:07 UTC
Is this still relevant now that gcc no longer ships with java?
Comment 9 Mark Wielaard 2021-10-19 07:08:54 UTC
(In reply to Eric Gallager from comment #8)
> Is this still relevant now that gcc no longer ships with java?

No, not really.