Opened 14 years ago

Last modified 7 years ago

#25042 assigned defect

g++-mp-4.3 aborts instead of catching exceptions

Reported by: jsanchez@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 1.8.2
Keywords: Cc:
Port: gcc43

Description (last modified by mf2k (Frank Schima))

Hello,

This is on Mac OS X 10.6.3 and using

Darwin myhostname 10.3.0 Darwin Kernel Version 10.3.0: Fri Feb 26 11:57:13 PST 2010; root:xnu-1504.3.12~1/RELEASE_X86_64 x86_64

which is a macbook pro

When testing my application, one of my regressions throws an exception. It is caught fine using the xcode g++ 4.2.1, but crashes on g++-mp-4.3. I investigated this and found that by removing "-lgcc_s.10.5" from the link line generated by the compiler, the exception is then properly caught.

The xcode compiler line is:

/usr/libexec/gcc/i686-apple-darwin10/4.2.1/collect2 -dynamic -arch x86_64 -macosx_version_min 10.6.3 -weak_reference_mismatches non-weak -o test1 -lcrt1.10.6.o -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/x86_64 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/x86_64 -L/usr/lib/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../.. CMakeFiles/models.dir/Arrhenius.o CMakeFiles/models.dir/ModelBase.o CMakeFiles/models.dir/ParameterDatabase.o CMakeFiles/models.dir/ReactionSet.o CMakeFiles/models.dir/DoubleEntry.o CMakeFiles/models.dir/SpeciesProduct.o CMakeFiles/models.dir/KEqModel.o CMakeFiles/models.dir/ProductModel.o CMakeFiles/models.dir/AddModel.o CMakeFiles/models.dir/OmegaDot.o CMakeFiles/models.dir/KbModel.o CMakeFiles/models.dir/GibbsFreeEnergy.o CMakeFiles/models.dir/KEqGibbsModel.o ../testing/CMakeFiles/test1.dir/test1.o -lstdc++ -lSystem -lgcc -lSystem

and the mac ports compiler line is

/opt/local/libexec/gcc/x86_64-apple-darwin10/4.3.4/collect2 -dynamic -arch x86_64 -macosx_version_min 10.6.3 -weak_reference_mismatches non-weak -o test1 -lcrt1.10.5.o -L/opt/local/lib/gcc43/gcc/x86_64-apple-darwin10/4.3.4 -L/opt/local/lib/gcc43/gcc/x86_64-apple-darwin10/4.3.4/../../.. CMakeFiles/models.dir/Arrhenius.o CMakeFiles/models.dir/ModelBase.o CMakeFiles/models.dir/ParameterDatabase.o CMakeFiles/models.dir/ReactionSet.o CMakeFiles/models.dir/DoubleEntry.o CMakeFiles/models.dir/SpeciesProduct.o CMakeFiles/models.dir/KEqModel.o CMakeFiles/models.dir/ProductModel.o CMakeFiles/models.dir/AddModel.o CMakeFiles/models.dir/OmegaDot.o CMakeFiles/models.dir/KbModel.o CMakeFiles/models.dir/GibbsFreeEnergy.o CMakeFiles/models.dir/KEqGibbsModel.o ../testing/CMakeFiles/test1.dir/test1.o -lstdc++ -lgcc_s.10.5 -lgcc -lSystem

Removing -lgcc_s.10.5 fixes the problem, since I suspect it was written for a previous version of the OS.

The stack trace of the problem is:

Program received signal SIGABRT, Aborted.
0x00007fff85cc9886 in __kill ()
(gdb) up
#1  0x00007fff85d69eae in abort ()
(gdb) 
#2  0x0000000100267c3e in uw_init_context_1 ()
(gdb) 
#3  0x0000000100268058 in _Unwind_Resume ()
(gdb) 
#4  0x0000000100015ae6 in HTChem::DoubleEntry::operator double (this=Could not find the frame base for "HTChem::DoubleEntry::operator double()".
) at /workspace/svn/htchem/prototype1/models/DoubleEntry.cc:11
11	  hpcassert(first, "Entry does not exist");

Thank you,

Juan

Attachments (1)

email1.eml (2.7 KB) - added by jsanchez@… 14 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 14 years ago by mf2k (Frank Schima)

Description: modified (diff)
Owner: changed from macports-tickets@… to mww@…
Port: @4.3.4 (lang) removed

comment:2 Changed 14 years ago by jsanchez@…

Here is the relevant part of the specs file from XCODE:

*libgcc:
%{static:-lgcc_static; static-libgcc: -lgcc_eh -lgcc;		         	         miphoneos-version-min=*: %(darwin_iphoneos_libgcc);		         shared-libgcc|fexceptions|fgnu-runtime:				          %:version-compare(!> 10.5 mmacosx-version-min= -lgcc_s.10.4)	          	          %:version-compare(>< 10.5 10.6 mmacosx-version-min= -lgcc_s.10.5)          -lgcc;								         :%:version-compare(>< 10.3.9 10.5 mmacosx-version-min= -lgcc_s.10.4)        	          %:version-compare(>< 10.5 10.6 mmacosx-version-min= -lgcc_s.10.5)          -lgcc}

and here is the one from g++-mp-4.3:

*libgcc:
%{static-libgcc|static: -lgcc_eh -lgcc;				         shared-libgcc|fexceptions|fgnu-runtime:				          %:version-compare(!> 10.5 mmacosx-version-min= -lgcc_s.10.4)	          %:version-compare(>= 10.5 mmacosx-version-min= -lgcc_s.10.5)	          -lgcc;		         :%:version-compare(>< 10.3.9 10.5 mmacosx-version-min= -lgcc_s.10.4)        %:version-compare(>= 10.5 mmacosx-version-min= -lgcc_s.10.5)	          -lgcc}

Putting the xcode version in the spec file and using the "-spec=myspecfile" results in a regression which passes for my software.

comment:3 in reply to:  2 Changed 14 years ago by jsanchez@…

As a follow up, I think:

%:version-compare(>= 10.5 mmacosx-version-min= -lgcc_s.10.5)

may need to be updated to:

%:version-compare(>< 10.5 10.6 mmacosx-version-min= -lgcc_s.10.5)

Changed 14 years ago by jsanchez@…

Attachment: email1.eml added

comment:4 Changed 14 years ago by jsanchez@…

Attached is a copy of an email with the maintainer of gcc and has submitted darwin related patches. He seems to think that such problems may come if stubs are built, which conflict with the ones on the system. This appears to be the case with the macports build. So perhaps it is better that macports is built against the system libraries?

$ otool -L ./a.out ./a.out:

/opt/local/lib/gcc43/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.10.0) /opt/local/lib/gcc43/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.0.1)

comment:5 Changed 14 years ago by jsanchez@…

So it is safe to assume this issue is not going to be addressed? I can confirm that the presence of libgcc_s results in binaries that do not always catch exceptions properly.

Thanks,

Juan

comment:6 Changed 14 years ago by drs@…

I have this exact same problem with the gcc44 port, i.e. C++ exceptions abort and cannot be caught. My stack trace plus library list is below. Making the change described above made no difference for me. I tried both cutting/editing/pasting the 'collect2' line as well as patching the port with the fix described above and completely building and installing the port, but in neither case did it make any difference. I still get the same abort as a result. This makes the gcc44 port pretty useless for C++ development (and thus deserves more than a 'Normal' priority). gcc44 seems fine for compiling C applications, but not C++ (nor Objective-C, I suspect).

I did not recompile all of the dependencies, but the solution described above implies that it is a linkage issue...

Darrell


Program received signal SIGABRT, Aborted. 0x00007fff8666c3d6 in kill () (gdb) where #0 0x00007fff8666c3d6 in kill () #1 0x00007fff8670c972 in abort () #2 0x0000000106229af2 in _Unwind_SetSpColumn [inlined] () at /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_gcc44/work/gcc-4.4.4/gcc/unwind-dw2.c:1256 #3 0x0000000106229af2 in uw_init_context_1 (context=0x7fff5fbfa090, outer_cfa=0x7fff5fbfa1d0, outer_ra=0x1035fb4e9) at ../../../gcc-4.4.4/libgcc/../gcc/unwind-dw2.c:1463 #4 0x0000000106229f38 in _Unwind_Resume (exc=0x119fe8e30) at unwind.inc:224 #5 0x00000001035fb4e9 in casa::TSMDataColumn::shape (this=0x106dba490, rownr=0) at tables/Tables/TSMDataColumn.cc:164


bash$ otool -L /Users/drs/dev/viewer/osx/bin/casaviewer | grep libgcc bash$ $ otool -L /Users/drs/dev/viewer/osx/bin/casaviewer /Users/drs/dev/viewer/osx/bin/casaviewer:

/opt/local/lib/gcc44/libgomp.1.dylib (compatibility version 2.0.0, current version 2.0.0) /Users/drs/dev/viewer/osx/lib/libdisplay.3.1.0.dylib (compatibility version 3.1.0, current version 0.0.0) /Users/drs/dev/viewer/osx/lib/libcasaqt.3.1.0.dylib (compatibility version 3.1.0, current version 0.0.0) /opt/local/lib/libqwt.5.2.1.dylib (compatibility version 5.2.0, current version 5.2.1) /opt/local/libexec/qt4-mac/lib/QtCore.framework/Versions/4/QtCore (compatibility version 4.6.0, current version 4.6.3) /opt/local/libexec/qt4-mac/lib/QtGui.framework/Versions/4/QtGui (compatibility version 4.6.0, current version 4.6.3) /opt/local/libexec/qt4-mac/lib/QtDBus.framework/Versions/4/QtDBus (compatibility version 4.6.0, current version 4.6.3) /opt/local/libexec/qt4-mac/lib/QtXml.framework/Versions/4/QtXml (compatibility version 4.6.0, current version 4.6.3) /opt/local/Library/Frameworks/Python.framework/Versions/2.6/Python (compatibility version 2.6.0, current version 2.6.0) /opt/local/lib/libxerces-c.28.dylib (compatibility version 0.0.0, current version 0.0.0) /Users/drs/dev/viewer/osx/lib/libmsvis.3.1.0.dylib (compatibility version 3.1.0, current version 0.0.0) /Users/drs/dev/viewer/osx/lib/libgraphics.3.1.0.dylib (compatibility version 3.1.0, current version 0.0.0) /Users/drs/dev/viewer/osx/lib/libcasacore.1.0.14.1.dylib (compatibility version 0.0.0, current version 0.0.0) /opt/local/lib/liblapack.dylib (compatibility version 0.0.0, current version 0.0.0) /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib (compatibility version 1.0.0, current version 219.0.0) /opt/local/lib/libcfitsio.dylib (compatibility version 0.0.0, current version 0.0.0) /opt/local/lib/libwcs.4.4.4.dylib (compatibility version 4.4.4, current version 4.4.4) /opt/local/lib/libpgsbox.4.4.4.dylib (compatibility version 4.4.4, current version 4.4.4) /opt/local/lib/libpgplot.5.3.1.dylib (compatibility version 0.0.0, current version 0.0.0) /opt/local/lib/libcpgplot.5.3.1.dylib (compatibility version 0.0.0, current version 0.0.0) /opt/local/lib/gcc44/libgfortran.3.dylib (compatibility version 4.0.0, current version 4.0.0) /opt/local/lib/libfftw3_threads.3.dylib (compatibility version 6.0.0, current version 6.4.0) /opt/local/lib/libfftw3f_threads.3.dylib (compatibility version 6.0.0, current version 6.4.0) /opt/local/lib/libfftw3f.3.dylib (compatibility version 6.0.0, current version 6.4.0) /opt/local/lib/libfftw3.3.dylib (compatibility version 6.0.0, current version 6.4.0) /opt/local/lib/gcc44/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.13.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0)

bash$

comment:7 Changed 7 years ago by kurthindenburg (Kurt Hindenburg)

Owner: changed from mww@… to macports-tickets@…
Status: newassigned
Note: See TracTickets for help on using tickets.