keymanapp / keyman

Keyman cross platform input methods system running on Android, iOS, Linux, macOS, Windows and mobile and desktop web
https://keyman.com/
Other
398 stars 112 forks source link

bug(core): Getting a warning when linking statically with libkeymancore #10882

Open ermshiperete opened 8 months ago

ermshiperete commented 8 months ago

On Linux, running the script below which builds an app with static linking results in a warning:

/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/libicuuc.a(putil.ao): in function `uprv_dl_open_70':
(.text+0x1936): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking

We should fix the warning (which probably requires static linking to ICU for the static libkeymancore library), or not ship the static version of libkeymancore (and remove the dependency on libicu-dev from linux/debian/control and the requires.private line from the keyman_core.pc file).

cat <<EOF > keymantest.c
#include <keyman/keyman_core_api.h>

int main(int argc, char *argv[]) {
  km_core_option_item opts[] = {KM_CORE_OPTIONS_END};
  km_core_keyboard *kb = NULL;
  km_core_state *state = NULL;
  km_core_keyboard_load(NULL, &kb);
  km_core_state_create(kb, opts, &state);
  km_core_actions const *a = km_core_state_get_actions(state);
}
EOF

# shellcheck disable=SC2046 disable=SC2312
g++ keymantest.c -static $(pkg-config --cflags --libs keyman_core) \
  $(pkg-config --cflags --libs icu-uc) $(pkg-config --cflags --libs icu-i18n)

This should also be added as an autopkgtest to linux/debian/tests/test-build.

mcdurdin commented 8 months ago

Do we need to fix this one before release of 17.0?

ermshiperete commented 8 months ago

No, I don't think this has to be necessarily fixed for 17.0. It's more of a cleanup task.

mcdurdin commented 8 months ago

Moving to 18.0

ermshiperete commented 4 months ago

Moving this to 19.0 since I doubt that I'll get to it for 18.0. @mcdurdin

mcdurdin commented 4 months ago

@srl295 is this something you'd like to think about?

srl295 commented 4 months ago

@srl295 is this something you'd like to think about?

I can take it.

From the icu side dlopen can be shut off if it's rebuilt otherwise there might be some kind of workaround.

Possible upstream issue (icu and the distro packagers )