Search code examples
c++gitbuildopen-sourcegimp

Building GIMP 2.10 from source on OSX fails on "gimp-debug-tool-2.0"


I was trying to build GIMP 2.10 on OSX for a week now with no success. Most of the problems were all the different dependencies and such. While it took time all of it was solvable but now I think I came to an dead end. I have gone to the stage where I could finally run "make" and after some time of building different things it errors out on "gimp-debug-tool-2.0". Here is the output log:

Making all in app-tools
  CCLD     gimp-debug-tool-2.0
Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_NSString", referenced from:
      objc-class-ref in libappwidgets.a(gimpcriticaldialog.o)
  "_OBJC_CLASS_$_NSWorkspace", referenced from:
      objc-class-ref in libappwidgets.a(gimpcriticaldialog.o)
  "_objc_autoreleasePoolPop", referenced from:
      _gimp_critical_dialog_response in libappwidgets.a(gimpcriticaldialog.o)
  "_objc_autoreleasePoolPush", referenced from:
      _gimp_critical_dialog_response in libappwidgets.a(gimpcriticaldialog.o)
  "_objc_msgSend", referenced from:
      _gimp_critical_dialog_response in libappwidgets.a(gimpcriticaldialog.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [gimp-debug-tool-2.0] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

I have got similar errors when I was building Qt, OpenCv applications. The problem there was that libraries were missing and I solved it by providing paths to those libraries. But what could possibly be missing when building "gimp-debug-tool-2.0" which seems to be internal tool.

If somebody had any similar experience or has any clue/hint on how I could solve this problem and could point me to the right direction it would be very much appreciated.


Solution

  • The root cause is that gimp-debug-tool-2.0 is a new module that integrates with the OS X operating system to present a dialog in the event of an app failure. It references NSString and NSWorkspace classes, which are part of OS X. Therefore, you need to link against the appropriate OS X framework(s) to resolve the symbols.

    Unfortunately, the automatic configure you run at the beginning of your build cycle references the CoreFoundation framework but this is not where NSString or NSWorkspace actually live.

    The workaround for now is to include this as part of your LDFLAGS environment variable:

    -framework Foundation -framework AppKit

    This will allow the build to complete properly but is a bit of a hokey workaround. The correct approach is to fix the auto-configure so that it references these frameworks properly in the first place but that's more complicated than I can manage