|
You also have to tell the linker that you are
building a dynamic link library. Im not at OS X right now and I dont remember
the actual switch to use. If you wait until tomorrow I will send you the exact
command line that my XCode JNILib projects use.
Regards/Mikael
On August 25, 2008 4:57 PM, Stephyn Butcher
wrote:
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
|