Skip to content
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

cuda off demo build error #73

Open
Yakirbe opened this issue Sep 25, 2016 · 5 comments
Open

cuda off demo build error #73

Yakirbe opened this issue Sep 25, 2016 · 5 comments

Comments

@Yakirbe
Copy link

Yakirbe commented Sep 25, 2016

hi,

i am trying to build the torch-android demo w/o CUDA.
main repo build went well but demo project did not.

i was trying to erase all cuda dependencies on mk file and on lua main file, but still i got this attached error log.
log_torch_android_yakir.txt

using Ubuntu 14.04
have installed android studio w/ SDK + NDK

@Erhannis
Copy link

I have a similar error, though mine fails before yours. (Your error looks like a java 8 error, maybe? Like, there's java 8 code somewhere that shouldn't be there.) After turning CUDA off (and erasing every instance of "-mfpu=neon" in the repo), torch-android builds, but then the demo fails to build. I get the following warnings and errors:

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] Compile++ thumb: torchdemo <= torchdemo.cpp
[armeabi-v7a] StaticLibrary  : libstdc++.a
[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

If I modify jni/Android.mk and move the specified libraries out of the LOCAL_LDLIBS line and into a new line LOCAL_SHARED_LIBRARIES := -lTHCUNN -lcutorch -lnnx -limage -lTHNN -ltorch -lTH -lluaT -lluajit -ltorchandroid, most of the errors go away. However, this remains:

Android NDK: WARNING: APP_PLATFORM android-23 is larger than android:minSdkVersion 14 in ./AndroidManifest.xml
[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 -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

For the record: the description of my failure and process holds true now also for a fresh Ubuntu VM installation. Is there anybody who can actually compile and compile with torch-android, now? If so, how?

@borisfom
Copy link
Collaborator

Please pull and try again. Both lib and the app is now set to same arch by default (v8a), change if needed.

@Erhannis
Copy link

Well, it's further along, now. Torch-android builds fine, now. The demo, I have to add folders under android-demo/libs in order to store the .so files it tries to copy there, but then it builds. When I run it on an emulator of the appropriate abi, though, I get the following:

01-18 19:11:55.765  2417  2417 D torchdemo: Hello from JAVA
01-18 19:11:55.788  2417  2417 W linker  : /data/app/com.torch.torchdemo-1/lib/arm64/libtorchandroid.so: is missing DT_SONAME will use basename as a replacement: "libtorchandroid.so"
01-18 19:11:55.838  2417  2417 D Torch   : Torch() called
01-18 19:11:56.092  2417  2417 D torchdemo: onStart
01-18 19:11:56.093  2417  2417 D Torch.call(%s)
: main.lua
01-18 19:11:56.117  2417  2417 I torchdemo: Torch.call(main.lua), nativeLibraryDir=/data/app/com.torch.torchdemo-1/lib/arm64
01-18 19:11:56.380  2417  2417 W linker  : /data/app/com.torch.torchdemo-1/lib/arm64/libpaths.so: is missing DT_SONAME will use basename as a replacement: "libpaths.so"
01-18 19:11:56.422  2417  2417 W linker  : /data/app/com.torch.torchdemo-1/lib/arm64/libtorch.so: is missing DT_SONAME will use basename as a replacement: "libtorch.so"
01-18 19:11:56.686  2417  2417 I torchdemo: loader_android: name=cutorch failed
01-18 19:11:56.686  2417  2417 I torchdemo: Error doing resource: main.lua:[string "main"]:6: module 'cutorch' not found:
01-18 19:11:56.686  2417  2417 I torchdemo:     no field package.preload['cutorch']
01-18 19:11:56.686  2417  2417 I torchdemo:     no file './cutorch.lua'
01-18 19:11:56.686  2417  2417 I torchdemo:     no file '/home/mewer/projects/torch-android/install/share/luajit-2.1.0-beta1/cutorch.lua'
01-18 19:11:56.686  2417  2417 I torchdemo:     no file '/usr/local/share/lua/5.1/cutorch.lua'
01-18 19:11:56.686  2417  2417 I torchdemo:     no file '/usr/local/share/lua/5.1/cutorch/init.lua'
01-18 19:11:56.686  2417  2417 I torchdemo:     no file '/home/mewer/projects/torch-android/install/share/lua/5.1/cutorch.lua'
01-18 19:11:56.686  2417  2417 I torchdemo:     no file '/home/mewer/projects/torch-android/install/share/lua/5.1/cutorch/init.lua'
01-18 19:11:56.686  2417  2417 I torchdemo:     no file '/data/app/com.torch.torchdemo-1/lib/arm64/cutorch.so'
01-18 19:11:56.686  2417  2417 I torchdemo:     no file './cutorch.so'
01-18 19:11:56.686  2417  2417 I torchdemo:     no file '/usr/local/lib/lua/5.1/cutorch.so'
01-18 19:11:56.686  2417  2417 I torchdemo:     no file '/home/mewer/projects/torch-android/install/lib/lua/5.1/cutorch.so'
01-18 19:11:56.686  2417  2417 I torchdemo:     no file '/usr/local/lib/lua/5.1/loadall.so'cutorch

@paramsen
Copy link
Contributor

paramsen commented Mar 6, 2017

This is pretty old, but refer to my comment in issue #92 in order to run the demo without CUDA. It should be noted that the demo actually tests the CUDA libs, so you have to modify it in order for it to work without CUDA, instructions are in #92.

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

No branches or pull requests

4 participants