Symbol Resolution Errors in Dynamic Library Build Using CEF Dependency
Closed this issue · 5 comments
Describe the bug
I created a lib that uses CEF as a dependency (via binary), which will be used to create rust bindings. So in order to achieve that, our lib has to be dynamic (which is causing problems) and not static as used in cef-project examples (e.g. minimal). When I build my lib as static, all my test demos work, however when running as dynamic, I get symbol errors from libcef.so (localtime, localtime64, localtime_r, localtime64_r) and consequently, my demos don`t work as expected.
To Reproduce
Steps to reproduce the behavior:
In CMakeLists.txt I defined my lib:
add_library(${SHARED_TARGET} SHARED ${cef_buffer_lib_source_files})
add_dependencies(${SHARED_TARGET} libcef_dll_wrapper)
target_link_libraries(${SHARED_TARGET} libcef_lib ${LIBCEF_DLL_WRAPPER} ${CEF_STANDARD_LIBS})```
My demos use only this lib (libcef_buffer_lib.so). When running the command ```ldd ./cef_demo``` I get the following dependencies:
```linux-vdso.so.1 (0x00007ffc6279e000)
libcef_buffer_lib.so => /workspaces/cef-lib/build/Debug/Debug/libcef_buffer_lib.so (0x000070997ed1f000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x000070997eaeb000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x000070997eacb000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x000070997e8a2000)
libcef.so => /workspaces/cef-lib/build/Debug/Debug/libcef.so (0x0000709971200000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x0000709971119000)
/lib64/ld-linux-x86-64.so.2 (0x000070997ee60000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x000070997e89b000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x000070997e896000)
libgobject-2.0.so.0 => /lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x000070997e836000)
libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x0000709970fdf000)
libnss3.so => /lib/x86_64-linux-gnu/libnss3.so (0x0000709970eae000)
libnssutil3.so => /lib/x86_64-linux-gnu/libnssutil3.so (0x0000709970e7b000)
libsmime3.so => /lib/x86_64-linux-gnu/libsmime3.so (0x000070997e80a000)
libnspr4.so => /lib/x86_64-linux-gnu/libnspr4.so (0x0000709970e3b000)
libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x0000709970ded000)
libatk-1.0.so.0 => /lib/x86_64-linux-gnu/libatk-1.0.so.0 (0x0000709970dc3000)
libatk-bridge-2.0.so.0 => /lib/x86_64-linux-gnu/libatk-bridge-2.0.so.0 (0x0000709970d8b000)
libcups.so.2 => /lib/x86_64-linux-gnu/libcups.so.2 (0x0000709970ceb000)
libdrm.so.2 => /lib/x86_64-linux-gnu/libdrm.so.2 (0x0000709970cd5000)
libgio-2.0.so.0 => /lib/x86_64-linux-gnu/libgio-2.0.so.0 (0x0000709970afb000)
libX11.so.6 => /lib/x86_64-linux-gnu/libX11.so.6 (0x00007099709bb000)
libXcomposite.so.1 => /lib/x86_64-linux-gnu/libXcomposite.so.1 (0x00007099709b6000)
libXdamage.so.1 => /lib/x86_64-linux-gnu/libXdamage.so.1 (0x00007099709b1000)
libXext.so.6 => /lib/x86_64-linux-gnu/libXext.so.6 (0x000070997099a000)
libXfixes.so.3 => /lib/x86_64-linux-gnu/libXfixes.so.3 (0x0000709970992000)
libXrandr.so.2 => /lib/x86_64-linux-gnu/libXrandr.so.2 (0x0000709970985000)
libgbm.so.1 => /lib/x86_64-linux-gnu/libgbm.so.1 (0x0000709970974000)
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x0000709970943000)
libxcb.so.1 => /lib/x86_64-linux-gnu/libxcb.so.1 (0x0000709970919000)
libxkbcommon.so.0 => /lib/x86_64-linux-gnu/libxkbcommon.so.0 (0x00007099708d0000)
libpango-1.0.so.0 => /lib/x86_64-linux-gnu/libpango-1.0.so.0 (0x0000709970869000)
libcairo.so.2 => /lib/x86_64-linux-gnu/libcairo.so.2 (0x0000709970741000)
libudev.so.1 => /lib/x86_64-linux-gnu/libudev.so.1 (0x0000709970717000)
libasound.so.2 => /lib/x86_64-linux-gnu/libasound.so.2 (0x0000709970614000)
libatspi.so.0 => /lib/x86_64-linux-gnu/libatspi.so.0 (0x00007099705da000)
libffi.so.8 => /lib/x86_64-linux-gnu/libffi.so.8 (0x00007099705cb000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x0000709970555000)
libplc4.so => /lib/x86_64-linux-gnu/libplc4.so (0x000070997054e000)
libplds4.so => /lib/x86_64-linux-gnu/libplds4.so (0x0000709970549000)
libsystemd.so.0 => /lib/x86_64-linux-gnu/libsystemd.so.0 (0x0000709970482000)
libgssapi_krb5.so.2 => /lib/x86_64-linux-gnu/libgssapi_krb5.so.2 (0x000070997042c000)
libavahi-common.so.3 => /lib/x86_64-linux-gnu/libavahi-common.so.3 (0x000070997041e000)
libavahi-client.so.3 => /lib/x86_64-linux-gnu/libavahi-client.so.3 (0x000070997040a000)
libgnutls.so.30 => /lib/x86_64-linux-gnu/libgnutls.so.30 (0x000070997021f000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x0000709970203000)
libgmodule-2.0.so.0 => /lib/x86_64-linux-gnu/libgmodule-2.0.so.0 (0x00007099701fc000)
libmount.so.1 => /lib/x86_64-linux-gnu/libmount.so.1 (0x00007099701b6000)
libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x000070997018a000)
libXrender.so.1 => /lib/x86_64-linux-gnu/libXrender.so.1 (0x000070997017d000)
libwayland-server.so.0 => /lib/x86_64-linux-gnu/libwayland-server.so.0 (0x0000709970167000)
libxcb-randr.so.0 => /lib/x86_64-linux-gnu/libxcb-randr.so.0 (0x0000709970154000)
libXau.so.6 => /lib/x86_64-linux-gnu/libXau.so.6 (0x000070997014c000)
libXdmcp.so.6 => /lib/x86_64-linux-gnu/libXdmcp.so.6 (0x0000709970144000)
libfribidi.so.0 => /lib/x86_64-linux-gnu/libfribidi.so.0 (0x0000709970128000)
libthai.so.0 => /lib/x86_64-linux-gnu/libthai.so.0 (0x000070997011d000)
libharfbuzz.so.0 => /lib/x86_64-linux-gnu/libharfbuzz.so.0 (0x000070997004e000)
libpixman-1.so.0 => /lib/x86_64-linux-gnu/libpixman-1.so.0 (0x000070996ffa3000)
libfontconfig.so.1 => /lib/x86_64-linux-gnu/libfontconfig.so.1 (0x000070996ff57000)
libfreetype.so.6 => /lib/x86_64-linux-gnu/libfreetype.so.6 (0x000070996fe8f000)
libpng16.so.16 => /lib/x86_64-linux-gnu/libpng16.so.16 (0x000070996fe54000)
libxcb-shm.so.0 => /lib/x86_64-linux-gnu/libxcb-shm.so.0 (0x000070996fe4f000)
libxcb-render.so.0 => /lib/x86_64-linux-gnu/libxcb-render.so.0 (0x000070996fe40000)
libXi.so.6 => /lib/x86_64-linux-gnu/libXi.so.6 (0x000070996fe2a000)
liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x000070996fdff000)
libzstd.so.1 => /lib/x86_64-linux-gnu/libzstd.so.1 (0x000070996fd30000)
liblz4.so.1 => /lib/x86_64-linux-gnu/liblz4.so.1 (0x000070996fd10000)
libcap.so.2 => /lib/x86_64-linux-gnu/libcap.so.2 (0x000070996fd05000)
libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x000070996fbc7000)
libkrb5.so.3 => /lib/x86_64-linux-gnu/libkrb5.so.3 (0x000070996fafa000)
libk5crypto.so.3 => /lib/x86_64-linux-gnu/libk5crypto.so.3 (0x000070996facb000)
libcom_err.so.2 => /lib/x86_64-linux-gnu/libcom_err.so.2 (0x000070996fac5000)
libkrb5support.so.0 => /lib/x86_64-linux-gnu/libkrb5support.so.0 (0x000070996fab7000)
libp11-kit.so.0 => /lib/x86_64-linux-gnu/libp11-kit.so.0 (0x000070996f97c000)
libidn2.so.0 => /lib/x86_64-linux-gnu/libidn2.so.0 (0x000070996f95b000)
libunistring.so.2 => /lib/x86_64-linux-gnu/libunistring.so.2 (0x000070996f7af000)
libtasn1.so.6 => /lib/x86_64-linux-gnu/libtasn1.so.6 (0x000070996f797000)
libnettle.so.8 => /lib/x86_64-linux-gnu/libnettle.so.8 (0x000070996f751000)
libhogweed.so.6 => /lib/x86_64-linux-gnu/libhogweed.so.6 (0x000070996f709000)
libgmp.so.10 => /lib/x86_64-linux-gnu/libgmp.so.10 (0x000070996f687000)
libblkid.so.1 => /lib/x86_64-linux-gnu/libblkid.so.1 (0x000070996f650000)
libpcre2-8.so.0 => /lib/x86_64-linux-gnu/libpcre2-8.so.0 (0x000070996f5b7000)
libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x000070996f59f000)
libdatrie.so.1 => /lib/x86_64-linux-gnu/libdatrie.so.1 (0x000070996f596000)
libgraphite2.so.3 => /lib/x86_64-linux-gnu/libgraphite2.so.3 (0x000070996f56f000)
libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x000070996f566000)
libbrotlidec.so.1 => /lib/x86_64-linux-gnu/libbrotlidec.so.1 (0x000070996f556000)
libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x000070996f530000)
libkeyutils.so.1 => /lib/x86_64-linux-gnu/libkeyutils.so.1 (0x000070996f529000)
libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x000070996f515000)
libmd.so.0 => /lib/x86_64-linux-gnu/libmd.so.0 (0x000070996f508000)
libbrotlicommon.so.1 => /lib/x86_64-linux-gnu/libbrotlicommon.so.1 (0x000070996f4e3000)```
On another hand, when running ```LD_DEBUG=libs ./cef_demo``` I get the following symbol errors:
``` 66798: /workspaces/cef-lib/build/Debug/Debug/libcef.so: error: symbol lookup error: undefined symbol: localtime (fatal)
66798: /workspaces/cef-lib/build/Debug/Debug/libcef.so: error: symbol lookup error: undefined symbol: localtime64 (fatal)
66798: /workspaces/cef-lib/build/Debug/Debug/libcef.so: error: symbol lookup error: undefined symbol: localtime_r (fatal)
66798: /workspaces/cef-lib/build/Debug/Debug/libcef.so: error: symbol lookup error: undefined symbol: localtime64_r (fatal)```
Either libs (when built as static or shared) have the same lib`s dependency paths.
**Expected behavior**
libcef.so can be dynamically loaded into my demos.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Versions (please complete the following information):**
- OS: [Ubuntu 24.04.1]
- CEF Version: [130.1.16]
**Additional context**
Add any other context about the problem here.
when running as dynamic, I get symbol errors from libcef.so (localtime, localtime64, localtime_r, localtime64_r)
These functions are part of the Standard C library (libc). What does ldd show for libcef.so?
This is its output (ldd ./libcef.so):
linux-vdso.so.1 (0x00007ffef855c000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ced8b709000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ced8b704000)
libgobject-2.0.so.0 => /lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007ced8b6a4000)
libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007ced7dec6000)
libnss3.so => /lib/x86_64-linux-gnu/libnss3.so (0x00007ced7dd95000)
libnssutil3.so => /lib/x86_64-linux-gnu/libnssutil3.so (0x00007ced8b66f000)
libsmime3.so => /lib/x86_64-linux-gnu/libsmime3.so (0x00007ced8b645000)
libnspr4.so => /lib/x86_64-linux-gnu/libnspr4.so (0x00007ced7dd55000)
libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007ced7dd07000)
libatk-1.0.so.0 => /lib/x86_64-linux-gnu/libatk-1.0.so.0 (0x00007ced8b61b000)
libatk-bridge-2.0.so.0 => /lib/x86_64-linux-gnu/libatk-bridge-2.0.so.0 (0x00007ced7dccf000)
libcups.so.2 => /lib/x86_64-linux-gnu/libcups.so.2 (0x00007ced7dc31000)
libdrm.so.2 => /lib/x86_64-linux-gnu/libdrm.so.2 (0x00007ced7dc1b000)
libgio-2.0.so.0 => /lib/x86_64-linux-gnu/libgio-2.0.so.0 (0x00007ced7da41000)
libX11.so.6 => /lib/x86_64-linux-gnu/libX11.so.6 (0x00007ced7d901000)
libXcomposite.so.1 => /lib/x86_64-linux-gnu/libXcomposite.so.1 (0x00007ced8b614000)
libXdamage.so.1 => /lib/x86_64-linux-gnu/libXdamage.so.1 (0x00007ced8b60f000)
libXext.so.6 => /lib/x86_64-linux-gnu/libXext.so.6 (0x00007ced7d8ec000)
libXfixes.so.3 => /lib/x86_64-linux-gnu/libXfixes.so.3 (0x00007ced7d8e4000)
libXrandr.so.2 => /lib/x86_64-linux-gnu/libXrandr.so.2 (0x00007ced7d8d7000)
libgbm.so.1 => /lib/x86_64-linux-gnu/libgbm.so.1 (0x00007ced7d8c6000)
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007ced7d895000)
libxcb.so.1 => /lib/x86_64-linux-gnu/libxcb.so.1 (0x00007ced7d86b000)
libxkbcommon.so.0 => /lib/x86_64-linux-gnu/libxkbcommon.so.0 (0x00007ced7d824000)
libpango-1.0.so.0 => /lib/x86_64-linux-gnu/libpango-1.0.so.0 (0x00007ced7d7bd000)
libcairo.so.2 => /lib/x86_64-linux-gnu/libcairo.so.2 (0x00007ced7d695000)
libudev.so.1 => /lib/x86_64-linux-gnu/libudev.so.1 (0x00007ced7d66b000)
libasound.so.2 => /lib/x86_64-linux-gnu/libasound.so.2 (0x00007ced7d568000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007ced7d481000)
libatspi.so.0 => /lib/x86_64-linux-gnu/libatspi.so.0 (0x00007ced7d445000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007ced7d425000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ced7d1fc000)
/lib64/ld-linux-x86-64.so.2 (0x00007ced8b718000)
libffi.so.8 => /lib/x86_64-linux-gnu/libffi.so.8 (0x00007ced7d1ef000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007ced7d179000)
libplc4.so => /lib/x86_64-linux-gnu/libplc4.so (0x00007ced7d172000)
libplds4.so => /lib/x86_64-linux-gnu/libplds4.so (0x00007ced7d16b000)
libsystemd.so.0 => /lib/x86_64-linux-gnu/libsystemd.so.0 (0x00007ced7d0a4000)
libgssapi_krb5.so.2 => /lib/x86_64-linux-gnu/libgssapi_krb5.so.2 (0x00007ced7d050000)
libavahi-common.so.3 => /lib/x86_64-linux-gnu/libavahi-common.so.3 (0x00007ced7d042000)
libavahi-client.so.3 => /lib/x86_64-linux-gnu/libavahi-client.so.3 (0x00007ced7d02e000)
libgnutls.so.30 => /lib/x86_64-linux-gnu/libgnutls.so.30 (0x00007ced7ce41000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007ced7ce25000)
libgmodule-2.0.so.0 => /lib/x86_64-linux-gnu/libgmodule-2.0.so.0 (0x00007ced7ce1e000)
libmount.so.1 => /lib/x86_64-linux-gnu/libmount.so.1 (0x00007ced7cdda000)
libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007ced7cdae000)
libXrender.so.1 => /lib/x86_64-linux-gnu/libXrender.so.1 (0x00007ced7cd9f000)
libwayland-server.so.0 => /lib/x86_64-linux-gnu/libwayland-server.so.0 (0x00007ced7cd89000)
libxcb-randr.so.0 => /lib/x86_64-linux-gnu/libxcb-randr.so.0 (0x00007ced7cd76000)
libXau.so.6 => /lib/x86_64-linux-gnu/libXau.so.6 (0x00007ced7cd70000)
libXdmcp.so.6 => /lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007ced7cd68000)
libfribidi.so.0 => /lib/x86_64-linux-gnu/libfribidi.so.0 (0x00007ced7cd4a000)
libthai.so.0 => /lib/x86_64-linux-gnu/libthai.so.0 (0x00007ced7cd3f000)
libharfbuzz.so.0 => /lib/x86_64-linux-gnu/libharfbuzz.so.0 (0x00007ced7cc70000)
libpixman-1.so.0 => /lib/x86_64-linux-gnu/libpixman-1.so.0 (0x00007ced7cbc5000)
libfontconfig.so.1 => /lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007ced7cb7b000)
libfreetype.so.6 => /lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007ced7cab3000)
libpng16.so.16 => /lib/x86_64-linux-gnu/libpng16.so.16 (0x00007ced7ca78000)
libxcb-shm.so.0 => /lib/x86_64-linux-gnu/libxcb-shm.so.0 (0x00007ced7ca71000)
libxcb-render.so.0 => /lib/x86_64-linux-gnu/libxcb-render.so.0 (0x00007ced7ca62000)
libXi.so.6 => /lib/x86_64-linux-gnu/libXi.so.6 (0x00007ced7ca4e000)
liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007ced7ca23000)
libzstd.so.1 => /lib/x86_64-linux-gnu/libzstd.so.1 (0x00007ced7c954000)
liblz4.so.1 => /lib/x86_64-linux-gnu/liblz4.so.1 (0x00007ced7c932000)
libcap.so.2 => /lib/x86_64-linux-gnu/libcap.so.2 (0x00007ced7c927000)
libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007ced7c7e9000)
libkrb5.so.3 => /lib/x86_64-linux-gnu/libkrb5.so.3 (0x00007ced7c71e000)
libk5crypto.so.3 => /lib/x86_64-linux-gnu/libk5crypto.so.3 (0x00007ced7c6ef000)
libcom_err.so.2 => /lib/x86_64-linux-gnu/libcom_err.so.2 (0x00007ced7c6e9000)
libkrb5support.so.0 => /lib/x86_64-linux-gnu/libkrb5support.so.0 (0x00007ced7c6d9000)
libp11-kit.so.0 => /lib/x86_64-linux-gnu/libp11-kit.so.0 (0x00007ced7c59e000)
libidn2.so.0 => /lib/x86_64-linux-gnu/libidn2.so.0 (0x00007ced7c57d000)
libunistring.so.2 => /lib/x86_64-linux-gnu/libunistring.so.2 (0x00007ced7c3d3000)
libtasn1.so.6 => /lib/x86_64-linux-gnu/libtasn1.so.6 (0x00007ced7c3bb000)
libnettle.so.8 => /lib/x86_64-linux-gnu/libnettle.so.8 (0x00007ced7c375000)
libhogweed.so.6 => /lib/x86_64-linux-gnu/libhogweed.so.6 (0x00007ced7c32b000)
libgmp.so.10 => /lib/x86_64-linux-gnu/libgmp.so.10 (0x00007ced7c2a9000)
libblkid.so.1 => /lib/x86_64-linux-gnu/libblkid.so.1 (0x00007ced7c272000)
libpcre2-8.so.0 => /lib/x86_64-linux-gnu/libpcre2-8.so.0 (0x00007ced7c1db000)
libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007ced7c1c3000)
libdatrie.so.1 => /lib/x86_64-linux-gnu/libdatrie.so.1 (0x00007ced7c1b8000)
libgraphite2.so.3 => /lib/x86_64-linux-gnu/libgraphite2.so.3 (0x00007ced7c191000)
libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007ced7c188000)
libbrotlidec.so.1 => /lib/x86_64-linux-gnu/libbrotlidec.so.1 (0x00007ced7c17a000)
libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007ced7c154000)
libkeyutils.so.1 => /lib/x86_64-linux-gnu/libkeyutils.so.1 (0x00007ced7c14b000)
libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007ced7c137000)
libmd.so.0 => /lib/x86_64-linux-gnu/libmd.so.0 (0x00007ced7c12a000)
libbrotlicommon.so.1 => /lib/x86_64-linux-gnu/libbrotlicommon.so.1 (0x00007ced7c107000)
So, both your cef_demo and libcef.so load the same version of libc. What version of libc is your main application loading?
This one: ldd (Ubuntu GLIBC 2.35-0ubuntu3.1) 2.35
I don't see that this is a CEF issue. The libcef.so correctly links libc which should provide the specified symbols. I don't know why your application is having difficulty loading them but I suspect it's something to do with your main application's LD environment.