Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

foidulus

macrumors 6502a
Original poster
Jan 15, 2007
904
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
 

mif

macrumors regular
Feb 16, 2010
196
93
home
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__
 

chown33

Moderator
Staff member
Aug 9, 2009
10,751
8,425
A sea of green
Code:
[COLOR="Red"]/usr/bin/gcc -Wall -O -dynamic -I/System/Library/Frameworks/JavaVM.framework/Headers -c -arch x86_64 QTMovieController.m QTMovieProcessor.m QTMovieViewComponent.m[/COLOR]
[COLOR="Blue"]/usr/bin/gcc  -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk -bundle -o libQTMovieViewComponent.jnilib *.o -framework JavaVM -framework Cocoa -framework QTkit [/COLOR]
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
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.