On ubuntu-13.04, I got an error when creating an executable from shared libraries using GCC-4.7.3 provided by the linux distribution.
I think the problem is between libpng and zlib (the former uses the latter), but I don't know why.
Firstly, my team:
$ gfortran -o test_muesli_config_fml test_muesli_config_fml.o -fopenmp
-Wl,--rpath,/usr/local/lib/muesli /usr/local/lib/muesli/libfml.so -lstdc++
-Wl,--rpath,/usr/lib /usr/lib/liblapack.so -Wl,--rpath,/usr/lib /usr/lib/libblas.so
-lpng -lz -lpthread -lreadline -lhistory
which gives the following error:
/usr/local/lib/muesli/libfml.so: undefined reference to `gzwrite'
/usr/local/lib/muesli/libfml.so: undefined reference to `gzopen'
/usr/local/lib/muesli/libfml.so: undefined reference to `gzclose'
/usr/local/lib/muesli/libfml.so: undefined reference to `gzread'
collect2: error: ld returned 1 exit status
But notice that is -lzpresent. After that, I added the linker option --trace-symbol=to get more information:
$ gfortran -o test_muesli_config_fml test_muesli_config_fml.o -fopenmp
-Wl,
-Wl,
-lpng -lz -lpthread -lreadline -lhistory -Wl,
which, in turn, gives the results:
/usr/local/lib/muesli/libfml.so: reference to gzwrite
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/libz.so: definition of gzwrite
/usr/local/lib/muesli/libfml.so: undefined reference to `gzwrite'
/usr/local/lib/muesli/libfml.so: undefined reference to `gzopen'
/usr/local/lib/muesli/libfml.so: undefined reference to `gzclose'
/usr/local/lib/muesli/libfml.so: undefined reference to `gzread'
collect2: error: ld returned 1 exit status
therefore gzwritelocated in libz.so, but the linker does not use it!
By chance, I decided to remove the parameter -lpng(in fact, the libpng library is not used), and my problem is solved! Why?
-, GCC-4.7.3 ( - ), , -lpng -lz!
?
, ( USE libpng) .
2013-10-08
, ubuntu-13.04: Linux (Fedora 16 - Ubuntu-10.04), , .
ubuntu. .
2013-10-09
https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/1237270