Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two libraries build with undefined symbols in Fedora #2113

Closed
kpvdr opened this issue Apr 21, 2023 · 1 comment · Fixed by #2128
Closed

Two libraries build with undefined symbols in Fedora #2113

kpvdr opened this issue Apr 21, 2023 · 1 comment · Fixed by #2128
Labels
bug Something isn't working

Comments

@kpvdr
Copy link

kpvdr commented Apr 21, 2023

Describe your environment
Building RPMs for Fedora on f36, f37, f38, rawhide. The build itself proceeds without error, but when checking the installed libs using ldd, the undefined symbol error is reported. The rpmlint checker also reports this error as undefined-non-weak-symbol error.

Steps to reproduce

  1. Build rpm using rpm build tools.
  2. Install the rpms.
  3. Test the installed libs using either:
$ rpmlint -i opentelemetry-cpp

or directly with:

$ ldd -r -d /usr/lib64/libopentelemetry*.so

What is the expected behavior?
No errors reported.

What is the actual behavior?
What did you see instead?

$ rpmlint -i opentelemetry-cpp
========== rpmlint session starts ==========
rpmlint: 2.4.0
configuration:
    /usr/lib/python3.11/site-packages/rpmlint/configdefaults.toml
    /etc/xdg/rpmlint/fedora-legacy-licenses.toml
    /etc/xdg/rpmlint/fedora-spdx-licenses.toml
    /etc/xdg/rpmlint/fedora.toml
    /etc/xdg/rpmlint/scoring.toml
    /etc/xdg/rpmlint/users-groups.toml
    /etc/xdg/rpmlint/warn-on-functions.toml
checks: 31, packages: 1

opentelemetry-cpp.x86_64: E: undefined-non-weak-symbol /usr/lib64/libopentelemetry_exporter_ostream_metrics.so.1.9.0 _ZNK13opentelemetry2v13sdk8resource8Resource13GetAttributesEv	(/usr/lib64/libopentelemetry_exporter_ostream_metrics.so.1.9.0)
opentelemetry-cpp.x86_64: E: undefined-non-weak-symbol /usr/lib64/libopentelemetry_http_client_curl.so.1.9.0 _ZN13opentelemetry2v13sdk6common12internal_log16GlobalLogHandler18GetHandlerAndLevelEv	(/usr/lib64/libopentelemetry_http_client_curl.so.1.9.0)
========== 1 packages and 0 specfiles checked; 2 errors, 0 warnings, 2 badness; has taken 0.5 s ==========

and

$ ldd -d -r /usr/lib64/libopentelemetry*.so
<abbreviated to libs with errors only>
/usr/lib64/libopentelemetry_exporter_ostream_metrics.so:
	linux-vdso.so.1 (0x00007fffa65b5000)
	libopentelemetry_common.so.1 => /lib64/libopentelemetry_common.so.1 (0x00007f1154e18000)
	libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f1154a00000)
	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f1154df8000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f1154823000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f1154e48000)
	libm.so.6 => /lib64/libm.so.6 (0x00007f1154d18000)
undefined symbol: _ZNK13opentelemetry2v13sdk8resource8Resource13GetAttributesEv	(/usr/lib64/libopentelemetry_exporter_ostream_metrics.so)
...
/usr/lib64/libopentelemetry_http_client_curl.so:
	linux-vdso.so.1 (0x00007fff440d4000)
	libcurl.so.4 => /lib64/libcurl.so.4 (0x00007fd16821e000)
	libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007fd167e00000)
	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fd1681fe000)
	libc.so.6 => /lib64/libc.so.6 (0x00007fd167c23000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fd1682fd000)
	libnghttp2.so.14 => /lib64/libnghttp2.so.14 (0x00007fd1681d3000)
	libidn2.so.0 => /lib64/libidn2.so.0 (0x00007fd168186000)
	libssh.so.4 => /lib64/libssh.so.4 (0x00007fd168112000)
	libpsl.so.5 => /lib64/libpsl.so.5 (0x00007fd1680fe000)
	libssl.so.3 => /lib64/libssl.so.3 (0x00007fd16805b000)
	libcrypto.so.3 => /lib64/libcrypto.so.3 (0x00007fd167600000)
	libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x00007fd167bcc000)
	libldap.so.2 => /lib64/libldap.so.2 (0x00007fd167b66000)
	liblber.so.2 => /lib64/liblber.so.2 (0x00007fd168047000)
	libbrotlidec.so.1 => /lib64/libbrotlidec.so.1 (0x00007fd16803a000)
	libz.so.1 => /lib64/libz.so.1 (0x00007fd167b4c000)
	libm.so.6 => /lib64/libm.so.6 (0x00007fd167a6c000)
	libunistring.so.2 => /lib64/libunistring.so.2 (0x00007fd167448000)
	libkrb5.so.3 => /lib64/libkrb5.so.3 (0x00007fd16736b000)
	libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x00007fd167a53000)
	libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00007fd167a4c000)
	libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x00007fd167a3b000)
	libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007fd167a34000)
	libresolv.so.2 => /lib64/libresolv.so.2 (0x00007fd167358000)
	libevent-2.1.so.7 => /lib64/libevent-2.1.so.7 (0x00007fd1672ff000)
	libsasl2.so.3 => /lib64/libsasl2.so.3 (0x00007fd1672df000)
	libbrotlicommon.so.1 => /lib64/libbrotlicommon.so.1 (0x00007fd1672bc000)
	libselinux.so.1 => /lib64/libselinux.so.1 (0x00007fd16728f000)
	libcrypt.so.2 => /lib64/libcrypt.so.2 (0x00007fd167255000)
	libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 (0x00007fd1671b8000)
undefined symbol: _ZN13opentelemetry2v13sdk6common12internal_log16GlobalLogHandler18GetHandlerAndLevelEv	(/usr/lib64/libopentelemetry_http_client_curl.so)

The undefined symbols resolve to:

$ c++filt _ZN13opentelemetry2v13sdk6common12internal_log16GlobalLogHandler18GetHandlerAndLevelEv
opentelemetry::v1::sdk::common::internal_log::GlobalLogHandler::GetHandlerAndLevel()

which is found in opentelemetry_common.

$ c++filt _ZNK13opentelemetry2v13sdk8resource8Resource13GetAttributesEv
opentelemetry::v1::sdk::resource::Resource::GetAttributes() const

which is found in opentelemetry_resources.

Additional context
The build for Fedora also requires that the version number be included into the naming of the libs, along with links. To achieve this, the attached patch file mostly contains cmake VERSION and SOVERSION declarations for each set_target_properties declaration.

  • The full build log and artifacts can be examined in the opentelemetry-cpp-1.9.0-1 build on Copr.
  • The rpm spec file file used for this build.
  • The error can be seen in the review.log - look for "Rpmlint (installed packages)"

Proposed fix
By adding the missing libraries to the target_link_libraries declaration in the appropriate CMakeLists.txt files, the problem is solved.

For opentelemetry_exporter_ostream_metrics.so, add opentelemetry_resources to the target_link_libraries declaration.
For opentelemetry_http_client_curl.so, add opentelemetry_common to the target_link_libraries declaration.

The full build log and artifacts of the corrected build can be examined in the opentelemetry-cpp-1.9.0-2 build on Copr.
The patch file used and which contains the corrected CMakeLists.txt files:
opentelemetry-cpp-1.9.0.patch.tar.gz

@kpvdr kpvdr added the bug Something isn't working label Apr 21, 2023
@lalitb
Copy link
Member

lalitb commented May 3, 2023

Thanks for raising the issues with relevant details.

The build for Fedora also requires that the version number be included into the naming of the libs, along with links.

#2100 fixes this

The rpmlint checker also reports this error as undefined-non-weak-symbol error.

#2128 fixes this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants