Project

General

Profile

Actions

Bug #13919

closed

build failure due to bad distribution libraries with as-needed linked flag (liblttng-ust, Ubuntu 14.04)

Added by Robin Johnson over 8 years ago. Updated about 7 years ago.

Status:
Can't reproduce
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
% Done:

0%

Source:
Community (dev)
Tags:
Backport:
Regression:
No
Severity:
2 - major
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

Build failure coming up in my gitbuilder, traced to the distributions's liblttng-ust library missing some NEEDED entries in the ELF.

We use as-needed to compile, and this means that all external libraries we link in must have correct NEEDED entries for the libraries they need in turn.
In the case of Ubuntu 14.04, liblttng-ust is missing NEEDED entries for libdl. With non-verbose build, it manifests as the following:
...
CXXLD ceph_test_objectcacher_stress
CXXLD ceph_test_get_blkdev_size
CCLD ceph_scratchtool
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/liblttng-ust.so: undefined reference to `dlopen'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/liblttng-ust.so: undefined reference to `dlclose'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/liblttng-ust.so: undefined reference to `dlsym'
collect2: error: ld returned 1 exit status
make3: *** [ceph_tpbench] Error 1

$ dpkg -S /usr/lib/x86_64-linux-gnu/liblttng-ust.so.0.0.0
liblttng-ust0:amd64: /usr/lib/x86_64-linux-gnu/liblttng-ust.so.0.0.0
$ dpkg --list liblttng-ust0
... version is 2.4.0-4ubuntu1

$ readelf -d /usr/lib/x86_64-linux-gnu/liblttng-ust.so.0.0.0

Dynamic section at offset 0x44d20 contains 31 entries:
Tag Type Name/Value
0x0000000000000001 (NEEDED) Shared library: [liblttng-ust-tracepoint.so.0]
0x0000000000000001 (NEEDED) Shared library: [librt.so.1]
0x0000000000000001 (NEEDED) Shared library: [liburcu-bp.so.1]
0x0000000000000001 (NEEDED) Shared library: [liburcu-cds.so.1]
0x0000000000000001 (NEEDED) Shared library: [libpthread.so.0]
0x0000000000000001 (NEEDED) Shared library: [libc.so.6]
0x0000000000000001 (NEEDED) Shared library: [ld-linux-x86-64.so.2]
0x000000000000000e (SONAME) Library soname: [liblttng-ust.so.0]
...

Notice that libdl.so is not present.

Adding V=1 to the make invocation:
libtool: link: ccache g++ -Wall -Wtype-limits -Wignored-qualifiers -Winit-self -Wpointer-arith -Werror=format-security -fno-strict-aliasing -fsigned-char -rdynamic -ftemplate-depth-1024 -Wnon-virtual-dtor -Wno-invalid-offsetof -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 -fPIE -fstack-protector -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -Wstrict-null-sentinel -g -O2 -std=gnu++11 -Wl,--as-needed -pie -Wl,-z -Wl,relro -Wl,-z -Wl,now -o .libs/ceph_tpbench test/bench/tp_bench.o test/bench/detailed_stat_collector.o /usr/lib/libatomic_ops.a ./.libs/librados.so -lboost_program_options ./.libs/libos.a -laio ./.libs/libos_rocksdb.a -lz -lbz2 -lleveldb -lsnappy ./.libs/libglobal.a -llttng-ust ./.libs/libcommon.a -ldl -lboost_thread -lboost_random -lblkid -lpthread -lcrypto++ -lm -lrt -lboost_system
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/liblttng-ust.so: undefined reference to `dlopen'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/liblttng-ust.so: undefined reference to `dlclose'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/liblttng-ust.so: undefined reference to `dlsym'
collect2: error: ld returned 1 exit status
make3: *** [ceph_tpbench] Error 1

You can see that -ldl is passed in, but due to as-needed, it is ignored for linking lttng-ust.

The only reasonable course of action for building successfully in this case is to disable lttng or the as-needed flag, and at the same time, chase upstream Ubuntu to fix their build.

Actions #1

Updated by Alfredo Deza over 8 years ago

  • Project changed from teuthology to Ceph
  • Category deleted (Core)
Actions #2

Updated by Sage Weil about 7 years ago

  • Status changed from New to Can't reproduce
Actions

Also available in: Atom PDF