naman14 / Arcade

Neural style in Android
104 stars 20 forks source link

Missing libarcade.so file #4

Open sadaharusong opened 7 years ago

sadaharusong commented 7 years ago

Hello, I use libpng.so instead libpng16.so to solve the problem . But now, I have a new problem, it is missing libarcade.so in the file. I try to use ndk to build it , but if want to use ndk to build the .so , the libarcade.so in needed . So could you update the Code or Push the file into the repository ?

huyn commented 7 years ago

You need to run ndk-build to generate libarcade.so then you can run from AndroidStudio

sadaharusong commented 7 years ago

D:\AndroidStudioProjects\Arcade\arcade\src\main\jni>ndk-build Android NDK: ERROR:D:/AndroidStudioProjects/Arcade/arcade/src/main/jni/Android.m k:arcade: LOCAL_SRC_FILES points to a missing file Android NDK: Check that D:/AndroidStudioProjects/Arcade/arcade/src/main/jni/preb uilts/libarcade.so exists or that its path is correct D:/Android/sdk/ndk-bundle/build//../build/core/prebuilt-library.mk:45: *** Andro id NDK: Aborting . Stop.

I know need to run ndk-bulid. But it says I missing file .So, I check the file in jni ,the file is right there . In Android.mk the 'LOCAL_SRC_FILES' shows "LOCAL_SRC_FILES := arcade.cpp torchandroid.cpp android_fopen.c" , but in my jni ,the file is right , didn't miss.

sadaharusong commented 7 years ago

I slove the problem , but I have a new one.Just need one step I can build the .so .

D:\AndroidStudioProjects\Arcade\arcade\src\main\jni>ndk-build Android NDK: WARNING:D:/AndroidStudioProjects/Arcade/arcade/src/main/jni/Android .mk:arcade: non-system libraries in linker flags: -lluaT -lluajit -lTH -lTHNN -l torch -lnnx -limage -ltorchandroid -lluaT -lluajit -lTH -lTHNN -ltorch -lnnx -li mage -ltorchandroid -lpng -lpng16 Android NDK: This is likely to result in incorrect builds. Try using LOCAL_S TATIC_LIBRARIES Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependenc ies of the Android NDK: current module Android NDK: WARNING:D:/AndroidStudioProjects/Arcade/arcade/src/main/jni/Android .mk:arcade: non-system libraries in linker flags: -lluaT -lluajit -lTH -lTHNN -l torch -lnnx -limage -ltorchandroid -lluaT -lluajit -lTH -lTHNN -ltorch -lnnx -li mage -ltorchandroid -lpng -lpng16 Android NDK: This is likely to result in incorrect builds. Try using LOCAL_S TATIC_LIBRARIES Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependenc ies of the Android NDK: current module Android NDK: WARNING:D:/AndroidStudioProjects/Arcade/arcade/src/main/jni/Android .mk:arcade: non-system libraries in linker flags: -lluaT -lluajit -lTH -lTHNN -l torch -lnnx -limage -ltorchandroid -lluaT -lluajit -lTH -lTHNN -ltorch -lnnx -li mage -ltorchandroid -lpng -lpng16 Android NDK: This is likely to result in incorrect builds. Try using LOCAL_S TATIC_LIBRARIES Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependenc ies of the Android NDK: current module Android NDK: WARNING:D:/AndroidStudioProjects/Arcade/arcade/src/main/jni/Android .mk:arcade: non-system libraries in linker flags: -lluaT -lluajit -lTH -lTHNN -l torch -lnnx -limage -ltorchandroid -lluaT -lluajit -lTH -lTHNN -ltorch -lnnx -li mage -ltorchandroid -lpng -lpng16 Android NDK: This is likely to result in incorrect builds. Try using LOCAL_S TATIC_LIBRARIES Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependenc ies of the Android NDK: current module [armeabi-v7a] Prebuilt : libTH.so <= jni/prebuilts/ [armeabi-v7a] Install : libTH.so => libs/armeabi-v7a/libTH.so [armeabi-v7a] Prebuilt : libTHNN.so <= jni/prebuilts/ [armeabi-v7a] Install : libTHNN.so => libs/armeabi-v7a/libTHNN.so [armeabi-v7a] Compile++ thumb: arcade <= arcade.cpp D:/AndroidStudioProjects/Arcade/arcade/src/main/jni/arcade.cpp:228:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ D:/AndroidStudioProjects/Arcade/arcade/src/main/jni/arcade.cpp:234:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ 2 warnings generated. [armeabi-v7a] Compile++ thumb: arcade <= torchandroid.cpp D:/AndroidStudioProjects/Arcade/arcade/src/main/jni/torchandroid.cpp:50:1: warni ng: control reaches end of non-void function [-Wreturn-type] } ^ 1 warning generated. [armeabi-v7a] Compile thumb : arcade <= android_fopen.c [armeabi-v7a] StaticLibrary : libstdc++.a [armeabi-v7a] SharedLibrary : libarcade.so D:/Android/sdk/ndk-bundle/build//../toolchains/arm-linux-androideabi-4.9/prebuil t/windows-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-andro ideabi/bin\ld: error: cannot find -lrt clang++.exe: error: linker command failed with exit code 1 (use -v to see invoca tion) make: *** [D:/AndroidStudioProjects/Arcade/arcade/src/main/obj/local/armeabi-v7a /libarcade.so] Error 1

huyn commented 7 years ago

You miss librt.so, but this lib is merged to libc.so already. I resolve this problem by this way, maybe it is wrong, I just want to make it work, and it works finally.

comment

#APP_CFLAGS += -fopenmp
#APP_LDFLAGS += -fopenmp

in Application.mk, then run ndk-build, you might get the so.

There are still many problems waiting for you. Hope we can help each other.

sadaharusong commented 7 years ago

@huyn Thank you very much . And I fix the problem , build success . I found the "libarcade.so" , but it still says error in Android Studio ,when I click the button "BEGIN STYLING " , Do you have this error ?

Like this :

java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.naman14.arcade-1/base.apk"],nativeLibraryDirectories=[/vendor/lib64, /system/lib64]]] couldn't find "libarcade.so"

naman14 commented 7 years ago

@sadaharusong what's your device architecture? The prebuilt libraries are currently only for armeabi-v7a I will try to revisit the project today and see if there are any build issues

naman14 commented 7 years ago

Also, can you post your Android.mk?

sadaharusong commented 7 years ago

@naman14 I try to use the phone with armeabi-v7a , and also try other phone have other cpu . All didn't work .

The Error : java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.naman14.arcade-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]] couldn't find "libarcade.so"

My Android.mk : LOCAL_PATH := $(call my-dir)

include $(call all-subdir-makefiles) include $(CLEAR_VARS)

LOCAL_MODULE := arcade

LOCAL_C_INCLUDES += $(LOCAL_PATH)/include

LOCAL_SRC_FILES := arcade.cpp torchandroid.cpp android_fopen.c

LOCAL_LDLIBS := -llog -landroid -L$(LOCAL_PATH)/prebuilts -lluaT -lluajit -lTH -lTHNN -ltorch -lnnx -limage -ltorchandroid -lluaT -lluajit -lTH -lTHNN -ltorch -lnnx -limage -ltorchandroid -lpng -lpng16

include $(BUILD_SHARED_LIBRARY)

Add prebuilt libimage

include $(CLEAR_VARS) LOCAL_MODULE := libimage LOCAL_SRC_FILES := prebuilts/libimage.so include $(PREBUILT_SHARED_LIBRARY)

Add prebuilt libloadcaffe

include $(CLEAR_VARS) LOCAL_MODULE := libloadcaffe LOCAL_SRC_FILES := prebuilts/libloadcaffe.so include $(PREBUILT_SHARED_LIBRARY)

Add prebuilt libtorchandroid

include $(CLEAR_VARS) LOCAL_MODULE := libtorchandroid LOCAL_SRC_FILES := prebuilts/libtorchandroid.so include $(PREBUILT_SHARED_LIBRARY)

Add prebuilt libluajit

include $(CLEAR_VARS) LOCAL_MODULE := libluajit LOCAL_SRC_FILES := prebuilts/libluajit.so include $(PREBUILT_SHARED_LIBRARY)

Add prebuilt libluaT

include $(CLEAR_VARS) LOCAL_MODULE := libluaT LOCAL_SRC_FILES := prebuilts/libluaT.so include $(PREBUILT_SHARED_LIBRARY)

Add prebuilt libTH

include $(CLEAR_VARS) LOCAL_MODULE := libTH LOCAL_SRC_FILES := prebuilts/libTH.so include $(PREBUILT_SHARED_LIBRARY)

Add prebuilt libtorch

include $(CLEAR_VARS) LOCAL_MODULE := libtorch LOCAL_SRC_FILES := prebuilts/libtorch.so include $(PREBUILT_SHARED_LIBRARY)

Add prebuilt libpaths

include $(CLEAR_VARS) LOCAL_MODULE := libpaths LOCAL_SRC_FILES := prebuilts/libpaths.so include $(PREBUILT_SHARED_LIBRARY)

Add prebuilt libgnustl

include $(CLEAR_VARS) LOCAL_MODULE := libgnustl_shared LOCAL_SRC_FILES := prebuilts/libgnustl_shared.so include $(PREBUILT_SHARED_LIBRARY)

Add prebuilt libnnx

include $(CLEAR_VARS) LOCAL_MODULE := libnnx LOCAL_SRC_FILES := prebuilts/libnnx.so include $(PREBUILT_SHARED_LIBRARY)

Add prebuilt libppm

include $(CLEAR_VARS) LOCAL_MODULE := libppm LOCAL_SRC_FILES := prebuilts/libppm.so include $(PREBUILT_SHARED_LIBRARY)

Add prebuilt libsundown

include $(CLEAR_VARS) LOCAL_MODULE := libsundown LOCAL_SRC_FILES := prebuilts/libsundown.so include $(PREBUILT_SHARED_LIBRARY)

Add prebuilt libsys

include $(CLEAR_VARS) LOCAL_MODULE := libsys LOCAL_SRC_FILES := prebuilts/libsys.so include $(PREBUILT_SHARED_LIBRARY)

Add prebuilt libthnn

include $(CLEAR_VARS) LOCAL_MODULE := libTHNN LOCAL_SRC_FILES := prebuilts/libTHNN.so include $(PREBUILT_SHARED_LIBRARY)

Add prebuilt libthreads

include $(CLEAR_VARS) LOCAL_MODULE := libthreads LOCAL_SRC_FILES := prebuilts/libthreads.so include $(PREBUILT_SHARED_LIBRARY)

Add prebuilt libthreadsmain

include $(CLEAR_VARS) LOCAL_MODULE := libthreadsmain LOCAL_SRC_FILES := prebuilts/libthreadsmain.so include $(PREBUILT_SHARED_LIBRARY)

Add prebuilt libpng16

include $(CLEAR_VARS) LOCAL_MODULE := libpng16 LOCAL_SRC_FILES := prebuilts/libpng16.so include $(PREBUILT_SHARED_LIBRARY)

Add prebuilt libpng

include $(CLEAR_VARS) LOCAL_MODULE := libpng LOCAL_SRC_FILES := prebuilts/libpng.so include $(PREBUILT_SHARED_LIBRARY)

By the way , The App in Google Play is didn't work,too.

BrianOn99 commented 7 years ago

@naman14 Nice to know that you will take a look in to the issues. I can offer help if there is need.

BrianOn99 commented 7 years ago

By the way , The App in Google Play is didn't work,too.

Yes, please take a look in #2.

huyn commented 7 years ago

@sadaharusong That is because all the so files are not packed into final apk try

android.sources {

        main {
            jniLibs {
                source {
                    srcDirs 'libs'
                }
            }
        }

        main {
            jni {
                exportedHeaders {
                    srcDir "src/main/jni/include"
                }
                source {
                    srcDirs = ['src/main/none'] // [] could be set instead but will disable even symbol resolution inside the editor
                }
            }
        }
    }

change your srcDirs of jniLibs to libs folder under arcade module. It would work.

Dalychan commented 7 years ago

Have you solved that issue please? I'm having the same :(

acenter2507 commented 6 years ago

@naman14 do you still following this project ?