GCC complaining about undefined symbols when trying to compile for 10.5 in 10.6

Discussion in 'Mac Programming' started by foidulus, May 4, 2010.

  1. foidulus macrumors 6502a

    Joined:
    Jan 15, 2007
    #1
    I have some JNI code that I wrote using the QTKit which compiles fine if I either compile it in 10.5 or target 10.6, but when I try to target 10.5 in 10.6 I get some strange obejctive-c errors(basically it doesn't seem to be able to send messages to self or super.

    Here is the output of my makefile, can anyone tell me whats going on?:confused:


    Code:
    /usr/bin/gcc -Wall -O -dynamic -I/System/Library/Frameworks/JavaVM.framework/Headers -c -arch x86_64 QTMovieController.m QTMovieProcessor.m QTMovieViewComponent.m
    /usr/bin/gcc  -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk -bundle -o libQTMovieViewComponent.jnilib *.o -framework JavaVM -framework Cocoa -framework QTkit 
    Undefined symbols:
      "_objc_msgSendSuper2", referenced from:
          -[QTMovieController init] in QTMovieController.o
          -[QTMovieViewComponent mouseDown:] in QTMovieViewComponent.o
          -[QTMovieViewComponent mouseDragged:] in QTMovieViewComponent.o
          -[QTMovieViewComponent scrollWheel:] in QTMovieViewComponent.o
          -[QTMovieViewComponent init] in QTMovieViewComponent.o
    ld: symbol(s) not found
    collect2: ld returned 1 exit status
    make: *** [jnipart] Error 1
    
     
  2. mif macrumors regular

    Joined:
    Feb 16, 2010
    Location:
    home
    #2
    I am not Java expert, but...

    Does your project have all required frameworks?

    Do you import all required symbols properly?

    Plain c:

    #include <Accelerate/Accelerate.h>

    objective c:?

    #import <Cocoa/Cocoa.h>

    Carbon (QuickTime) 64-bit interface (-arch x86_64) is different than 32-bit interface:

    64-bit:

    #if __LP64__

    32-bit:

    #if __!LP64__
     
  3. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #3
    The command hilited in red performs compilation. The line hilited in blue performs linking.

    Both commands are missing the option that tells the compiler and linker to produce 10.5-compatible code. The compiler generates code, so it needs more than just an SDK -- it needs to be told what language and runtime capabilities it can use.

    This is the -mmacosx-version-min option to gcc, and it needs to be set to the value 10.5. Since it's not, the compiler targets the current OS, which is 10.6.

    The Xcode name for this build setting is "Mac OS X deployment target". The gcc option is already noted.
     

Share This Page