I performed the two steps but compiler exits with error.
My steps are here:
$ pgf77 -fPIC -c dummy.F
$ pgf77 -fPIC -shared -o util.o dummy.o
/usr/bin/ld: dummy.o: relocation R_X86_64_PC32 against `__pgio_ini’ can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
What compiler version are you using? Which OS? Also, what is the output of the command “pgf77 -fPIC -shared -o util.o dummy.o -v”? Is “dummy.F” small enough that you post it?
I used hello.f instead of dummy.F, the error still happened.
$pgf77 -fPIC -c hello.f
$pgf77 -fPIC -shared -o util.so hello.o -v
/usr/bin/ld /usr/lib64/crti.o /picb/home2/xiezhq/Applications/pgi/linux86-64/7.0-6/libso/trace_init.o /usr/lib/gcc/x86_64-redhat-linux/3.4.5/crtbeginS.o -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 /picb/home2/xiezhq/Applications/pgi/linux86-64/7.0-6/lib/pgi.ld -L/picb/home2/xiezhq/Applications/pgi/linux86-64/7.0-6/libso -L/picb/home2/xiezhq/Applications/pgi/linux86-64/7.0-6/lib -L/usr/lib64 -L/usr/lib/gcc/x86_64-redhat-linux/3.4.5 -rpath /picb/home2/xiezhq/Applications/pgi/linux86-64/7.0-6/libso -rpath /picb/home2/xiezhq/Applications/pgi/linux86-64/7.0-6/lib hello.o -o util.so -shared -lpgftnrtl -lnspgc -lpgc -lrt -lpthread -lm -lgcc -lc -lgcc /usr/lib/gcc/x86_64-redhat-linux/3.4.5/crtendS.o /usr/lib64/crtn.o
/usr/bin/ld: hello.o: relocation R_X86_64_PC32 against `__pgio_ini’ can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
pgf77-Fatal-linker completed with exit code 1
It reported error:
/usr/bin/ld: hello.o: relocation R_X86_64_PC32 against `__pgio_ini’ can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
We were able finally reproduce the problem and found a solution. The fix will be available in PGI 7.0-7 currently scheduled for release on August 2th, 2007.