On Thu, 26 Jul 2012, Fabian Groffen wrote:
Libtool apparently figures out what libs to link to by watching what the
compiler does. It applies duplicate elimination on the result of that
(don't know why) causing -lgcc_s -lc -lgcc_s to be turned into -lc
-lgcc_s. As result, the library aborts on Solaris when it throws an
exception because -lc comes before -lgcc_s. On Sparc, the result is
-lgcc_s -lc, probably because both were double.
I'm not sure this can be properly fixed by making sure -lgcc_s -lc
remains, since GCC purposely emits the same library multiple times, so I
decided to just disable the duplicate elimination for Solaris.
Unfortunately, this fix is not working for me (not fixing issue I
already encountered). I do see libtool's exceptions test pass (for a
32-bit build) , but it does not work for my own C++ application as a
64-bit build. It seems that GCC itself is causing the harm (or is
just plain not working). With no specific request for any of these
libraries, this is the list of libraries that GCC 4.7.1 is passing to
collect2 while building my C++ test application:
-lstdc++ -lm -lc -lgomp -lgcc_s -lgcc -lpthread -lc -lgcc_s -lgcc
I tried running collect2 manually with different permutations but was
unable to find one which gets C++ exceptions working.
The Sun/Oracle compiler has never had a problem with C++ exceptions.
Bob
--
Bob Friesenhahn
bfrie...@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/