OpenRCT2 / openrct2-dependencies-android

3 stars 4 forks source link

libpng on arm64 doesn't compile #1

Closed marijnvdwerf closed 8 years ago

marijnvdwerf commented 8 years ago
[1/33] Building C object CMakeFiles/png-fix-itxt.dir/contrib/tools/png-fix-itxt.c.o
[2/33] Generating scripts/symbols.out
[3/33] Generating pngprefix.h
[4/33] Generating pnglibconf.c
[5/33] Generating scripts/pnglibconf.c
[6/33] Generating pnglibconf.out
[7/33] Generating scripts/symbols.chk
[8/33] Linking C executable png-fix-itxt
[9/33] Generating pnglibconf.h
[10/33] Generating scripts/prefix.out
[11/33] Generating scripts/intprefix.out
[12/33] Generating scripts/sym.out
[13/33] Generating scripts/vers.out
[14/33] Generating libpng.sym
[15/33] Generating libpng.vers
[16/33] Building C object CMakeFiles/png.dir/png.c.o
[17/33] Building C object CMakeFiles/png.dir/pngerror.c.o
[18/33] Building C object CMakeFiles/png.dir/pngget.c.o
[19/33] Building C object CMakeFiles/png.dir/pngmem.c.o
[20/33] Building C object CMakeFiles/png.dir/pngpread.c.o
[21/33] Building C object CMakeFiles/png.dir/pngread.c.o
[22/33] Building C object CMakeFiles/png.dir/pngrio.c.o
[23/33] Building C object CMakeFiles/png.dir/pngrtran.c.o
[24/33] Building C object CMakeFiles/png.dir/pngrutil.c.o
[25/33] Building C object CMakeFiles/png.dir/pngset.c.o
[26/33] Building C object CMakeFiles/png.dir/pngtrans.c.o
[27/33] Building C object CMakeFiles/png.dir/pngwio.c.o
[28/33] Building C object CMakeFiles/png.dir/pngwrite.c.o
[29/33] Building C object CMakeFiles/png.dir/pngwtran.c.o
[30/33] Building C object CMakeFiles/png.dir/pngwutil.c.o
[31/33] Linking C shared library libpng16.so
FAILED: : && /usr/local/opt/android-sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/bin/aarch64-linux-android-gcc  --sysroot=/usr/local/opt/android-sdk/ndk-bundle/platforms/android-21/arch-arm64 -fPIC -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -Wa,--noexecstack -Wformat -Werror=format-security -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -Wa,--noexecstack -Wformat -Werror=format-security  -O2 -DNDEBUG -O2 -DNDEBUG  -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now   -Wl,--version-script='/Users/marijn/deps/build/arm64-v8a/build/png/src/png_ext-build/libpng.vers' -shared -Wl,-soname,libpng16.so -o libpng16.so CMakeFiles/png.dir/png.c.o CMakeFiles/png.dir/pngerror.c.o CMakeFiles/png.dir/pngget.c.o CMakeFiles/png.dir/pngmem.c.o CMakeFiles/png.dir/pngpread.c.o CMakeFiles/png.dir/pngread.c.o CMakeFiles/png.dir/pngrio.c.o CMakeFiles/png.dir/pngrtran.c.o CMakeFiles/png.dir/pngrutil.c.o CMakeFiles/png.dir/pngset.c.o CMakeFiles/png.dir/pngtrans.c.o CMakeFiles/png.dir/pngwio.c.o CMakeFiles/png.dir/pngwrite.c.o CMakeFiles/png.dir/pngwtran.c.o CMakeFiles/png.dir/pngwutil.c.o  -lz -lm -lm && :
CMakeFiles/png.dir/pngrutil.c.o: In function `png_init_filter_functions':
/Users/marijn/deps/build/arm64-v8a/build/png/src/png_ext/pngrutil.c:3982: undefined reference to `png_init_filter_functions_neon'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
LRFLEW commented 8 years ago

png_init_filter_functions_neon is defined in arm/arm_init.c. I'm looking into preprocessor macros that might be affecting this.

EDIT: Do you have the configure log I can look at?

LRFLEW commented 8 years ago

Looking through the configuration and source files, it seems that the NEON support with libPNG is weird. They suggest not using the check option (aka, runtime checks) due to weird OS-specific support (though if it supports Android, I don't see that as a reason not to use it). Forcing on is also kind of strange, with the configuration suggesting using -mfpu=neon manually (or something). I don't know what is the default for the option (and I'm not even sure some of the options work properly).

We could always just disable NEON. IIRC, libPNG is only used for saving screenshots (and font loading), which is infrequent enough that a minor speedup shouldn't be a big deal. I would like to get it working, but I would probably need the configuration log to get to the bottom of it.

marijnvdwerf commented 8 years ago

Will the build folder for libpng suffice? Archief.zip

LRFLEW commented 8 years ago

Do you need to use CMake for this? Looking over the CMakeLists.txt, it seems really outdated, and not properly handling preprocessor macros for neon. The Configure script looks better, but I don't know if it's possible to use it for Android builds.

LRFLEW commented 8 years ago

If you can't (or don't want to) use the configure script, you could just simulate what it does to fix this specific issue. When you use --enable-arm-neon=no with the configure script, it adds to the CFLAGS -DPNG_ARM_NEON_OPT=0. Feel free to edit the CMake script (or manually override it) to get it working.