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

ndk-build fails for NDK r16b #248

Closed
Hocuri opened this issue Feb 9, 2018 · 5 comments
Closed

ndk-build fails for NDK r16b #248

Hocuri opened this issue Feb 9, 2018 · 5 comments
Labels

Comments

@Hocuri
Copy link
Collaborator

Hocuri commented Feb 9, 2018

Delta Chat version

Newest GitHub version

Expected behavior

ndk-build to work :-)

Actual behavior

$ ndk-build
/home/user/DeltaChat/android-ndk-r16b/build/core/setup-app.mk:81: Android NDK: Application targets deprecated ABI(s): armeabi    
/home/user/DeltaChat/android-ndk-r16b/build/core/setup-app.mk:82: Android NDK: Support for these ABIs will be removed in a future NDK release.
Many lines of output...
[armeabi] Compile arm    : messenger.1 <= misc.c
jni/./messenger-backend/libs/netpgp/src/misc.c: In function 'pgp_mem_readfile':
jni/./messenger-backend/libs/netpgp/src/misc.c:953:13: error: call to 'mmap' declared with attribute error: mmap is not available with _FILE_OFFSET_BITS=64 when using GCC until android-21. Either raise your minSdkVersion, disable _FILE_OFFSET_BITS=64, or switch to Clang.
  mem->buf = mmap(NULL, mem->allocated, PROT_READ,
             ^
make: *** [obj/local/armeabi/objs/messenger.1/./messenger-backend/libs/netpgp/src/misc.o] Error 1

Naturally, when i build and launch Delta Chat anyway, it crashes ("Unfortunately, Delta Chat has stopped.").

Steps to reproduce the problem

Follow the "Install Development Environment" and then the "Build" instructions in the readme (Or did I miss something / do something wrong ?)

@r10s
Copy link
Member

r10s commented Feb 9, 2018

When DuckDuckGo'ing for the core error ("mmap is not available with _FILE_OFFSET_BITS=64 when using GCC until android-21. Either raise your minSdkVersion, disable _FILE_OFFSET_BITS=64, or switch to Clang."), I got eg. this result - android/ndk#332 (comment) - seems as if we have to fix sth. for the newer NDKs.

Maybe this is also the reasons why F-Droid makes problems these days.

@Hocuri
Copy link
Collaborator Author

Hocuri commented Feb 10, 2018

I think that clang can be used like this:

diff --git a/MessengerProj/jni/Application.mk b/MessengerProj/jni/Application.mk
index 038832a..5f18821 100644
--- a/MessengerProj/jni/Application.mk
+++ b/MessengerProj/jni/Application.mk
@@ -1,4 +1,4 @@
 APP_PLATFORM := android-14
 APP_ABI := armeabi armeabi-v7a x86
-NDK_TOOLCHAIN_VERSION := 4.9
+NDK_TOOLCHAIN_VERSION := clang
 APP_STL := gnustl_static

With clang, you have to use NULL instead of 0 if you mean a pointer: (Or would nullptr be better?)

diff --git a/MessengerProj/jni/gifvideo.cpp b/MessengerProj/jni/gifvideo.cpp
index 3de0db8..1b341b2 100644
--- a/MessengerProj/jni/gifvideo.cpp
+++ b/MessengerProj/jni/gifvideo.cpp
@@ -160,7 +160,7 @@ jint Java_com_b44t_ui_Components_AnimatedFileDrawable_createDecoder(JNIEnv *env,
         info->video_dec_ctx = info->video_stream->codec;
     }
     
-    if (info->video_stream <= 0) {
+    if (info->video_stream == NULL) {
         LOGE("can't find video stream in the input, aborting %s", info->src);
         delete info;
         return 0;

(Am I right assuming that a pointer can't have a negative value?)

But there still is an error (although it appears way later):

clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [obj/local/armeabi/libmessenger.1.so] Error 1

I attached the full error log: error.txt

Update: The diffs can be seen here: master...Hocceruser:master

@r10s
Copy link
Member

r10s commented Feb 10, 2018

Okay, while my normal development environment works, I can reproduce the problem with a fresh Android Studio install using the new NDK android-ndk-r16b-*-x86_64.zip - i assume, you use the same one?

As a workaround, you could use NDK android-ndk-r15c-*-x86_64.zip , however, of course, sooner or later we should fix the problem directly. I've added an appropriate hint in the readme.

PR to fix the issue are very welcome.

Regarding the F-Droid-Problem: F-Droid uses r15c, so this should not be a problem there.

@r10s r10s changed the title ndk build failed ndk-build failes for NDK r16b Feb 10, 2018
@r10s r10s changed the title ndk-build failes for NDK r16b ndk-build fails for NDK r16b Feb 10, 2018
@r10s
Copy link
Member

r10s commented Feb 23, 2018

seems as if we stuck in ndk r14b, see #220, one can fix this later, but for now, this seems to be out of scope.

@r10s r10s added the bug label Feb 23, 2018
@Ampli-fier
Copy link
Contributor

Closed after README update 3ecb5a4: "dependecy on NDK 14b".

r10s pushed a commit that referenced this issue Jan 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants