-
Notifications
You must be signed in to change notification settings - Fork 204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Share my experience OSX 10.10 Yosemite Boost 1.55.0 NDK r10e #10
Comments
Thanks for sharing your experience. I just noticed that gcc-4.6 toolchain was removed in ndk-r10e, and thus I made some fixes on this. Now, it should be okay to use |
There are two things which i don't understand now 1, it seems in you build.py file, you are using LOCAL_LDLIBS += -l... to link Boost-for-Android, Do you compile Boost-for-Android to be shared libraries? because i can only compile it to be static libraries and then use the way i mentioned above to link to these static libraries, so i am wondering how you do that? 2, in my MainActivity, i can create an CaffeMobile instance, but when i call enableLog() method, it generates errors, here is my LogCat: 06-12 21:04:37.920 2183-2183/com.rzheng.deepandroid D/dalvikvm﹕ Trying to load lib /data/app-lib/com.rzheng.deepandroid-2/libcaffe.so 0x4357e240 I used the libcaffe.so and libcaffe_jni.so i built by myself, and my package name is com.rzheng.deepandroid, in issue #6, I saw that you mentioned that i have to build the library by myself instead of directly use the .so files in your caffe-android-demo project, but i use the .so files built by myself. I noticed that there is a '-L' option in build.py, does it have something to do with that? what could be the reasons? |
My second question solved, have to change the 3 methods name in caffe_jni.cpp file to the names corresponds to my Android Project name and compile caffe-mobile again, now it works. But i am wondering can you make caffe_jni.cpp file more general, otherwise i have to change it and built it again each time i create a new Android project? |
In the previous commit (6604a37), static boost libs can be linked simply by using LOCAL_LDLIBS (with warnings). However, boost is not required In the latest commit (c021b34)。 |
@ZhengRui For more general jni coverage see bytedeco/javacpp-presets#34. |
0, the way to build is
1, you need to download Boost by yourself and put it inside the Boost-for-Android folder, for details of building Boost-for-Android check Boost-for-Android share my experience.
2, if Boost-for-Android is successfully built, then you have files like "libboost_xx-gcc-mt-1_55.a" in "Boost-for-Android/build/lib" folder, now when you build again, you may have
warnings:
and errors:
The reason for the warning is because the Boost-for-Android libraries built right now are static libraries, but in "caffe-mobile/jni/Android.mk" file, it uses "LOCAL_LDLIBS += ..." to link these static libraries,
which i guess could be wrong. So i comment these lines and the correct way to link static libraries in Android.mk file is first:
then link to it:
Above gives an example to link to one static library, now we need to link to multiple static libraries, then have to repeat
multiple times and then link to all of them
So finally the corresponding part in my Android.mk file are:
and
the correct way of linking static libraries will get rid of the warning and errors involved "type_info.hpp", adding link to "libboost_atomic-gcc-mt-1_55.a" will get rid of the error involved "lockpool.hpp".
After these steps, i can finally build successfully with "libcaffe.so" and "libcaffe_jni.so" generated in folder "caffe-mobile/libs/armeabi-v7a".
The text was updated successfully, but these errors were encountered: