Can't create shared lib on HPUX 10.20 with egcs v1.0.1
Graham Hudspith
ghudspit@mltsa.uk.lucent.com
Thu Jan 8 05:45:00 GMT 1998
Dear EGCS,
Built and installed:
gcc version egcs-2.90.23 980102 (egcs-1.0.1 release)
on HPUX 10.20 using './configure --with-gnu-as' with GNU as:
GNU assembler version 2.8.1 (hppa1.1-hp-hpux10.20)
Can't seem to build a shared library that involves an STL
^^^^^^^^^^^^^^^
container (can build shared libraries otherwise).
^^^^^^^^^
The annoying thing is that this works perfectly well under
GNU v2.7.2.1!
I would include the makefiles, but these are for an obscure
(though wonderful, of course) Lucent version of make called 'nmake'.
Originally I had the declaration 'static int_vec my_vec;' inside
int_add.C, with some access functions to add and get integers
from this private data structure. This compiled under GNU v2.7.2.1.
However, when it ceased to compile under egcs v1.0.1, I moved
the data itself into an unshared file in the feeble hope that this
would help (it did not). Am I doing something hideously stupid
here? Or is there a genuine problem? Is GNU v2.7.2.1 wrong?
Here are some noddy example files:
============================= int_vec.h =============================
#include <vector.h>
typedef vector<int> int_vec;
extern int_vec my_vec;
extern int int_add (const int an_int);
============================= int_add.C =============================
#include <int_vec.h>
int int_add (const int an_int)
{
my_vec.push_back (an_int);
return 0;
}
============================= make output ===========================
+ c++ -g -fpic -fpcc-struct-return
-I/apps/gcc/egcs1.0/lib/gcc-lib/hppa1.1-hp-hpux10.20/egcs-2.90.23/include
-I/usr/include -I- -I. -D_TRACE_ -c int_add.C
+ c++ -shared -g -fpic -fpcc-struct-return -D_TRACE_ -o libfoo.sl
int_add.o
/usr/ccs/bin/ld: DP relative code in file
/apps/gcc/egcs1.0/lib/libstdc++.a(iostream.o) - shared library must be
position
independent. Use +z or +Z to recompile.
collect2: ld returned 1 exit status
make: *** exit code 1 making libfoo.sl
============================= main.C =============================
#include <iostream.h>
#include <int_vec.h>
int_vec my_vec;
int main ()
{
const int test_int = 42;
(void) int_add (test_int);
cout << "Test int = " << test_int;
cout << ", popped int = " << my_vec[0] << endl;
return 0;
}
--
Graham Hudspith, Transmission Dev Group, | Email:
graham.hudspith@lucent.com
Lucent Technologies Network Systems (UK),|
Swindon Road, Malmesbury, |
Wiltshire SN16 9NA, UK. | Phone: +44 1666 832372/822861
More information about the Gcc-bugs
mailing list