Skip to content

Fix glib build issue on android api 28

I meet a glib build issue on ANDROID_PIE, libiconv will be added into deps, and iconv.h will be install to dist path.
when gilb configure, cc.has_function('iconv_open') in meson.build will return true., so it will not link the external libiconv.
But, in the compile command line, the '-isystem */cerbero/build/dist/android_arm64/include' param pass before the '-isystem */android-ndk-21/sysroot/usr/include' , this cause the preprocessor include the 'wrong iconv.h'.
In the 'wrong iconv.h', the symbol 'iconv_open' redefined to 'libiconv_open'.
As the result, I got the symbol undefined error:

/home/lzy/cerbero/build/sources/android_arm64/glib-2.62.5/_builddir/../glib/gconvert.c:168: error: undefined reference to 'libiconv_open'
/home/lzy/cerbero/build/sources/android_arm64/glib-2.62.5/_builddir/../glib/gconvert.c:278: error: undefined reference to 'libiconv'
/home/lzy/cerbero/build/sources/android_arm64/glib-2.62.5/_builddir/../glib/gconvert.c:301: error: undefined reference to 'libiconv_close'

I think refine the condition to add libiconv deps is a way to fix that. and of course it works.
Maybe other issue exist, for example:

  • why system-include-path pass behind dist-include-path to compile. (meson bug?)
  • why symbol 'iconv_open' redefined to 'libiconv_open' in inconv.h (what is the macro LIBICONV_PLUG, I'am not know well about that)

Merge request reports