aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-support/fltk/fltk/fltk-native-link-libdl.patch
blob: e140ce2166d8ae62f52836ba864163afd877b4f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Upstream-Status: Inappropriate [cross build specific]

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>

---
 src/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index d153b1c..0fe5c11 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -306,7 +306,7 @@ endif (USE_XFT)
 #######################################################################
 
 FL_ADD_LIBRARY (fltk STATIC "${STATIC_FILES}")
-target_link_libraries (fltk ${OPTIONAL_LIBS})
+target_link_libraries (fltk ${OPTIONAL_LIBS} dl)
 
 #######################################################################