Xcode Tools Unwind Resume Bug

From Biowiki
Jump to: navigation, search

Known Linking Issue with Apple XCode Tools 2.2 (November 19, 2005)

(Link: Xcode Tools Unwind Resume Bug)

There is a known issue compiling DART, or (apparently) any other C++ program using exceptions, using the version of gcc (v4.0.1, build 5247) bundled with version 2.2 of Apple's XCode Tools. For example, compiling the following test program

//////////////////////////////////////////////////
// testprogram.cc										 //
// compile with "gcc testprogram.cc -lstdc++"	//
//////////////////////////////////////////////////
#include <iostream>

using namespace std;

// main
int main (int argc, char** argv)
{
  cout << "let's throw an exception\n";
  try
	 {
		throw 100;
	 }
  catch (...)
	 {
		cout << "(caught exception: that's good)\n";
	 }
  return 0;
}
//////////////////////////////////////////////////

gives the following error

/usr/bin/ld: Undefined symbols:
__Unwind_Resume
collect2: ld returned 1 exit status

A bug report has been filed at http://developer.apple.com/bugreporter/ for this issue (Problem ID #4350642).

Until this problem is fixed, a workaround for the bug is to use an older version of gcc, e.g. version 3.3 which is also bundled with XCode Tools. To do this, open the file dart/src/make.defs, and change line 8 from the following....

CC	  = gcc

...to the following...

CC	  = gcc-3.3

If problems persist, contact Ian Holmes.

Update (3pm 11/19): using g++ in place of gcc-3.3 also appears to work (thanks to Ryan Ritterson for this fix).