Lorenzo Pesce wrote: >>>> When you use gcc to build *your* libraries, *you* must compile >>>> with -fPIC. >>> >>> I already do that. The problem is with libgfortran.* not with my >>> libraries! >> >> Now you tell me. Have a look at the gcc build log to see if it really >> did compile some of the libgfortran sources without -fPIC. > > Forgive me again, which is the file I should look for? > I am looking in gcc-4.1.1/objdir and this is all I can find: Unless you looged the build, you won't have it all, but this looks as though the PIC flag was correctly set: > > x86_64-unknown-linux-gnu/libgfortran/libtool:140:pic_flag=" -fPIC -DPIC" > x86_64-unknown-linux-gnu/libgfortran/config.cache:259:ac_cv_prog_cc_pic=${ac_cv_prog_cc_pic=' > -fPIC -DPIC'} > x86_64-unknown-linux-gnu/libgfortran/config.log:175:ltconfig:687:checking > that /home/lpesce/GCC/gcc-4.1.1/objdir/./gcc/xgcc PIC flag -fPIC -DPIC > works. > x86_64-unknown-linux-gnu/libgfortran/config.log:176:ltconfig:697: > /home/lpesce/GCC/gcc-4.1.1/objdir/./gcc/xgcc > -B/home/lpesce/GCC/gcc-4.1.1/objdir/./gcc/ > -B/usr/local/x86_64-unknown-linux-gnu/bin/ > -B/usr/local/x86_64-unknown-linux-gnu/lib/ -isystem > /usr/local/x86_64-unknown-linux-gnu/include -isystem > /usr/local/x86_64-unknown-linux-gnu/sys-include -c -std=gnu99 -O2 -g > -O2 -fPIC -DPIC -DPIC conftest.c 1>&5 > x86_64-unknown-linux-gnu/libgfortran/config.log:5096:ac_cv_prog_cc_pic=' > -fPIC -DPIC' > x86_64-unknown-linux-gnu/32/libgfortran/libtool:140:pic_flag=" -fPIC -DPIC" > x86_64-unknown-linux-gnu/32/libgfortran/config.cache:259:ac_cv_prog_cc_pic=${ac_cv_prog_cc_pic=' > -fPIC -DPIC'} > x86_64-unknown-linux-gnu/32/libgfortran/config.log:175:ltconfig:687:checking > that /home/lpesce/GCC/gcc-4.1.1/objdir/./gcc/xgcc PIC flag -fPIC -DPIC > works. > x86_64-unknown-linux-gnu/32/libgfortran/config.log:176:ltconfig:697: > /home/lpesce/GCC/gcc-4.1.1/objdir/./gcc/xgcc > -B/home/lpesce/GCC/gcc-4.1.1/objdir/./gcc/ > -B/usr/local/x86_64-unknown-linux-gnu/bin/ > -B/usr/local/x86_64-unknown-linux-gnu/lib/ -isystem > /usr/local/x86_64-unknown-linux-gnu/include -isystem > /usr/local/x86_64-unknown-linux-gnu/sys-include -m32 -c -std=gnu99 > std=gnu99 -O2 -g -O2 -Wunknown-pragmas -fPIC -DPIC -DPIC conftest.c 1>&5 > x86_64-unknown-linux-gnu/32/libgfortran/config.log:5146:ac_cv_prog_cc_pic=' > -fPIC -DPIC' > >>> Java seems to need the object files from libgfortran for the JNI >>> libraries to work properly >> >> No it doesn't. > > Sorry, I did not report all the steps. I am constructing some jni > libraries from > some fortran libraries. I seem to be able to use the fortran libraries > as jni > if and only if the objects from libgfortran are included into the > dynamically > linked jni library. Well, that is very odd. As long as you link against all the libraries, you should not need any static libraries. We need specifics. What you are describing is a bug; we need to know exactly what happens when you try to link dynamically with FORTRAN and Java. Anything else is doomed to fail. Andrew.