2

I am trying to follow instructions on https://github.com/openstf/android-libjpeg-turbo and compile libjpeg-turbo library for android on Windows 10.

I have installed android-ndk-r10e and use it as follows on that project to compile libjpeg-turbo for armeabi through command line:

C:\android-ndk-r10e\android-ndk-r10e\ndk-build.cmd APP_ABI=armeabi

However I am getting the following issue and I do not know how to solve it:

C:/android-ndk-r10e/build/core/build-binary.mk:464: *** multiple target patterns.  Stop.

The same result is using r13b version of NDK:

C:/android-ndk-r13b/build/core/build-binary.mk:497: *** multiple target patterns.  Stop.

EDIT:

The result of ndk-build.cmd APP_ABI=armeabi DUMP_LOCAL_SRC_FILES:

libjpeg-turbo-1.4.1/jcapimin.c libjpeg-turbo-1.4.1/jcapistd.c libjpeg-turbo-1.4.1/jccoefct.c libjpeg-turbo-1.4.1/jccolor.c libjpeg-turbo-1.4.1/jcdctmgr.c libjpeg-turbo-1.4.1/jchuff.c libjpeg-turbo-1.4.1/jcinit.c libjpeg-turbo-1.4.1/jcmainct.c libjpeg-turbo-1.4.1/jcmarker.c libjpeg-turbo-1.4.1/jcmaster.c libjpeg-turbo-1.4.1/jcomapi.c libjpeg-turbo-1.4.1/jcparam.c libjpeg-turbo-1.4.1/jcphuff.c libjpeg-turbo-1.4.1/jcprepct.c libjpeg-turbo-1.4.1/jcsample.c libjpeg-turbo-1.4.1/jctrans.c libjpeg-turbo-1.4.1/jdapimin.c libjpeg-turbo-1.4.1/jdapistd.c libjpeg-turbo-1.4.1/jdatadst.c libjpeg-turbo-1.4.1/jdatasrc.c libjpeg-turbo-1.4.1/jdcoefct.c libjpeg-turbo-1.4.1/jdcolor.c libjpeg-turbo-1.4.1/jddctmgr.c libjpeg-turbo-1.4.1/jdhuff.c libjpeg-turbo-1.4.1/jdinput.c libjpeg-turbo-1.4.1/jdmainct.c libjpeg-turbo-1.4.1/jdmarker.c libjpeg-turbo-1.4.1/jdmaster.c libjpeg-turbo-1.4.1/jdmerge.c libjpeg-turbo-1.4.1/jdphuff.c libjpeg-turbo-1.4.1/jdpostct.c libjpeg-turbo-1.4.1/jdsample.c libjpeg-turbo-1.4.1/jdtrans.c libjpeg-turbo-1.4.1/jerror.c libjpeg-turbo-1.4.1/jfdctflt.c libjpeg-turbo-1.4.1/jfdctfst.c libjpeg-turbo-1.4.1/jfdctint.c libjpeg-turbo-1.4.1/jidctflt.c libjpeg-turbo-1.4.1/jidctfst.c libjpeg-turbo-1.4.1/jidctint.c libjpeg-turbo-1.4.1/jidctred.c libjpeg-turbo-1.4.1/jquant1.c libjpeg-turbo-1.4.1/jquant2.c libjpeg-turbo-1.4.1/jutils.c libjpeg-turbo-1.4.1/jmemmgr.c libjpeg-turbo-1.4.1/jmemnobs.c  libjpeg-turbo-1.4.1/jaricom.c libjpeg-turbo-1.4.1/jcarith.c libjpeg-turbo-1.4.1/jdarith.c  libjpeg-turbo-1.4.1/turbojpeg.c libjpeg-turbo-1.4.1/transupp.c libjpeg-turbo-1.4.1/jdatadst-tj.c libjpeg-turbo-1.4.1/jdatasrc-tj.c
user1563721
  • 1,373
  • 3
  • 28
  • 46
  • Why did you choose such an old version of NDK? – Alex Cohn Feb 26 '17 at 22:12
  • 1
    I chose that version of NDK as a starting point because it is known to work. However if I use current r13b or r14 beta 2, I am getting the same error. – user1563721 Feb 27 '17 at 06:11
  • 1
    A bit of a stretch guess, but maybe caused by having an absolute path (possibly via `$(LOCAL_PATH)`) in one of the source files? iirc "multiple target patterns" is the error you get when `:` appears in a file name in make, which would be the case for a Windows absolute path. – Dan Albert Feb 27 '17 at 21:10
  • @DanAlbert, it's on line `$(foreach src,$(filter %.c,$(LOCAL_SRC_FILES)), $(call compile-c-source,$(src),$(call get-object-name,$(src))))` which suggests that some C file is listed twice. This does not reproduce for me, though – Alex Cohn Feb 28 '17 at 09:33
  • run `ndk-build APP_ABI=armeabi DUMP_LOCAL_SRC_FILES`, and check that there are no duplcates – Alex Cohn Feb 28 '17 at 09:36
  • cheked with `ndk-build APP_ABI=armeabi DUMP_LOCAL_SRC_FILES` and no duplicates found, see the result in edited post – user1563721 Feb 28 '17 at 18:44
  • I didn't get a notification about your reply. OK so this is not LOCAL_SRC_FILES. Now let us make sure that the LOCAL_PATH is good. It should not have spaces, colons (:), or other weird characters. So, if `DUMP_LOCAL_PATH` does not reveal something suspicious, go to file `C:\android-ndk-r13b\build\core\definitions.mk:1464` (it should read `$$(call generate-file-dir,$$(_OBJ))`) and insert new line `$(info _OBJ=$(_OBJ))` before it _(don't forget to restore the file after you have the issue resolved !)_. – Alex Cohn Mar 09 '17 at 15:47
  • On ndk-build & Windows, you need to remove use of $abspath in Android.mk in libjpeg-turbo, LOCAL_PATH := $(call my-dir). Thanks @DanAlbert for the tip. – Erkki Nokso-Koivisto Mar 09 '19 at 19:39

1 Answers1

1

The whole problem was in a structure of Android.mk and underlying Android.mk files which were referenced by include $(call all-subdir-makefiles). In that case Android NDK was trying to load source files multiple times.

After correcting it, the compilation works without any issue.

user1563721
  • 1,373
  • 3
  • 28
  • 46