0.18.0 + master: test_libbcc linking fails against LLVM linked with LTO
- Dominant language
- C
- Stars
- 22.7k
- Forks
- 4.1k
- Avg merge
- 10d 4h
- Merged PRs (30d)
- 3
Description
I'm not sure is it some missing symbol not marked in LLM 11.0.1 APi as public or it is something which could be tweaked in bcc.
Can you have look and provide some expertise?
```
[ 83%] Linking CXX executable test_libbcc
cd /home/tkloczko/rpmbuild/BUILD/bcc/x86_64-redhat-linux-gnu/tests/cc && /usr/bin/cmake -E cmake_link_script CMakeFiles/test_libbcc.dir/link.txt --verbose=1
[ 84%] Built target KFuncExample
[ 84%] Built target RecordMySQLQuery
[ 86%] Built target PyPerf
[ 86%] Built target UseExternalMap
[ 87%] Built target CPUDistribution
[ 88%] Built target FollyRequestContextSwitch
[ 89%] Built target SkLocalStorageIterator
[ 90%] Built target test_static
[ 91%] Built target LLCStat
[ 92%] Built target RandomRead
[ 93%] Built target TCPSendStack
/usr/bin/g++ -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -flto=auto -flto-partition=none -fdata-sections -ffunction-sections -Wall -Wno-unused-result -fPIC -O2 -g -DNDEBUG -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto=auto -flto-partition=none -fuse-linker-plugin -Wl,--gc-sections -rdynamic CMakeFiles/test_libbcc.dir/test_libbcc.cc.o CMakeFiles/test_libbcc.dir/test_c_api.cc.o CMakeFiles/test_libbcc.dir/test_array_table.cc.o CMakeFiles/test_libbcc.dir/test_bpf_table.cc.o CMakeFiles/test_libbcc.dir/test_cg_storage.cc.o CMakeFiles/test_libbcc.dir/test_hash_table.cc.o CMakeFiles/test_libbcc.dir/test_map_in_map.cc.o CMakeFiles/test_libbcc.dir/test_perf_event.cc.o CMakeFiles/test_libbcc.dir/test_pinned_table.cc.o CMakeFiles/test_libbcc.dir/test_prog_table.cc.o CMakeFiles/test_libbcc.dir/test_queuestack_table.cc.o CMakeFiles/test_libbcc.dir/test_shared_table.cc.o CMakeFiles/test_libbcc.dir/test_sk_storage.cc.o CMakeFiles/test_libbcc.dir/test_sock_table.cc.o CMakeFiles/test_libbcc.dir/test_usdt_args.cc.o CMakeFiles/test_libbcc.dir/test_usdt_probes.cc.o CMakeFiles/test_libbcc.dir/utils.cc.o CMakeFiles/test_libbcc.dir/test_parse_tracepoint.cc.o -o test_libbcc -L/home/tkloczko/rpmbuild/BUILD/bcc/x86_64-redhat-linux-gnu/src/cc -Wl,-rpath,/home/tkloczko/rpmbuild/BUILD/bcc/x86_64-redhat-linux-gnu/src/cc:/home/tkloczko/rpmbuild/BUILD/bcc/x86_64-redhat-linux-gnu/tests/cc -lbcc -ldl libusdt_test_lib.so
/usr/bin/ld: CMakeFiles/test_libbcc.dir/test_usdt_probes.cc.o (symbol from plugin): undefined reference to symbol '_ZZNSt8__detail18__to_chars_10_implIjEEvPcjT_E8__digits@@LLVM_11'
/usr/bin/ld: /usr/lib64/libLLVM-11.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [tests/cc/CMakeFiles/test_libbcc.dir/build.make:363: tests/cc/test_libbcc] Error 1
make[2]: Target 'tests/cc/CMakeFiles/test_libbcc.dir/build' not remade because of errors.
make[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/bcc/x86_64-redhat-linux-gnu'
make[1]: *** [CMakeFiles/Makefile2:1631: tests/cc/CMakeFiles/test_libbcc.dir/all] Error 2
make[1]: Target 'all' not remade because of errors.
make[1]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/bcc/x86_64-redhat-linux-gnu'
make: *** [Makefile:163: all] Error 2
make: Target 'default_target' not remade because of errors.
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the tests/cc/test_libbcc target and its test_usdt_probes.cc object, then reproduce the shown CMake link command using LLVM 11 and LTO. Trace why libLLVM-11 is reported as missing from the command line; done means test_libbcc links successfully under the affected configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, cpp
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100