Hi: I am trying to create a shared library in HP Unix 10.20. I gave the command like this: g++ -o test.so -shared -I/opt/java/include -I/opt/java/include/hp-ux test.cpp -static -lc I had included /opt/java/include bcoz it has jni.h and i had included /opt/java/include/hp-ux bcoz it has jni_md.h When i tried to create a shared lib (by issuing the above command), it throws the error message as follows: /usr/ccs/bin/ld: DP relative code in file /var/tmp/ccaGpcIE.o - shared library m ust be position independent. Use +z or +Z to recompile. collect2: ld returned 1 exit status Could anyone please help me to solve this? Thanks a lot.
Hi - Unfortunately, I do not have a solution. I really know nothing about the HP compiler/linker. Every 'unix' system I've worked on is different when it comes to shared libraries. Looking at your command line, I am suspicious about the "-static" option. What does it do? I guess I would try running the compile and link separately: g++ -c xxxx.cpp -I...... g++ -o .....xxxx.o .... And also read your local man pages regarding shared libraries. At least figure out what the z/Z option does. Regards, Guy [ February 06, 2002: Message edited by: Guy Allard ]