2

I'm trying to compile libdispatch for linux on Android. However I could not find any instructions for Android in the project files.

I can see there are several StackOverflow questions about using libdispatch, but the information is rather thin.

Has anyone successfully compiled libdispatch for Android using NDK?

2
  • 1
    If anyone is having the same issue, here's what worked for me: ndk-build NDK_TOOLCHAIN_VERSION=clang NDK_PROJECT_PATH=libdispatch/ APP_BUILD_SCRIPT=libdispatch/Android.mk Apr 7, 2016 at 13:38
  • 1
    For anyone finding this later, the command Sam posted worked for me, but only after also cloning github.com/mackyle/blocksruntime github.com/PSPDFKit-labs/libkqueue and github.com/PSPDFKit-labs/libpthread_workqueue into the same directory libdispatch is in.
    – milch
    Jul 5, 2016 at 7:41

1 Answer 1

1

I haven't personally tried compiling libdispatch for Android, but I have built many other libraries. It looks like building libdispatch should be quite easy, as there is already an Android.mk file in the repository. You should be able to build this library with the following command (split across lines for readability):

<ndk directory path>/ndk-build \ 
-C <path to libdispatch source directory> \
NDK_LIBS_OUT=<path to directory for built libraries> \
APP_BUILD_SCRIPT=Android.mk 
9
  • I've tried that earlier and it gave me error: Android NDK: Could not find application project directory ! Android NDK: Please define the NDK_PROJECT_PATH variable to point to it. Apr 6, 2016 at 19:26
  • Did you pass the path to your project directory to ndk-build using the -C argument? Some folks are using NDK_PROJECT_PATH= instead of -C to pass the project path, but I've never used that with newer NDKs. What version of the ndk are you using? Apr 6, 2016 at 20:17
  • I'm trying to compile and build the libdispatch project checked out from Github. Here's the error I get now: ndk-build NDK_PROJECT_PATH=./libdispatch Android NDK: Your APP_BUILD_SCRIPT points to an unknown file: ./libdispatch/jni/Android.mk /Users/sam/Library/Android/sdk/ndk-bundle/build/core/add-application.mk:195: *** Android NDK: Aborting....Stop. Do I need to include the libdispatch as a submodule in an Android project? I'm totally lost :-( Apr 6, 2016 at 20:44
  • The expectation is that the Android.mk file is always inside a directory named jni, so ndk-build is attempting to find the path jni/Android.mk inside the libdispatch directory. It doesn't exist, hence the error. This is a mistake on the part of the libdispatch developers, IMO. Try adding APP_BUILD_SCRIPT=<path to libdispatch directory>/Android.mk to your ndk-build command. Apr 7, 2016 at 13:06
  • Actually, use APP_BUILD_SCRIPT=Android.mk to your ndk-build command. APP_BUILD_SCRIPT is relative to the directory specified with -C. Apr 7, 2016 at 13:12

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.