This is the mail archive of the 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]

Re: Getting an error message from gcc libstdc++.a on Solaris 2.5.1 .

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

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

One solution is to configure gcc with --enable-shared (add
--enable-threads while you recompile it); that will give you a, which is won't be included into test_lib.o. The downside
is that you'll have to arrange that 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.


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