0

I am learning Use the NDK with other build systems. Trying to get the example for Autoconf to work. It looks like ./configure --host $TARGET is working as expected. But I get an error while executing make:

arm/filter_neon.S  -fPIC -DPIC -o arm/.libs/filter_neon.o
arm/filter_neon.S:24:17: error: expected string in directive
.section __LLVM,__asm
                ^
make[1]: *** [Makefile:1187: arm/filter_neon.lo] Error 1

I am new to Android and Linux. Here is the .sh-file I am using on Ubuntu:

#!/bin/bash -v
# Check out the source.
git clone https://github.com/glennrp/libpng
cd libpng
# Only choose one of these, depending on your build machine...
#export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/darwin-x86_64
export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/linux-x86_64
# Only choose one of these, depending on your device...
#export TARGET=aarch64-linux-android
export TARGET=armv7a-linux-androideabi
#export TARGET=i686-linux-android
#export TARGET=x86_64-linux-android
# Set this to your minSdkVersion.
export API=21
# Configure and build.
export AR=$TOOLCHAIN/bin/$TARGET-ar
export AS=$TOOLCHAIN/bin/$TARGET-as
export CC=$TOOLCHAIN/bin/$TARGET$API-clang
export CXX=$TOOLCHAIN/bin/$TARGET$API-clang++
export LD=$TOOLCHAIN/bin/$TARGET-ld
export RANLIB=$TOOLCHAIN/bin/$TARGET-ranlib
export STRIP=$TOOLCHAIN/bin/$TARGET-strip
./configure --host $TARGET
make

What am I doing wrong, why the tutorial example doesn't work? Thank you in advance.

Ivan F.
  • 109
  • 1
  • 8
  • 2
    [The __asm {...} style of inline assembly is non-standard and not supported by clang.](https://stackoverflow.com/a/13315445/645128) (appears you are using `CLANG`, `__LLVM`) – ryyker Aug 26 '20 at 19:00

2 Answers2

2

There are bug in libpng. Do not use cloning from github. Use released version. There are different link on github https://github.com/glennrp/libpng/releases/tag/v1.6.35

Change this script from official doc and do not clone github repo, just download archive and run this script inside of it.

For me all is working.

  • 1
    This is probably helpful, but it's not strictly an answer to the question, since at some point the buggy code may end up being released... See https://github.com/glennrp/libpng/pull/383 for a patch that fixes it. – Dan Field Jun 02 '21 at 05:16
0

Hm. This is my fault :)

I added this to support bitcode enabled builds with non-Apple LLVM. It works there but not on Android. Using the release as suggested by @Alexandr Kirilov is a good call, but this should be fixed upstream in libpng as well.

It needs to be guarded by __APPLE__ as well, see https://github.com/glennrp/libpng/pull/383

Unfortunately, when I patched this I only tested it on macOS/iOS platforms and not on other arm platforms :(

Dan Field
  • 20,885
  • 5
  • 55
  • 71