http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42679
--- Comment #21 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-01-04 10:58:11 UTC --- (In reply to comment #19) > (In reply to comment #16) > > I am using "-fpic/-fPIC" and in fact am using: > > // g++ -g -O0 main.cpp -ldl > > // g++ -g -O0 -rdynamic -c -fPIC -o library.o library1.cpp > > // g++ -shared -Wl,-export-dynamic -o library.so library.o > > What if you use -fPIC for the last step? (The manual does say it's necessary > for predictable results when using -shared) As I said previously, the commands above should be using -fPIC when creating the .so, and when I tested it I found that using -fPIC for the first command, i.e. when compiling main.cpp, prevents the crash.