readium / readium-lcp-client

This repository is for the Readium Licenced Content Protection (LCP) client side implementation work.
BSD 3-Clause "New" or "Revised" License
15 stars 12 forks source link

Android - another ZLib compile fail on Windows! #45

Open fjansen opened 6 years ago

fjansen commented 6 years ago

I implemented LCP with SDK-Android branch feature/lcp for exemple. In this implementation, passphrase is always needed if we close and reopen the app. I want to store the user key like specification descibe. But i can't find how have the "user key" value, and how to decrypt an epub with this "user key". In the Launcher the licence is decrypted with mLicense.decrypt(passPhrase); After the code test if the licence is decrypted : if (!mLicense.isDecrypted()) { In the Licence class there is no method to work with a "user key". Can someone help me ?

danielweck commented 6 years ago

The StorageProvider Java (+ JNI cpp) implementation for Android should "automatically" handle the passphrase persistence layer: https://github.com/readium/readium-lcp-client/blob/develop/platform/android/lib/src/clientlib/cpp/StorageProvider.cpp https://github.com/readium/readium-lcp-client/blob/develop/platform/android/lib/src/clientlib/cpp/StorageProvider.cpp (maybe this code is bypassed somewhere ... I am checking now)

danielweck commented 6 years ago

StorageProvideris instantiated here (at the application level): https://github.com/readium/SDKLauncher-Android/blob/feature/lcp/SDKLauncher-Android/app/src/main/java/org/readium/sdk/android/launcher/ContainerList.java#L271

danielweck commented 6 years ago

I've just tested SDKLauncher-Android on my phone, the passphrase is saved correctly. Is StorageProvider setup correctly in your fork?

fjansen commented 6 years ago

I don't anderstand... 1) I run the launcher, I open an lcp epub file, I enter my pass phrase. I close the epub, if an enter again in this epub file, I don't need to enter the passphrase. It's ok 2) I open an other epub LCP file with the same passphrase, the passphrase is needed... It's not ok 3) I close the launcher. I run again the launcher, I open the first LCP epub file, the passphrase is needed again. It's not ok. Or I may have misunderstood something ?

llemeurfr commented 6 years ago

Is the second publication from the same provider? if yes, the caching algorithm should test the passphrase of the first publication automatically (*). If not, it's normal that you're request a passphrase, the system has no good reason to test all stored passphrases.
The third point does not seem normal.

(*) to be verified in the code. It's the case in the Readium-2 implementation.

danielweck commented 6 years ago

In Readium "1" readium-lcp-client, the LcpService::DecryptLicenseByStorage() function implements how to use stored "user passphrases" (well, SHA256 digest, aka "user key"): https://github.com/readium/readium-lcp-client/blob/develop/src/lcp-client-lib/LcpService.cpp#L410 A special "unique key" is used to match an existing entry (combined IDs of provider, user, license), see the BuildStorageProviderKey() and AddDecryptedUserKey() / AddUserKey() functions. If this special "unique key" does not match, then the entire vault ("storage provider") is enumerated to try find a passphrase that works.

danielweck commented 6 years ago

@fjansen

I run the launcher, I open an lcp epub file, I enter my pass phrase. I close the epub, if an enter again in this epub file, I don't need to enter the passphrase. It's ok

Great, my experience too using SDKLauncher-Android.

I open an other epub LCP file with the same passphrase, the passphrase is needed... It's not ok

Strange! Are you able to place breakpoints in DecryptLicenseByStorage() to see what is going on? Maybe EnumerateVault() is not working correctly.

I close the launcher. I run again the launcher, I open the first LCP epub file, the passphrase is needed again. It's not ok.

Very strange. But maybe related to (2).

I will have another look too.

danielweck commented 6 years ago

I placed breakpoints during my tests and everything seems to be working fine. I am changing the UserKeysVaultId to see what happens with a fresh new StorageProvider instance.

danielweck commented 6 years ago

I am sorry, but I am unable to reproduce the behaviour your are experiencing. Could you please go to "app info", clear cache and storage, and try again step-by-step? Let us know how it goes, thanks!

fjansen commented 6 years ago

I've reinstall the project from the git repository feature/lcp and i can't make any test, the app crash when i choose a directory...

FATAL EXCEPTION: main
Process: org.readium.sdk.android.launcher, PID: 23277
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/org.readium.sdk.android.launcher-2/base.apk", zip file "/data/app/org.readium.sdk.android.launcher-2/split_lib_dependencies_apk.apk", zip file "/data/app/org.readium.sdk.android.launcher-2/split_lib_slice_0_apk.apk", zip file "/data/app/org.readium.sdk.android.launcher-2/split_lib_slice_1_apk.apk", zip file "/data/app/org.readium.sdk.android.launcher-2/split_lib_slice_2_apk.apk", zip file "/data/app/org.readium.sdk.android.launcher-2/split_lib_slice_3_apk.apk", zip file "/data/app/org.readium.sdk.android.launcher-2/split_lib_slice_4_apk.apk", zip file "/data/app/org.readium.sdk.android.launcher-2/split_lib_slice_5_apk.apk", zip file "/data/app/org.readium.sdk.android.launcher-2/split_lib_slice_6_apk.apk", zip file "/data/app/org.readium.sdk.android.launcher-2/split_lib_slice_7_apk.apk", zip file "/data/app/org.readium.sdk.android.launcher-2/split_lib_slice_8_apk.apk", zip file "/data/app/org.readium.sdk.android.launcher-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/org.readium.sdk.android.launcher-2/lib/arm, /data/app/org.readium.sdk.android.launcher-2/base.apk!/lib/armeabi-v7a, /data/app/org.readium.sdk.android.launcher-2/split_lib_dependencies_apk.apk!/lib/armeabi-v7a, /data/app/org.readium.sdk.android.launcher-2/split_lib_slice_0_apk.apk!/lib/armeabi-v7a, /data/app/org.readium.sdk.android.launcher-2/split_lib_slice_1_apk.apk!/lib/armeabi-v7a, /data/app/org.readium.sdk.android.launcher-2/split_lib_slice_2_apk.apk!/lib/armeabi-v7a, /data/app/org.readium.sdk.android.launcher-2/split_lib_slice_3_apk.apk!/lib/armeabi-v7a, /data/app/org.readium.sdk.android.launcher-2/split_lib_slice_4_apk.apk!/lib/armeabi-v7a, /data/app/org.readium.sdk.android.launcher-2/split_lib_slice_5_apk.apk!/lib/armeabi-v7a, /data/app/org.readium.sdk.android.launcher-2/split_lib_slice_6_apk.apk!/lib/armeabi-v7a, /data/app/org.readium.sdk.android.launcher-2/split_lib_slice_7_apk.apk!/lib/armeabi-v7a, /data/app/org.readium.sdk.android.launcher-2/split_lib_slice_8_apk.apk!/lib/armeabi-v7a, /data/app/org.readium.sdk.android.launcher-2/split_lib_slice_9_apk.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]] couldn't find "liblcp.so"
  at java.lang.Runtime.loadLibrary(Runtime.java:367)
  at java.lang.System.loadLibrary(System.java:1076)
  at org.readium.sdk.lcp.ServiceFactory.<clinit>(ServiceFactory.java:39)
  at org.readium.sdk.lcp.ServiceFactory.build(ServiceFactory.java:0)
  at org.readium.sdk.android.launcher.ContainerList.onCreate(ContainerList.java:276)
  at android.app.Activity.performCreate(Activity.java:6877)
  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1136)
  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3209)
  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3352)
  at android.app.ActivityThread.access$1100(ActivityThread.java:223)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1797)
  at android.os.Handler.dispatchMessage(Handler.java:102)
  at android.os.Looper.loop(Looper.java:158)
  at android.app.ActivityThread.main(ActivityThread.java:7231)
  at java.lang.reflect.Method.invoke(Native Method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
danielweck commented 6 years ago

couldn't find "liblcp.so"

It looks like your project setup is incorrect. The hierarchy of filesystem folders / git repositories should look like:

1) cd PathToMyCode/ 2) git clone --recursive -b develop https://github.com/readium/SDKLauncher-Android.git SDKLauncher-Android 3) cd SDKLauncher-Android 4) git submodule update --init --recursive 5) git checkout feature/lcp && git submodule foreach --recursive "git checkout develop" 6) cd readium-sdk/Platform/Android 7) make sure that the file local.properties exists with the contents shown below at appendix "A1" 8) ./gradlew build 9) make sure that the generated readium-sdk lib (libepub3.so) is copied into a SDKLauncher-Android/readium-sdk/Platform/Android/epub3/libs folder, using the following file hierarchy: libs/DEBUG/armeabi-v7a/libepub3.so, libs/DEBUG/armeabi-v7a/libgnustl_shared.so (same for RELEASE, and for x86 if you enabled it in local.properties) 10) cd readium-lcp-client/platform/android 11) make sure that the file local.properties exists with the contents shown below at appendix "A2" 12) ./gradlew build 13) if this command line exercise is successful, things are looking good ... you can now open AndroidStudio and you should be able to run the app.

Steps 10, 11, 12 are actually optional, next time you can just use AndroidStudio directly (make sure that the file local.properties exists with the contents shown below at appendix "A3"). Steps 6 to 9 are essential though, because building liblcp.so requires the readium-sdk to be prebuilt in the required directory structure. It's a messy consequence of the evolving build system (Eclipse shell scripts, AndroidStudio Gradle and NDK Makefile invoked externally, then Gradle-experimental internal DSL for NDK, then CMake ... !)

Let me know if this helps.

Appendix "A1" SDKLauncher-Android/readium-sdk/Platform/Android/local.properties:

ndk.dir=/PATH/TO/Android/sdk/ndk-bundle
sdk.dir=/PATH/TO/Android/sdk

readium.ndk_experimental=true
readium.ndk_clang=false
readium.ndk_skipARM=false
readium.ndk_skipX86=true

Appendix "A2" SDKLauncher-Android/readium-lcp-client/platform/android/local.properties:

ndk.dir=/PATH/TO/Android/sdk/ndk-bundle
sdk.dir=/PATH/TO/Android/sdk

readium.ndk_experimental=true
readium.ndk_clang=false
readium.ndk_skipARM=false
readium.ndk_skipX86=true

readium.sdk_lib_dir=/PATH/TO/SDKLauncher-Android/readium-sdk/Platform/Android/epub3/libs/
readium.sdk_include_dir=/PATH/TO/SDKLauncher-Android/readium-sdk/Platform/Android/epub3/include/

Appendix "A3" SDKLauncher-Android/SDKLauncher-Android/local.properties:

ndk.dir=/PATH/TO/Android/sdk/ndk-bundle
sdk.dir=/PATH/TO/Android/sdk

readium.ndk_experimental=true
readium.ndk_clang=false
readium.ndk_skipARM=false
readium.ndk_skipX86=true
fjansen commented 6 years ago

Thank's Daniel but I can't compile to the end... The documentation is not up to date i think. After step 5, all subdirectory are in feature/lcp branch, so readium-lcp directory il empty. I've make clone to the feature/lcp branch and checkout all the submodule in develop branch without step 4 and 5. In step 9, there is no "dist" directory in SDKLauncher-Android\readium-sdk\Platform\Android. So I've created SDKLauncher-Android\readium-sdk\Platform\Android\dist\DEBUG\armeabi-v7a\lib I've copyed libepub3.so and libgnustl_shared.so from SDKLauncher-Android\readium-sdk\Platform\Android\epub3\build\outputs\native\debug\arm\lib\armeabi-v7a I've created SDKLauncher-Android\readium-sdk\Platform\Android\dist\RELEASE\armeabi-v7a\lib and copyed libepub3.so et libgnustl_shared.so from SDKLauncher-Android\readium-sdk\Platform\Android\epub3\build\outputs\native\release\arm\lib\armeabi-v7a

In step 12, i've got an error ninja: error: 'C:/NS/Job/Nordcompo/Readium/Test_launcher_LCP/SDKLauncher-Android/readium-sdk/Platform/Android/dist/DEBUG/armeabi-v7a/libepub3.so', needed by '../../../../build/intermediates/cmake/arm7/debug/obj/armeabi-v7a/liblcp.so', missing and no known rule to make it So I've moved libepub3.so et libgnustl_shared.so form SDKLauncher-Android\readium-sdk\Platform\Android\dist\DEBUG\armeabi-v7a\lib to SDKLauncher-Android\readium-sdk\Platform\Android\dist\DEBUG\armeabi-v7a\ and the same file from SDKLauncher-Android\readium-sdk\Platform\Android\dist\RELEASE\armeabi-v7a\lib to SDKLauncher-Android\readium-sdk\Platform\Android\dist\RELEASE\armeabi-v7a

Lanch step 12 again, and build failled again ! In the midle of log there is an first error :

ninja: build stopped: subcommand failed.
:lib:externalNativeBuildArm7Debug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':lib:externalNativeBuildArm7Debug'.
> Build command failed.
  Error while executing process C:\Users\Fabrice\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {--build C:\NS\Job\Nordcompo\Readium\Test_launcher_LCP\SDKLauncher-Android\readium-lcp-client\platform\android\lib\.externalNativeBuild\cmake\arm7Debug\armeabi-v7a --target lcp}

And in the end :

ninja: build stopped: subcommand failed.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 26s
31 actionable tasks: 13 executed, 18 up-to-date

Perharps it's my local.properties file in fault :

ndk.dir=C\:\\NS\\soft\\android-ndk-r13b
sdk.dir=C\:\\Users\\Fabrice\\AppData\\Local\\Android\\Sdk

readium.ndk_experimental=true
readium.ndk_clang=false
readium.ndk_skipARM=false
readium.ndk_skipX86=true

readium.sdk_lib_dir=C\:\\NS\\Job\\Nordcompo\\Readium\\Test_launcher_LCP\\SDKLauncher-Android\\readium-sdk\\Platform\\Android\\dist\\
readium.sdk_include_dir=C\:\\NS\\Job\\Nordcompo\\Readium\\Test_launcher_LCP\\SDKLauncher-Android\\readium-sdk\\Platform\\Android\\epub3\\include\\

Could you help me ?

danielweck commented 6 years ago

Oh, android-ndk-r13b is quite old! I suggest you use the latest (tested) version 16 installed / updated automatically by AndroidStudio in C\:\\Users\\Fabrice\\AppData\\Local\\Android\\Sdk\\ndk-bundle (something like that).

danielweck commented 6 years ago

Thank you for correcting the erroneous ./lib/subfolder in my description of the readium-sdk "dist" path. Indeed: https://github.com/readium/readium-lcp-client/blob/9a33f286244368e8fa2dd6d0a1b0656a84217a2a/platform/android/lib/CMakeLists.txt#L56

danielweck commented 6 years ago

Also I think that when the app project is built from AndroidStudio (compared with building readium-lcp-client directly from the command line), the readium.sdk_lib_dir and readium.sdk_include_dir values expressed in local.properties are not propagated correctly, so the configuration defaults to a folder called libs instead of dist! See: https://github.com/readium/readium-lcp-client/blob/9a33f286244368e8fa2dd6d0a1b0656a84217a2a/platform/android/lib/build.gradle#L44 So, I will immediately update my instructions to use this path.

fjansen commented 6 years ago

I've updated the ndk, change the directory for libs... But compilation in step 12 failled. There's many warning... And 3 failled. In the middle of log :

[207/234] Building CXX object CMakeFiles/clientlib.dir/72ed2ea9b7b359b507749a975309bdbc/lcp-client-lib/AlgorithmNames.cpp.o
FAILED: C:\NS\soft\android-ndk-r16b\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64\bin\arm-linux-androideabi-g++.exe  --sysroot=C:/NS/soft/android-ndk-r16b/sysroot  -DFEATURES_READIUM -DREADIUM_GCC -DZLIB_ONLY -I../../../../../../../src/lcp-client-lib -I../../../../../../../src/lcp-client-lib/public -I../../../../../../../src/third-parties -I../../../../src/clientlib/cpp -I../../../../../../../src/lcp-content-filter -I../../../../../../../src/lcp-content-filter/public -IC:/NS/Job/Nordcompo/Readium/Test_launcher_LCP/SDKLauncher-Android/readium-sdk/Platform/Android/epub3/include -I../../../../src/contentfilter/cpp -isystem C:/NS/soft/android-ndk-r16b/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem C:/NS/soft/android-ndk-r16b/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -isystem C:/NS/soft/android-ndk-r16b/sources/cxx-stl/gnu-libstdc++/4.9/include/backward -isystem C:/NS/soft/android-ndk-r16b/sysroot/usr/include/arm-linux-androideabi -D__ANDROID_API__=19 -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Wa,--noexecstack -Wformat -Werror=format-security   -std=gnu++11 -fpic -frtti -fexceptions -fpermissive -Wall -O0  -fPIC -MD -MT CMakeFiles/clientlib.dir/9315d79a411ceec312e641b153ba7bea/src/lcp-client-lib/LcpService.cpp.o -MF CMakeFiles\clientlib.dir\9315d79a411ceec312e641b153ba7bea\src\lcp-client-lib\LcpService.cpp.o.d -o CMakeFiles/clientlib.dir/9315d79a411ceec312e641b153ba7bea/src/lcp-client-lib/LcpService.cpp.o -c C:\NS\Job\Nordcompo\Readium\Test_launcher_LCP\SDKLauncher-Android\readium-lcp-client\src\lcp-client-lib\LcpService.cpp

after

ninja: build stopped: subcommand failed.
:lib:externalNativeBuildArm7Debug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':lib:externalNativeBuildArm7Debug'.
> Build command failed.
  Error while executing process C:\Users\Fabrice\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {--build C:\NS\Job\Nordcompo\Readium\Test_launcher_LCP\SDKLauncher-Android\readium-lcp-client\platform\android\lib\.externalNativeBuild\cmake\arm7Debug\armeabi-v7a --target lcp}

After

[207/234] Building CXX object CMakeFiles/clientlib.dir/72ed2ea9b7b359b507749a975309bdbc/lcp-client-lib/AlgorithmNames.cpp.o
  FAILED: C:\NS\soft\android-ndk-r16b\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64\bin\arm-linux-androideabi-g++.exe  --sysroot=C:/NS/soft/android-ndk-r16b/sysroot  -DFEATURES_READIUM -DREADIUM_GCC -DZLIB_ONLY -I../../../../../../../src/lcp-client-lib -I../../../../../../../src/lcp-client-lib/public -I../../../../../../../src/third-parties -I../../../../src/clientlib/cpp -I../../../../../../../src/lcp-content-filter -I../../../../../../../src/lcp-content-filter/public -IC:/NS/Job/Nordcompo/Readium/Test_launcher_LCP/SDKLauncher-Android/readium-sdk/Platform/Android/epub3/include -I../../../../src/contentfilter/cpp -isystem C:/NS/soft/android-ndk-r16b/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem C:/NS/soft/android-ndk-r16b/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -isystem C:/NS/soft/android-ndk-r16b/sources/cxx-stl/gnu-libstdc++/4.9/include/backward -isystem C:/NS/soft/android-ndk-r16b/sysroot/usr/include/arm-linux-androideabi -D__ANDROID_API__=19 -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Wa,--noexecstack -Wformat -Werror=format-security   -std=gnu++11 -fpic -frtti -fexceptions -fpermissive -Wall -O0  -fPIC -MD -MT CMakeFiles/clientlib.dir/9315d79a411ceec312e641b153ba7bea/src/lcp-client-lib/LcpService.cpp.o -MF CMakeFiles\clientlib.dir\9315d79a411ceec312e641b153ba7bea\src\lcp-client-lib\LcpService.cpp.o.d -o CMakeFiles/clientlib.dir/9315d79a411ceec312e641b153ba7bea/src/lcp-client-lib/LcpService.cpp.o -c C:\NS\Job\Nordcompo\Readium\Test_launcher_LCP\SDKLauncher-Android\readium-lcp-client\src\lcp-client-lib\LcpService.cpp

And the end :

  ninja: build stopped: subcommand failed.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
danielweck commented 6 years ago

Damn, I wonder what the cause of compiler failure is...it is not clear from the console log :(

danielweck commented 6 years ago

Just an idea: my shell / command line tool is GitBash. What's yours?

danielweck commented 6 years ago

I have just followed the above instructions on my Windows 10 laptop (using GitBash) and everything seems to work fine. I have just changed the location of the libs from readium-sdk/Platform/Android/libs/ to readium-sdk/Platform/Android/epub3/libs/, so that it matches the "includes" location at readium-sdk/Platform/Android/epub3/include/, as per the default in: https://github.com/readium/readium-lcp-client/blob/9a33f286244368e8fa2dd6d0a1b0656a84217a2a/platform/android/lib/build.gradle#L44

...that being said, this is a detail that should not stop you building the readium-lcp-client lib from the ./gradlew build command line (it would only be problematic when trying to build the app from AndroidStudio).

danielweck commented 6 years ago

Oh wait, I remember now: there is a RELEASE compiler error for ZLib z_conf (everything works fine in DEBUG), see: https://github.com/readium/readium-lcp-client/issues/44

Is this what you see as well?

danielweck commented 6 years ago

Instead of ./gradlew build, try ./gradlew assembleDebug (this will skip RELEASE).

fjansen commented 6 years ago

My shell command line tool is git bash too. I've move the "libs" directory into SDKLauncher-Android\readium-sdk\Platform\Android\epub3\libs

libs
  DEBUG
    armeabi-v7a
       libepub3.so
       libgnustl_shared.so
  RELEASE
    armeabi-v7a
       libepub3.so
       libgnustl_shared.so

And run the command ./gradlew assembleDebug And failled again.

Here the complete log

$ ./gradlew assembleDebug
Starting a Gradle Daemon (subsequent builds will be faster)
extraCmake null
Build with rsdk
true
C:\NS\Job\Nordcompo\Readium\Test_launcher_LCP\SDKLauncher-Android\readium-sdk\Platform\Android\libs\
C:\NS\Job\Nordcompo\Readium\Test_launcher_LCP\SDKLauncher-Android\readium-sdk\Platform\Android\epub3\include\
Download https://jcenter.bintray.com/com/koushikdutta/ion/ion/maven-metadata.xml
The CompileOptions.bootClasspath property has been deprecated and is scheduled to be removed in Gradle 5.0. Please use the CompileOptions.bootstrapClasspath property instead.
The setTestClassesDir(File) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use the setTestClassesDirs(FileCollection) method instead.
The getTestClassesDir() method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use the getTestClassesDirs() method instead.
The ConfigurableReport.setDestination(Object) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use the method ConfigurableReport.setDestination(File) instead.
:lib:preBuild UP-TO-DATE
:lib:preArm7DebugBuild UP-TO-DATE
:lib:checkArm7DebugManifest
:lib:preArm7DebugAndroidTestBuild UP-TO-DATE
:lib:preArm7DebugUnitTestBuild UP-TO-DATE
:lib:preArm7ReleaseBuild UP-TO-DATE
:lib:preArm7ReleaseUnitTestBuild UP-TO-DATE
:lib:prepareComAndroidSupportSupportCompat2511Library
:lib:prepareComAndroidSupportSupportCoreUi2511Library
:lib:prepareComAndroidSupportSupportCoreUtils2511Library
:lib:prepareComAndroidSupportSupportFragment2511Library
:lib:prepareComAndroidSupportSupportMediaCompat2511Library
:lib:prepareComAndroidSupportSupportV42511Library
:lib:prepareComKoushikduttaAsyncAndroidasync221Library
:lib:prepareComKoushikduttaIonIon221Library
:lib:prepareArm7DebugDependencies
:lib:compileArm7DebugAidl UP-TO-DATE
:lib:compileLint UP-TO-DATE
:lib:copyArm7DebugLint NO-SOURCE
:lib:compileArm7DebugRenderscript UP-TO-DATE
:lib:generateArm7DebugBuildConfig UP-TO-DATE
:lib:generateArm7DebugResValues UP-TO-DATE
:lib:generateArm7DebugResources UP-TO-DATE
:lib:mergeArm7DebugResources UP-TO-DATE
:lib:processArm7DebugManifest UP-TO-DATE
:lib:processArm7DebugResources UP-TO-DATE
:lib:generateArm7DebugSources UP-TO-DATE
:lib:incrementalArm7DebugJavaCompilationSafeguard UP-TO-DATE
:lib:javaPreCompileArm7Debug
:lib:compileArm7DebugJavaWithJavac UP-TO-DATE
:lib:extractArm7DebugAnnotations
:lib:mergeArm7DebugShaders UP-TO-DATE
:lib:compileArm7DebugShaders UP-TO-DATE
:lib:generateArm7DebugAssets UP-TO-DATE
:lib:mergeArm7DebugAssets UP-TO-DATE
:lib:mergeArm7DebugProguardFiles UP-TO-DATE
:lib:packageArm7DebugRenderscript NO-SOURCE
:lib:packageArm7DebugResources UP-TO-DATE
:lib:processArm7DebugJavaRes NO-SOURCE
:lib:transformResourcesWithMergeJavaResForArm7Debug UP-TO-DATE
:lib:transformClassesAndResourcesWithSyncLibJarsForArm7Debug UP-TO-DATE
:lib:generateJsonModelArm7Debug UP-TO-DATE
:lib:externalNativeBuildArm7Debug
Build lcp armeabi-v7a
[1/28] Building CXX object CMakeFiles/clientlib.dir/4
62338f070c8a1894522f98ddb46849e/RsaSha256SignatureAlgorithm.cpp.o
[2/28] Building CXX object CMak
eFiles/clientlib.dir/9315d79a411ceec312e641b153ba7bea/src/lcp-client-lib/LinksLcpNode.cpp.o
[3/28] Building CXX object CMakeF
iles/clientlib.dir/462338f070c8a1894522f98ddb46849e/Sha256HashAlgorithm.cpp.o
[4/28] Building CXX object CMakeFiles/clientlib.dir/C_/NS/Job/Nordcompo/Readium/Test_launcher_LCP/SDKLauncher-Android/readium-lcp-client/src/lcp-client-lib/SymmetricAlgo
rithmEncryptedStream.cpp.o
ninja: build stopped: .
ninja: error: mkdir(CMakeFiles/clientlib.dir/C_/NS/Job/Nordcompo/Readium/Test_launcher_LCP/SDKLauncher-Android/readium-lcp-client): No such file or directory
:lib:externalNativeBuildArm7Debug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':lib:externalNativeBuildArm7Debug'.
> Build command failed.
  Error while executing process C:\Users\Fabrice\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {--build C:\NS\Job\Nordcompo\Readium\Test_launcher_LCP\SDKLauncher-Android\readium-lcp-client\platform\android\lib\.externalNativeBuild\cmake\arm7Debug\armeabi-v7a --target lcp}
  [1/28] Building CXX object CMakeFiles/clientlib.dir/462338f070c8a1894522f98ddb46849e/RsaSha256SignatureAlgorithm.cpp.o
  [2/28] Building CXX object CMakeFiles/clientlib.dir/9315d79a411ceec312e641b153ba7bea/src/lcp-client-lib/LinksLcpNode.cpp.o
  [3/28] Building CXX object CMakeFiles/clientlib.dir/462338f070c8a1894522f98ddb46849e/Sha256HashAlgorithm.cpp.o
  [4/28] Building CXX object CMakeFiles/clientlib.dir/C_/NS/Job/Nordcompo/Readium/Test_launcher_LCP/SDKLauncher-Android/readium-lcp-client/src/lcp-client-lib/SymmetricAlgorithmEncryptedStream.cpp.o
  ninja: build stopped: .
  ninja: error: mkdir(CMakeFiles/clientlib.dir/C_/NS/Job/Nordcompo/Readium/Test_launcher_LCP/SDKLauncher-Android/readium-lcp-client): No such file or directory

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 2s
31 actionable tasks: 13 executed, 18 up-to-date
danielweck commented 6 years ago

Have you tried ./gradlew clean before ./gradlew assembleDebug?

fjansen commented 6 years ago

Build failed. I attach the complete log. log.txt

danielweck commented 6 years ago

Yep

In file included from ../../../../../../../src/third-parties/ziplib/Source/ZipLib/ZipArchiveEntry.h:5:0,
                 from ../../../../../../../src/third-parties/ziplib/Source/ZipLib/ZipArchive.h:4,
                 from ../../../../../../../src/third-parties/ziplib/Source/ZipLib/ZipFile.h:2,
                 from C:\NS\Job\Nordcompo\Readium\Test_launcher_LCP\SDKLauncher-Android\readium-lcp-client\src\lcp-client-lib\LcpService.cpp:52:
../../../../../../../src/third-parties/ziplib/Source/ZipLib/methods/ICompressionMethod.h:2:50: fatal error: ../compression/compression_interface.h: No such file or directory
 #include "../compression/compression_interface.h"
                                                  ^
compilation terminated.
danielweck commented 6 years ago

A similar issue was fixed in the developbranch of readium-lcp-client:

https://github.com/readium/readium-lcp-client/commit/6ae365f9a3d7eca748eed0ba954b2257e377f0f9

See history: https://github.com/readium/readium-lcp-client/commits/develop vs: https://github.com/readium/readium-lcp-client/commits/master

Are you using master?

fjansen commented 6 years ago

I use the develop branch as you told me :

SDKLauncher-Android (branch feature/lcp)
    readium-sdk (branch develop)
    readium-lcp-client (branch develop)
    readium-shared-js (branch develop)
        readium-cfi-js (branch develop)
danielweck commented 6 years ago

Bizarrely, the code in the develop branch builds just fine on my Windows 10 machine, with the latest AndroidStudio / NDK / SDK installation (in DEBUG mode, ./gradlew assembleDebug)...

So it seems that for some weird reason, ZipLib continues to fail on Windows in some cases (works fine on MacOS and Linux): https://github.com/readium/readium-lcp-client/tree/develop/src/third-parties/ziplib/Source/ZipLib

My previous fix consisted in moving the templated C++ classes ( https://github.com/readium/readium-lcp-client/issues/42 ), maybe a similar workaround can be applied to address your compile error ... but I can't reproduce this bug so I cannot help :(

Maybe this is also related to this other ZLib error (RELEASE-specific, at least on my machine): https://github.com/readium/readium-lcp-client/issues/44

??

danielweck commented 6 years ago

If you are still having problems, please contact @llemeurfr who will give you pointers to prebuilt readium-sdk and readium-lcp-client libs.

danielweck commented 6 years ago

So, it is in fact possible to make minimal changes to the SDKLauncher-Android Gradle script in order to reference the prebuilt *.so libs for both ReadiumSDK and LCP. See: https://github.com/readium/SDKLauncher-Android/compare/feature/lcp...feature/prebuilt-libs

Prerequisites:

Copy libepub3.so + libgnustl_shared.so into SDKLauncher-Android/readium-sdk/Platform/Android/epub3/libs/armeabi-v7a/

Copy liblcp.so into SDKLauncher-Android/readium-lcp-client/platform/android/lib/libs/armeabi-v7a/

I tested this with both Gradle stable and experimental (with the latter, I was able to step/debug into hybrid C++ and Java code, as usual).

Once the refactoring of the build system is finished (i.e. Android Studio latest version, Gradle not-experimental, CMake) then we will re-generate the AARs for LCP client lib, and create them for ReadiumSDK. This will offer developers / integrators the option to completely bypass native source code compilation (at last!), whilst still being able to step into hybrid C++ / Java code in DEBUB mode.