summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Kang <kai.kang@windriver.com>2023-07-12 13:53:50 +0800
committerKhem Raj <raj.khem@gmail.com>2023-07-13 07:22:17 -0700
commite3606c223e8195dc57a41c64ca670958f1809d6f (patch)
treeaa1ba8f6d4d24d4c45e70c16f7851ed8a4c298c2
parentb4bdb5849e9e550cce50ff2f5e330d9ee93cb648 (diff)
downloadmeta-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.bb5
-rw-r--r--meta-oe/recipes-support/fltk/fltk/fltk-native-link-libdl.patch44
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
3DEPENDS = "zlib-native jpeg-native libpng-native libxext-native libxft-native" 3DEPENDS = "zlib-native jpeg-native libpng-native libxext-native libxft-native"
4 4
5SRC_URI += "file://fltk-native-link-libdl.patch"
6
5inherit native 7inherit native
6 8
7EXTRA_OECMAKE += " \ 9EXTRA_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'
19LDFLAGS += "-ldl"
20
21do_install:append() { 20do_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 @@
1Upstream-Status: Inappropriate [cross build specific]
2
3It 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
10The original fix in fltk-native recipe does not work any more because '-ldl'
11appears before lib/libfltk.a and causes dlopen() unresolved. The reason why it
12doesn't fail on other hosts is that the functions dlopen(), dlerror() etc. have
13been moved to libc.so since glibc 2.34 via the commits in glibc:
14
150c1c3a771e dlfcn: Move dlopen into libc
16add8d7ea01 dlfcn: Move dlvsym into libc
176dfc0207eb dlfcn: Move dlinfo into libc
18492560a32e dlfcn: Move dladdr1 into libc
196a1ed32789 dlfcn: Move dlmopen into libc
2077f876c0e3 dlfcn: Move dlsym into libc
21602252b553 dlfcn: Move dladdr into libc
22d8cce17d2a dlfcn: Move dlclose into libc
23
24Append 'dl' to fltk link items explictly to fix the error.
25
26Signed-off-by: Kai Kang <kai.kang@windriver.com>
27
28---
29 src/CMakeLists.txt | 2 +-
30 1 file changed, 1 insertion(+), 1 deletion(-)
31
32diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
33index 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