Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

can't build android-demo for cpu #72

Open
markvai opened this issue Aug 15, 2016 · 5 comments
Open

can't build android-demo for cpu #72

markvai opened this issue Aug 15, 2016 · 5 comments

Comments

@markvai
Copy link

markvai commented Aug 15, 2016

Hello,

I am trying to compile the android-demo without cuda and receive the following errors:

Updated local.properties
Updated file ./proguard-project.txt
Android NDK: WARNING: APP_PLATFORM android-21 is larger than android:minSdkVersion 14 in ./AndroidManifest.xml
Android NDK: WARNING:jni/Android.mk:torchdemo: non-system libraries in linker flags: -lTHCUNN -lcutorch -lnnx -limage -lTHNN -ltorch -lTH -lluaT -lluajit -ltorchandroid
Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES
Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the
Android NDK: current module
[armeabi-v7a] Compile++ thumb: torchdemo <= torchdemo.cpp
[armeabi-v7a] StaticLibrary : libstdc++.a
[armeabi-v7a] SharedLibrary : libtorchdemo.so
/home/mark/NVPACK/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lTHCUNN
/home/mark/NVPACK/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lcutorch
collect2: error: ld returned 1 exit status
make: *** [obj/local/armeabi-v7a/libtorchdemo.so] Error 1

any suggestions?

@borisfom
Copy link
Collaborator

@markvai: did you do a clean rebuild setting WITH_CUDA off ?

@markvai
Copy link
Author

markvai commented Aug 15, 2016

Yes.
I tried erasing those libs from the android.mk file but in the main.lua those are required.

@borisfom
Copy link
Collaborator

@markvai: yes demo is written for CUDA, you need to modify main.lua as well.

@Erhannis
Copy link

So...which things do we need to erase from which files? (Note that I've turned CUDA off, and erased all references to -mfpa=neon.) My error messages seem a little different; I'm getting:

Updated local.properties
Updated file ./proguard-project.txt
Android NDK: WARNING: APP_PLATFORM android-23 is larger than android:minSdkVersion 14 in ./AndroidManifest.xml
Android NDK: WARNING:jni/Android.mk:torchdemo: non-system libraries in linker flags: -lTHCUNN -lcutorch -lnnx -limage -lTHNN -ltorch -lTH -lluaT -lluajit -ltorchandroid
Android NDK:     This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES
Android NDK:     or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the
Android NDK:     current module
[armeabi-v7a] SharedLibrary  : libtorchdemo.so
/home/erhannis/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lTHCUNN
/home/erhannis/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lcutorch
/home/erhannis/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lnnx
/home/erhannis/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -limage
/home/erhannis/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lTHNN
/home/erhannis/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -ltorch
/home/erhannis/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: warning: skipping incompatible ../../install/lib/libTH.so while searching for TH
/home/erhannis/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lTH
/home/erhannis/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: warning: skipping incompatible ../../install/lib/libluaT.so while searching for luaT
/home/erhannis/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lluaT
/home/erhannis/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: warning: skipping incompatible ../../install/lib/libluajit.so while searching for luajit
/home/erhannis/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lluajit
/home/erhannis/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: warning: skipping incompatible ../../install/lib/libtorchandroid.so while searching for torchandroid
/home/erhannis/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -ltorchandroid
/home/erhannis/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lrt
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
/home/erhannis/Android/Sdk/ndk-bundle/build/core/build-binary.mk:702: recipe for target 'obj/local/armeabi-v7a/libtorchdemo.so' failed
make: *** [obj/local/armeabi-v7a/libtorchdemo.so] Error 1

@Erhannis
Copy link

Following what the error seemed to be trying to say, I moved -lTHCUNN -lcutorch -lnnx -limage -lTHNN -ltorch -lTH -lluaT -lluajit -ltorchandroid onto a new LOCAL_STATIC_LIBRARIES := . This gets rid of a lot of errors, but I'm still left with (...)ld: error: cannot find -lrt. It looks like I have that library in several places on my computer, but I don't know if I need a different architecture version of it or what.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants