public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Getting an error message from gcc libstdc++.a on Solaris 2.5.1 .
@ 2000-05-28 23:57 Penias, Nissim
  2000-05-29  1:35 ` Vinu V Nair
  2000-05-29  1:43 ` Martin v. Loewis
  0 siblings, 2 replies; 3+ messages in thread
From: Penias, Nissim @ 2000-05-28 23:57 UTC (permalink / raw)
  To: 'gcc-help@gcc.gnu.org'

Hello ,
I  need some help to correctly compile gcc on solaris 2.5.1 sparc .

I read all the installation notes that came with the product and what i did is built the native 
gcc compiler on a solaris sparc2.5.1 machine .

I must mension the way that i built in order for you to know :
1) I opened the tar/gz file .
2) I created a different directory out of the _srcdir_ where i opened the package of the gcc and called it _objdir_
    as you say under the configuration notes .
3) i ren from the _objdir_ ../gcc../configure  to difault install  in /usr/local .
4) After it finished with no errors ( status 0 ) i ren 'make bootstrap' to build the product .
5) After the make finished i ren 'make install' to finish the installation in /usr/local .

Remark :
*******
I must say that the make that i am using is the gnu make version 3-78.1 and not the system make .

The problem occurs after i am trying to compile using these two commands :
g++ -c test_lib.cpp -fPIC
g++ -o xxx.so test_lib.o -shared

The error message that i get is :
<unknown> 0x1668 /usr/local/lib/gcc-lib/sparc-sun-solaris2.5.1/2.95.2/libstdc++.a(iovfscanf.o)
ld: fatal :relocation remain against allocatable but non writable section collect2: ld returned 1 exit status . 
ld: fatal:relocation 1 exit status 

I also downloaded the compiled version of gcc.2.95.1 from sunfreeware.com and i have the problem ( meens that i get the same error messages ! ) .

I will be happay if you will be able to solve my problem or help me solving it .

Regards ..,

Nissim Penias .
Unix System Administrator .
Development Computing Services .
Computer Associates International .
Office Number : 972-3-7658308 .
Cellular Phone : 972-53-994549 .
mailto : penni01@cai.com .

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

* Re: Getting an error message from gcc libstdc++.a on Solaris 2.5.1.
  2000-05-28 23:57 Getting an error message from gcc libstdc++.a on Solaris 2.5.1 Penias, Nissim
@ 2000-05-29  1:35 ` Vinu V Nair
  2000-05-29  1:43 ` Martin v. Loewis
  1 sibling, 0 replies; 3+ messages in thread
From: Vinu V Nair @ 2000-05-29  1:35 UTC (permalink / raw)
  To: Penias, Nissim; +Cc: 'gcc-help@gcc.gnu.org'

 For building shared libs, u have to give --enable-shared to the configure
program.

vinu

Vinu V. Nair   
Software Engineer
Silicon Automation Systems Limited
5281461/5281229-2213   

 "The reasonable man adapts himself to the world; the unreasonable
  man persists to adapt the world to himself. Therefore all progress
  depends on the unreasonable." -- G. Bernard. Shaw.

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

* Re: Getting an error message from gcc libstdc++.a on Solaris 2.5.1 .
  2000-05-28 23:57 Getting an error message from gcc libstdc++.a on Solaris 2.5.1 Penias, Nissim
  2000-05-29  1:35 ` Vinu V Nair
@ 2000-05-29  1:43 ` Martin v. Loewis
  1 sibling, 0 replies; 3+ messages in thread
From: Martin v. Loewis @ 2000-05-29  1:43 UTC (permalink / raw)
  To: Nissim.Penias; +Cc: gcc-help

> I must mension the way that i built in order for you to know :

It seems that you followed the instructions carefully.

> The problem occurs after i am trying to compile using these two commands :
> g++ -c test_lib.cpp -fPIC
> g++ -o xxx.so test_lib.o -shared
> 
> The error message that i get is :
> <unknown> 0x1668 /usr/local/lib/gcc-lib/sparc-sun-solaris2.5.1/2.95.2/libstdc++.a(iovfscanf.o)
> ld: fatal :relocation remain against allocatable but non writable section collect2: ld returned 1 exit status . 
> ld: fatal:relocation 1 exit status 

I'm not exactly sure what the problem is; it may be that a patch from
Sun might correct this behaviour - you may want to contact Sun
support.

The cause of this problem apparently is that libstdc++ was not
compiled with -fPIC; therefore, when building a shared library, the
linker complains. However, I thought that Solaris should handle this
case.

One solution is to configure gcc with --enable-shared (add
--enable-threads while you recompile it); that will give you a
libstdc++.so, which is won't be included into test_lib.o. The downside
is that you'll have to arrange that libstdc++.so is located on your
system (e.g. via LD_LIBRARY_PATH).

Another alternative is to build a libstdc++.a which is compiled with
-fPIC. The GCC build process does not support this setup; you'd have
to arrange for that manually.

Regards,
Martin

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

end of thread, other threads:[~2000-05-29  1:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-28 23:57 Getting an error message from gcc libstdc++.a on Solaris 2.5.1 Penias, Nissim
2000-05-29  1:35 ` Vinu V Nair
2000-05-29  1:43 ` Martin v. Loewis

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