diff options
| author | Kai Kang <kai.kang@windriver.com> | 2023-07-12 13:53:50 +0800 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2023-07-13 07:22:17 -0700 |
| commit | e3606c223e8195dc57a41c64ca670958f1809d6f (patch) | |
| tree | aa1ba8f6d4d24d4c45e70c16f7851ed8a4c298c2 | |
| parent | b4bdb5849e9e550cce50ff2f5e330d9ee93cb648 (diff) | |
| download | meta-openembedded-e3606c223e8195dc57a41c64ca670958f1809d6f.tar.gz | |
fltk-native: fix libdl link issue
It fails to build fltk-native on Ubuntu 20.04 with glibc 2.31:
| /path_to/tmp/hosttools/ld: lib/libfltk.a(Fl_Native_File_Chooser.cxx.o): in function `fl_dlopen(char const*, char const*)':
| Fl_Native_File_Chooser.cxx:(.text+0x61a): undefined reference to `dlopen'
| /path_to/tmp/hosttools/ld: lib/libfltk.a(Fl_Native_File_Chooser.cxx.o): in function `Fl_GTK_File_Chooser::probe_for_GTK_libs()':
| Fl_Native_File_Chooser.cxx:(.text+0xf92): undefined reference to `dlerror'
The original fix in fltk-native recipe does not work any more because '-ldl'
appears before lib/libfltk.a and causes dlopen() unresolved. The reason why it
doesn't fail on other hosts is that the functions dlopen(), dlerror() etc. have
been moved to libc.so since glibc 2.34 via the commits in glibc:
0c1c3a771e dlfcn: Move dlopen into libc
add8d7ea01 dlfcn: Move dlvsym into libc
6dfc0207eb dlfcn: Move dlinfo into libc
492560a32e dlfcn: Move dladdr1 into libc
6a1ed32789 dlfcn: Move dlmopen into libc
77f876c0e3 dlfcn: Move dlsym into libc
602252b553 dlfcn: Move dladdr into libc
d8cce17d2a dlfcn: Move dlclose into libc
Append 'dl' to fltk link items explictly to fix the error.
Signed-off-by: Kai Kang <kai.kang@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
| -rw-r--r-- | meta-oe/recipes-support/fltk/fltk-native.bb | 5 | ||||
| -rw-r--r-- | meta-oe/recipes-support/fltk/fltk/fltk-native-link-libdl.patch | 44 |
2 files changed, 46 insertions, 3 deletions
diff --git a/meta-oe/recipes-support/fltk/fltk-native.bb b/meta-oe/recipes-support/fltk/fltk-native.bb index 8d3992a6ec..3e8e2cdf77 100644 --- a/meta-oe/recipes-support/fltk/fltk-native.bb +++ b/meta-oe/recipes-support/fltk/fltk-native.bb | |||
| @@ -2,6 +2,8 @@ require ${BPN}.inc | |||
| 2 | 2 | ||
| 3 | DEPENDS = "zlib-native jpeg-native libpng-native libxext-native libxft-native" | 3 | DEPENDS = "zlib-native jpeg-native libpng-native libxext-native libxft-native" |
| 4 | 4 | ||
| 5 | SRC_URI += "file://fltk-native-link-libdl.patch" | ||
| 6 | |||
| 5 | inherit native | 7 | inherit native |
| 6 | 8 | ||
| 7 | EXTRA_OECMAKE += " \ | 9 | EXTRA_OECMAKE += " \ |
| @@ -15,9 +17,6 @@ EXTRA_OECMAKE += " \ | |||
| 15 | -DOPTION_USE_XCURSOR=OFF \ | 17 | -DOPTION_USE_XCURSOR=OFF \ |
| 16 | " | 18 | " |
| 17 | 19 | ||
| 18 | # lib/libfltk.a(Fl_Native_File_Chooser.cxx.o): undefined reference to symbol 'dlsym@@GLIBC_2.2.5' | ||
| 19 | LDFLAGS += "-ldl" | ||
| 20 | |||
| 21 | do_install:append() { | 20 | do_install:append() { |
| 22 | # make sure native fltk-config is not used accidentaly | 21 | # make sure native fltk-config is not used accidentaly |
| 23 | rm -f ${D}${bindir}/fltk-config | 22 | rm -f ${D}${bindir}/fltk-config |
diff --git a/meta-oe/recipes-support/fltk/fltk/fltk-native-link-libdl.patch b/meta-oe/recipes-support/fltk/fltk/fltk-native-link-libdl.patch new file mode 100644 index 0000000000..e140ce2166 --- /dev/null +++ b/meta-oe/recipes-support/fltk/fltk/fltk-native-link-libdl.patch | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | Upstream-Status: Inappropriate [cross build specific] | ||
| 2 | |||
| 3 | It fails to build fltk-native on Ubuntu 20.04 with glibc 2.31: | ||
| 4 | |||
| 5 | | /path_to/tmp/hosttools/ld: lib/libfltk.a(Fl_Native_File_Chooser.cxx.o): in function `fl_dlopen(char const*, char const*)': | ||
| 6 | | Fl_Native_File_Chooser.cxx:(.text+0x61a): undefined reference to `dlopen' | ||
| 7 | | /path_to/tmp/hosttools/ld: lib/libfltk.a(Fl_Native_File_Chooser.cxx.o): in function `Fl_GTK_File_Chooser::probe_for_GTK_libs()': | ||
| 8 | | Fl_Native_File_Chooser.cxx:(.text+0xf92): undefined reference to `dlerror' | ||
| 9 | |||
| 10 | The original fix in fltk-native recipe does not work any more because '-ldl' | ||
| 11 | appears before lib/libfltk.a and causes dlopen() unresolved. The reason why it | ||
| 12 | doesn't fail on other hosts is that the functions dlopen(), dlerror() etc. have | ||
| 13 | been moved to libc.so since glibc 2.34 via the commits in glibc: | ||
| 14 | |||
| 15 | 0c1c3a771e dlfcn: Move dlopen into libc | ||
| 16 | add8d7ea01 dlfcn: Move dlvsym into libc | ||
| 17 | 6dfc0207eb dlfcn: Move dlinfo into libc | ||
| 18 | 492560a32e dlfcn: Move dladdr1 into libc | ||
| 19 | 6a1ed32789 dlfcn: Move dlmopen into libc | ||
| 20 | 77f876c0e3 dlfcn: Move dlsym into libc | ||
| 21 | 602252b553 dlfcn: Move dladdr into libc | ||
| 22 | d8cce17d2a dlfcn: Move dlclose into libc | ||
| 23 | |||
| 24 | Append 'dl' to fltk link items explictly to fix the error. | ||
| 25 | |||
| 26 | Signed-off-by: Kai Kang <kai.kang@windriver.com> | ||
| 27 | |||
| 28 | --- | ||
| 29 | src/CMakeLists.txt | 2 +- | ||
| 30 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 31 | |||
| 32 | diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt | ||
| 33 | index d153b1c..0fe5c11 100644 | ||
| 34 | --- a/src/CMakeLists.txt | ||
| 35 | +++ b/src/CMakeLists.txt | ||
| 36 | @@ -306,7 +306,7 @@ endif (USE_XFT) | ||
| 37 | ####################################################################### | ||
| 38 | |||
| 39 | FL_ADD_LIBRARY (fltk STATIC "${STATIC_FILES}") | ||
| 40 | -target_link_libraries (fltk ${OPTIONAL_LIBS}) | ||
| 41 | +target_link_libraries (fltk ${OPTIONAL_LIBS} dl) | ||
| 42 | |||
| 43 | ####################################################################### | ||
| 44 | |||
