Public bug reported: I got an error when building an executable from shared libraries, using GCC-4.7.3 provided by the linux distribution. I guess the problem is between libpng and zlib (the former uses the latter), but I don't know why. The following problem doesn't appear if I use a GCC version completely compiled by myself. Moreover, it doesn't occur on at least two other linux distros (Fedora 16 and ubuntu-10.04) ---------------------- Description: when I issue the command: $ 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 -Wl,--trace-symbol=gzwrite
I obtained the error: /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 If I remove the -lpng option (which is actually not used), the error disappear! In addition, a different try with another program (which USE libpng) leads to a successful build. ProblemType: Bug DistroRelease: Ubuntu 13.04 Package: gcc 4:4.7.3-1ubuntu10 ProcVersionSignature: Ubuntu 3.8.0-31.46-generic 3.8.13.8 Uname: Linux 3.8.0-31-generic x86_64 ApportVersion: 2.9.2-0ubuntu8.3 Architecture: amd64 Date: Wed Oct 9 10:11:16 2013 InstallationDate: Installed on 2012-11-07 (335 days ago) InstallationMedia: Ubuntu 12.10 "Quantal Quetzal" - Release amd64 (20121017.5) MarkForUpload: True SourcePackage: gcc-defaults UpgradeStatus: Upgraded to raring on 2013-05-12 (149 days ago) ** Affects: gcc-defaults (Ubuntu) Importance: Undecided Status: New ** Tags: amd64 apport-bug raring -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1237270 Title: linker: '-lpng' inhibits '-lz' To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/1237270/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs