soumith / torch-android

Torch-7 for Android
BSD 3-Clause "New" or "Revised" License
275 stars 83 forks source link

Compilation failed with Android ndk r13b and cmake 3.5.2 #89

Open wonjeon opened 7 years ago

wonjeon commented 7 years ago

I tried to pull the source code and update the submodule, but it failed:

$ git submodule update --init --recursive error: no such remote ref 6bd801e73eb5319f0d263a99bc5a15ce6e5ec16f Fetched in submodule path 'distro/pkg/torch', but it did not contain 6bd801e73eb5319f0d263a99bc5a15ce6e5ec16f. Direct fetching of that commit failed. Failed to recurse into submodule path 'distro'

Could you let me know how to resolve this issue? Thanks.

borisfom commented 7 years ago

If you are updating existing local tree, you may need to do git sync first.

borisfom commented 7 years ago

In fact, torch module commit was indeed not pushed; please try again.

wonjeon commented 7 years ago

Thanks for your response. It passed updating submodules with 'WITH_CUDA=OFF'. However, during compilation with 'build.sh', another errors occurred. I'm using cmake 3.5.2. ... [ 48%] Linking C shared module ../../../../install/libs/armeabi-v7a/libpaths.so cd /<...>/torch-android/build/distro/pkg/paths && /usr/bin/cmake -E cmake_link_script CMakeFiles/paths.dir/link.txt --verbose=1 /<...>/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -fPIC -Wno-psabi --sysroot=/<...>/Sdk/ndk-bundle/platforms/android-21/arch-arm -funwind-tables -finline-limit=64 -fsigned-char -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=neon -fdata-sections -ffunction-sections -Wa,--noexecstack -DDISABLE_POSIX_MEMALIGN -mthumb -fomit-frame-pointer -fno-strict-aliasing -O3 -DNDEBUG -Wl,--no-undefined -Wl,-allow-shlib-undefined -Wl,--gc-sections -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -shared -Wl,-soname, -o ../../../../install/libs/armeabi-v7a/libpaths.so CMakeFiles/paths.dir/paths.c.o -L/<...>/torch-android/install/libs/armeabi-v7a -L/<...>/torch-android/install/lib -lluajit "/<...>/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/libsupc++.a" /<...>/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: fatal error: -soname: must take a non-empty argument collect2: error: ld returned 1 exit status distro/pkg/paths/CMakeFiles/paths.dir/build.make:98: recipe for target '../install/libs/armeabi-v7a/libpaths.so' failed make[2]: [../install/libs/armeabi-v7a/libpaths.so] Error 1 make[2]: Leaving directory '/<...>/torch-android/build' CMakeFiles/Makefile2:396: recipe for target 'distro/pkg/paths/CMakeFiles/paths.dir/all' failed make[1]: [distro/pkg/paths/CMakeFiles/paths.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... ...

Which version of cmake have you tested? Thanks.

peizhao commented 7 years ago

I meet the same issue when using the cmake 3.5.1 and Android NDK. You can change the target library from MODULE to SHARED to fix the issue of "soname: must take a non-empty argument", but after fix this , the compile also failed.