Search code examples
candroid-makefortify-source

Android 4.4, undefined reference to __printf_chk


I am moving some libraries from Android 4.3 to Android 4.4

The projects that used to compile in Android 4.3 now gives below error when compiled using Android 4.4 sources

/home/vishallocal/TI/android/kitkat/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6/sysroot/usr/include/bits/stdio2.h:105: error: undefined reference to '__printf_chk' /home/vishallocal/TI/android/kitkat/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6/sysroot/usr/include/bits/stdio2.h:105: error: undefined reference to '__printf_chk' /home/vishallocal/TI/android/kitkat/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6/sysroot/usr/include/bits/stdio2.h:105: error: undefined reference to '__printf_chk' /home/vishallocal/TI/android/kitkat/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6/sysroot/usr/include/bits/stdio2.h:105: error: undefined reference to '__printf_chk' collect2: error: ld returned 1 exit status

Any pointers on resolving this?


Solution

  • Fixed the issue by building the project with FORTIFY_SOURCE flag disabled

    Added following lines to Android.mk LOCAL_CFLAGS += -U_FORTIFY_SOURCE