This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

G++ 2.95.2 installation problem on IRIX6.2, PLUS PATCH


Hi,

I just installed gcc/g++ version 2.95.2 (comes with libstdc++ 2.10.0) on an
Irix 6.2 system.
I configured the two bundles with:
  $ ../../gcc-2.95.2/configure --prefix=/u/wavelet --enable-shared --enable-threads --enable-languages=c,c++

So now I get:
  $ g++ -v
  Reading specs from /u/wavelet/lib/gcc-lib/mips-sgi-irix6.2/2.95.2/specs
  gcc version 2.95.2 19991024 (release)





And it compiles, too.





Unfortunately, during linking, I get about two dozen warnings of the style:
  $ g++ main.o
  ld32: WARNING 85: definition of __throw in /u/wavelet/lib/gcc-lib/mips-sgi-irix6.2/2.95.2/libgcc.a(_eh.o) preempts that definition in /u/wavelet/lib/gcc-lib/mips-sgi-irix6.2/2.95.2/libstdc++.so.
  ...

The resulting binary seems to run OK, though.






This is NOT really a gcc bug, more of an IRIX linker bug (the 6.5 linker has
no problems).  Nevertheless, g++ should work on IRIX 6.2, as well, so a
workaround should be given.

I found the same problem described in install/SPECIFIC, albeit for
alpha*-dec-osf* platforms.







So I fooled around with it for a bit, tried some possibilities, and noted
my recommendations in the install/* files.

Attached to this mail is a context diff which has all my additional comment/
new files.

Note it only affects files in the install/ directory.
And it only adds stuff, this will not affect any other configuration/system.


To apply this patch, move INTO gcc-2.95.2.  Then do
  $ patch -Np1 < gcc-2.95.2-irix6.2-shlibstdc++.patch
Done.






seeya,
jon.

------------------------------------------------------------------------
Jon Sablatnig				"He who laughs, lasts."
jhs@cs.tu-berlin.de			I disclaim everything.
diff -Narcp gcc-2.95.2/install/SPECIFIC gcc-2.95.2.patch/install/SPECIFIC
*** gcc-2.95.2/install/SPECIFIC	Mon Oct 25 09:02:12 1999
--- gcc-2.95.2.patch/install/SPECIFIC	Fri Mar 24 21:42:04 2000
*************** get=i686-pc-udk --exec-prefix=udk-
*** 408,413 ****
--- 408,461 ----
     functions. I can only recall seeing two of them: inet_ntoa, and
     semctl.
     
+    If you install a shared libstdc++ and then link a non-trivial C++
+    program (for example, gcc/testsuite/g++.other/delete3.C), some versions
+    of the IRIX linker generate spurious preemption warnings about supposedly
+    multiply-defined symbols (for example, nothrow, __throw and
+    terminate(void)).  This affects all currently available linkers for IRIX
+    6.2, that's `ld -V` up to and including 7.20.  The bug is fixed in the
+    IRIX 6.5 linker (`ld -V` 7.30 and upwards).The root of the problem
+    is the same as described in the alpha*-dec-osf* section, namely a partial
+    duplication of symbols from libgcc in libstdc++.
+ 
+    There are several ways around this:
+       * You could remove libstdc++.so*.
+       * You could simply ignore the warnings.  The linked programs _seem_ to
+         work fine.  So this should be ok.
+       * If the page or so of warnings annoys you, you could add the option
+         -Wl,-woff,85 to gcc at link-time.  This will shut up the linker.
+ 	Of course you won't see _other_ preemption warnings, either.  This
+ 	is usually ok (although there are situations where a missed preemption
+ 	warning can cause the executable to run incorrectly).
+       * You can move all the symbols from libgcc to libstdc++.  This is the
+         same solution as is described in section alpha*-dec-osf*, and the
+ 	same caveats apply.  For your convenience, the description is copied
+ 	below.
+ 
+    If you do decide to move the libgcc-symbols to libstdc++, _beware_
+    that this may bring you binary-compatibility problems in the future,
+    if you don't use the same work-around next time you build libstdc++:
+    if programs start to depend on libstdc++ to provide symbols that used
+    to be only in libgcc, you must arrange that libstdc++ keeps providing
+    them, otherwise the programs will have to be relinked.
+ 
+    The magic spell is to add -Wl,-all,-lgcc,-none to the definition of
+    macro SHDEPS in libstdc++/config/irix5.ml _before_
+    mips-sgi-irix6.2/libstdc++/Makefile is created (a [47]patch that does
+    just that is available). If the Makefile already exists, run
+    ./config.status within directory mips-sgi-irix6.2/libstdc++ (and
+    mips-sgi-irix6.2/ieee/libstdc++, if it also exists). Remove any
+    existing libstdc++.so* from such directories, and run make
+    all-target-libstdc++ in the top-level directory, then make
+    install-target-libstdc++.
+    
+    If you have already removed the build tree, you may just remove
+    libstdc++.so.2.10.0 from the install tree and re-create it with the
+    command gcc -shared -o libstdc++.so.2.10.0
+    -Wl,-all,-lstdc++,-lgcc,-none -lm. If the ieee sub-directory exists,
+    repeat this command in it, with the additional flag -mieee.
+ 
+ 
     See [38]http://reality.sgi.com/ariel/freeware for more information
     about using GCC on IRIX platforms.
       _________________________________________________________________
*************** References
*** 582,584 ****
--- 630,633 ----
    44. http://www.xraylith.wisc.edu/~khan/software/gnu-win32/
    45. http://www.goof.com/pcg/os2/
    46. http://gcc.gnu.org/install/index.html
+   47. http://gcc.gnu.org/install/irix6.2-shlibstdc++.patch
diff -Narcp gcc-2.95.2/install/irix6.2-shlibstdc++.patch gcc-2.95.2.patch/install/irix6.2-shlibstdc++.patch
*** gcc-2.95.2/install/irix6.2-shlibstdc++.patch
--- gcc-2.95.2.patch/install/irix6.2-shlibstdc++.patch	Fri Mar 24 20:20:24 2000
***************
*** 0 ****
--- 1,27 ----
+ Index: libstdc++/ChangeLog
+ from  Jon Sablatnig  <jhs@cs.tu-berlin.de>
+ 	
+ 	* config/irix5.ml: Force all of libgcc into libstdc++, to avoid
+ 	multiply-defined linker errors.
+ 	
+ Index: libstdc++/config/irix5.ml
+ ===================================================================
+ RCS file: /egcs/carton/cvsfiles/egcs/libstdc++/config/irix5.ml,v
+ retrieving revision 1.2
+ diff -u -r1.2 irix5.ml
+ --- libstdc++/config/irix5.ml	1998/08/30 21:18:41	1.2
+ +++ libstdc++/config/irix5.ml	2000/03/24 13:00:00
+ @@ -3,4 +3,12 @@
+  
+  LIBS     = $(ARLIB) $(ARLINK) $(SHLIB) $(SHLINK)
+  DEPLIBS  = ../$(SHLIB)
+ -SHDEPS   = -lm
+ +SHDEPS   = -lm -Wl,-all,-lgcc,-none
+ +# Some testcases in the testsuite required symbols from libgcc, say,
+ +# __pure_virtual, that would not have been copied into libstdc++
+ +# without this -Wl switch above.  But __pure_virtual depended on other
+ +# symbols of libgcc that had been copied to libstdc++.  However,
+ +# the IRIX ld up to (and including) version `ld -V` <= 7.20 would report
+ +# such symbols as duplicates, and create spurious warnings.  Forcing some
+ +# symbols from libgcc into libstdc++ ensures that we don't get such late
+ +# undefined symbols, avoiding the bogus multiple-definition warnings.
diff -Narcp gcc-2.95.2/install/specific.html gcc-2.95.2.patch/install/specific.html
*** gcc-2.95.2/install/specific.html	Mon Oct 25 09:02:12 1999
--- gcc-2.95.2.patch/install/specific.html	Fri Mar 24 21:44:36 2000
*************** happen are when there are library functi
*** 446,451 ****
--- 446,506 ----
  structures. There are very few such library functions. I can only recall
  seeing two of them: inet_ntoa, and semctl. </p>
  
+ <p>If you install a shared libstdc++ and then link a non-trivial C++
+ program (for example, <code>gcc/testsuite/g++.other/delete3.C</code>), some
+ versions of the IRIX linker generate spurious preemption warnings about
+ supposedly multiply-defined symbols (for example, <code>nothrow</code>,
+ <code>__throw</code> and <code>terminate(void)</code>).  This affects all
+ currently available linkers for IRIX 6.2, that's <code>`ld -V`</code> up
+ to and including 7.20.  The bug is fixed in the IRIX 6.5 linker
+ (<code>`ld -V`</code> 7.30 and upwards).  The root of the problem
+ is the same as described in the alpha*-dec-osf* section, namely a partial
+ duplication of symbols from <code>libgcc</code> in <code>libstdc++</code>. </p>
+ 
+ </p>There are several ways around this:
+ <ul>
+   <li>You could remove <code>libstdc++.so*</code>.</li>
+ 
+   <li>You could simply ignore the warnings.  The linked programs <b>seem</b>
+   to work fine.  So this should be ok.</li>
+ 
+   <li>If the page or so of warnings annoys you, you could add the option
+   <code>-Wl,-woff,85</code> to <code>gcc</code> at link-time.  This will shut up the linker.
+   Of course you won't see <b>other</b> preemption warnings, either.  This
+   is usually ok (although there are situations where a missed preemption
+   warning can cause the executable to run incorrectly).</li>
+ 
+   <li>You can move all the symbols from <code>libgcc</code> to
+   <code>libstdc++</code>.  This is the same solution as is described in
+   section alpha*-dec-osf*, and the same caveats apply.  For your convenience,
+   the description is copied below.</li>
+ </ul></p>
+ 
+ <p>If you do decide to move the <code>libgcc</code>-symbols to
+ <code>libstdc++</code>, <b>beware</b> that this may bring you
+ binary-compatibility problems in the future, if you don't use the same
+ work-around next time you build <code>libstdc++</code>: if programs start
+ to depend on <code>libstdc++</code> to provide symbols that used to be only
+ in <code>libgcc</code>, you must arrange that <code>libstdc++</code> keeps
+ providing them, otherwise the programs will have to be relinked.</p>
+ 
+ <p>The magic spell is to add -Wl,-all,-lgcc,-none to the definition of
+ macro <code>SHDEPS</code> in <code>libstdc++/config/irix5.ml</code>
+ <b>before</b> <code>mips-sgi-irix6.2/libstdc++/Makefile</code> is created
+ (a <a href="irix6.2-shlibstdc++.patch">patch</a> that does just that is
+ available). If the Makefile already exists, run <code>./config.status</code>
+ within directory <code>mips-sgi-irix6.2/libstdc++</code> (and
+ <code>mips-sgi-irix6.2/ieee/libstdc++</code>, if it also exists). Remove
+ any existing <code>libstdc++.so*</code> from such directories, and run
+ <code>make all-target-libstdc++</code> in the top-level directory, then
+  <code>make install-target-libstdc++</code>.</p>
+    
+ <p>If you have already removed the build tree, you may just remove
+ <code>libstdc++.so.2.10.0</code> from the install tree and re-create it
+ with the command <code>gcc -shared -o libstdc++.so.2.10.0
+ -Wl,-all,-lstdc++,-lgcc,-none -lm</code>. If the ieee sub-directory exists,
+ repeat this command in it, with the additional flag <code>-mieee</code>.</p>
+ 
  <p>See <a href="http://reality.sgi.com/ariel/freeware/"> 
  http://reality.sgi.com/ariel/freeware</a> for more information about using GCC on IRIX platforms.</p>
  

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]