Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: translating a build script for JNI for linux to JNI for OS X



Dear all,

Based on some suggestions by the authors of the source code and Mikael's comments, I made some changes to the C++ code (about which I know nothing) and the compile command:

1) changed ".so" to ".jnilib" as required by OS X.
2) removed "-s" due to compiler complaints.

I'm now running the command:

g++ -O3 -DNDEBUG -feliminate-unused-debug-symbols -fPIC -shared -o libjsmile.jnilib ../*.cpp -I$JINC -I../cppsmile -L../cppsmile -lsmilearn -lsmile

and I get the following error:

Undefined symbols:
  "_main", referenced from:
      start in crt1.10.5.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

I was able to google this error but not a solution (at least not a solution for me...one solution, on the Apple site, was to use the Fortran compiler).

As I understand the issue, the compiler is complaining that there is no "main" method...but it's a library, there isn't a main method. How do I tell the compiler this? I would have thought "-shared" would have been sufficient.

Thanks again.

Cheers,
Steve
 
On Aug 24, 2008, at 7:35 AM, Mikael Hakman wrote:

What happens if you execute that g++ command on OS X?

Regards/Mikael

On Aug 23, 2008, at 9:01 PM, Stephyn Butcher wrote:

Dear all,

I'm beside myself with confusion...which is not all that unusual.

I'm trying to compile a JNI wrapper for a third party library. The source code for the JNI wrapper exists as does a build file but it's for linux. Additionally, the compiled binaries for the actual code exist for OS X.

However, I cannot even begin to figure out how to make this work on OS X. I have the following command:

echo compiling JNI wrapper
g++ -O3 -DNDEBUG -feliminate-unused-debug-symbols -fpic -s -shared -o libjsmile.so ../*.cpp -I$JINC -I$JINC/linux -I../cppsmile -L../cppsmile -lsmilearn -lsmile

and I don't know how to translate it into OS X speak.

For the full code, the binaries and source are here:


and the source for the JNI wrapper is here:


I put the binaries into the cppsmile directory of the jsmile_src.

Any pointers would be helpful. I would suppose that most of the work has been done for me and I just need to figure out the incantation for g++ (ie, I don't need to put all of this stuff into an XCode JNI project). However, if that would be easier...that's great, too.

I would also love to contribute the solution back to this project.

Cheers,
Steve

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden

References: 
 >translating a build script for JNI for linux to JNI for OS X (From: Stephyn Butcher <email@hidden>)
 >Re: translating a build script for JNI for linux to JNI for OS X (From: Mikael Hakman <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.