i686-apple-darwin9-g++-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5490)
[on MacOSX 10.5.8 (Intel)]
I take it only the compilation line matters?
g++ -O3 -DNDEBUG -feliminate-unused-debug-symbols -dynamiclib -o libjsmile.jnilib ../*.cpp -I$JINC -I../cppsmile -L../cppsmile -lsmilearn -lsmile
libjsmile.so compilation error on OS X
-
- Site Admin
- Posts: 1457
- Joined: Mon Nov 26, 2007 5:51 pm
One of the users posting earlier in this thread reported a success with gcc build 5484. There's a chance that compiler shipped with 10.5.8 is no longer compatible with gcc 4.0.0 included in Darwin we're using to build OSX binaries.jliem wrote:i686-apple-darwin9-g++-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5490)
[on MacOSX 10.5.8 (Intel)]
I was trying to find out how to install JDK in Darwin so I could build jSMILE for OSX myself, but without success. If you know how to do that, let me know.
To compile the Java I installed JDK 6 Update 16 with Java EE. I exported this JINC variable in the build file as mentioned somewhere in this thread. Below the complete build file. I just run in from the terminal.
export JINC=/System/Library/Frameworks/JavaVM.framework/Headers/
echo $JINC
if ! [ -a "cppsmile/libsmile.a" ]
then
echo libsmile.a was not found in smile directory
exit -1
fi
if ! [ -a "java/smile/Network.java" ]
then
echo Network.java was not found in jsmile/java directory
exit -2
fi
if ! [ -a "$JINC/jni.h" ]
then
echo jni.h was not found
echo JDK include directory is configured to: $JINC
echo make sure it is correctly set for your environment
echo by setting JINC variable in this build script
exit -3
fi
echo compiling java source
cd java
rm -f *.jar *.so *.class
javac smile/*.java smile/learning/*.java
jar cf smile.jar -C . smile
javac -cp smile.jar testApp.java
echo compiling JNI wrapper
#g++ -O3 -DNDEBUG -feliminate-unused-debug-symbols -fPIC -shared -o libjsmile.so ../*.cpp -I$JINC -I../cppsmile -L../cppsmile -lsmilearn -lsmile
g++ -O3 -DNDEBUG -feliminate-unused-debug-symbols -dynamiclib -o libjsmile.jnilib ../*.cpp -I$JINC -I../cppsmile -L../cppsmile -lsmilearn -lsmile
# on HPUX, use the following command instead
# aCC +DD64 -O3 -DNDEBUG -b -dynamic -AA -w -mt -o libjsmile.so ../*.cpp -I$JINC -I$JINC/hp-ux -I../cppsmile -L../cppsmile -lsmilearn -lsmile
ls -l *.so *.jar
The output is:
w221195:jsmile_src jliem$ ./build
/System/Library/Frameworks/JavaVM.framework/Headers/
compiling java source
compiling JNI wrapper
Undefined symbols:
"_FID_ptrNative", referenced from:
_FID_ptrNative$non_lazy_ptr in ccrDuP9t.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
ls: *.so: No such file or directory
-rw-r--r-- 1 jliem staff 32000 Sep 17 09:22 smile.jar
w221195:jsmile_src jliem$
export JINC=/System/Library/Frameworks/JavaVM.framework/Headers/
echo $JINC
if ! [ -a "cppsmile/libsmile.a" ]
then
echo libsmile.a was not found in smile directory
exit -1
fi
if ! [ -a "java/smile/Network.java" ]
then
echo Network.java was not found in jsmile/java directory
exit -2
fi
if ! [ -a "$JINC/jni.h" ]
then
echo jni.h was not found
echo JDK include directory is configured to: $JINC
echo make sure it is correctly set for your environment
echo by setting JINC variable in this build script
exit -3
fi
echo compiling java source
cd java
rm -f *.jar *.so *.class
javac smile/*.java smile/learning/*.java
jar cf smile.jar -C . smile
javac -cp smile.jar testApp.java
echo compiling JNI wrapper
#g++ -O3 -DNDEBUG -feliminate-unused-debug-symbols -fPIC -shared -o libjsmile.so ../*.cpp -I$JINC -I../cppsmile -L../cppsmile -lsmilearn -lsmile
g++ -O3 -DNDEBUG -feliminate-unused-debug-symbols -dynamiclib -o libjsmile.jnilib ../*.cpp -I$JINC -I../cppsmile -L../cppsmile -lsmilearn -lsmile
# on HPUX, use the following command instead
# aCC +DD64 -O3 -DNDEBUG -b -dynamic -AA -w -mt -o libjsmile.so ../*.cpp -I$JINC -I$JINC/hp-ux -I../cppsmile -L../cppsmile -lsmilearn -lsmile
ls -l *.so *.jar
The output is:
w221195:jsmile_src jliem$ ./build
/System/Library/Frameworks/JavaVM.framework/Headers/
compiling java source
compiling JNI wrapper
Undefined symbols:
"_FID_ptrNative", referenced from:
_FID_ptrNative$non_lazy_ptr in ccrDuP9t.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
ls: *.so: No such file or directory
-rw-r--r-- 1 jliem staff 32000 Sep 17 09:22 smile.jar
w221195:jsmile_src jliem$
-
- Site Admin
- Posts: 1457
- Joined: Mon Nov 26, 2007 5:51 pm
The problem is that I can't install JDK at all, because we don't have Apple hardware. Instead, we run virtualized Darwin 8.0. The JDK downloads at java.sun.com don't include the OSX binaries; the only way to get them is through Apple Software Update feature, which is not present in Darwin.jliem wrote:To compile the Java I installed JDK 6 Update 16 with Java EE. I exported this JINC variable in the build file as mentioned somewhere in this thread. Below the complete build file. I just run in from the terminal.
Is there a way to bypass the Java problem? I could send the compiled versions of the Java code?
I might upgrade to MacOSX 10.6 which has a new XCode which might resolve the compilation error. However, I'm also searching for a C guru that could help out. It seems that the missing type is externally defined, probably in the main code?
I might upgrade to MacOSX 10.6 which has a new XCode which might resolve the compilation error. However, I'm also searching for a C guru that could help out. It seems that the missing type is externally defined, probably in the main code?
-
- Site Admin
- Posts: 1457
- Joined: Mon Nov 26, 2007 5:51 pm
The Java side is not a problem at all - it's the same across all platforms. The compilation error is in native C++ code. It may be caused by a mismatch between compiler versions on Darwin and OSX.jliem wrote:Is there a way to bypass the Java problem? I could send the compiled versions of the Java code?
-
- Site Admin
- Posts: 1457
- Joined: Mon Nov 26, 2007 5:51 pm