tud-zih-energy / lo2s

Linux OTF2 Sampling - A Lightweight Node-Level Performance Monitoring Tool
https://tu-dresden.de/zih/forschung/projekte/lo2s?set_language=en
GNU General Public License v3.0
45 stars 13 forks source link

Build fails due to undefined references to libsframe and libzstd #248

Closed cvonelm closed 1 year ago

cvonelm commented 1 year ago

It appears that libbfd started to require libsframe and libzstd:

[ 21%] Linking CXX executable lo2s
/usr/bin/ld: /usr/lib/libbfd.a(elfxx-x86.o): in function `_bfd_x86_elf_write_sframe_plt.isra.0':
(.text+0xeaa): undefined reference to `sframe_encoder_write'
/usr/bin/ld: (.text+0xee2): undefined reference to `sframe_encoder_free'
/usr/bin/ld: /usr/lib/libbfd.a(elfxx-x86.o): in function `_bfd_x86_elf_create_sframe_plt.isra.0':
(.text+0xfe7): undefined reference to `sframe_encode'
/usr/bin/ld: (.text+0xff8): undefined reference to `sframe_calc_fre_type'
/usr/bin/ld: (.text+0x1004): undefined reference to `sframe_fde_create_func_info'
/usr/bin/ld: (.text+0x1019): undefined reference to `sframe_encoder_add_funcdesc'
/usr/bin/ld: (.text+0x1067): undefined reference to `sframe_encoder_add_fre'
/usr/bin/ld: (.text+0x10cf): undefined reference to `sframe_encode'
/usr/bin/ld: (.text+0x10e0): undefined reference to `sframe_calc_fre_type'
/usr/bin/ld: (.text+0x10ec): undefined reference to `sframe_fde_create_func_info'
/usr/bin/ld: (.text+0x1158): undefined reference to `sframe_encode'
/usr/bin/ld: (.text+0x1169): undefined reference to `sframe_calc_fre_type'
/usr/bin/ld: (.text+0x1175): undefined reference to `sframe_fde_create_func_info'
/usr/bin/ld: (.text+0x1194): undefined reference to `sframe_fde_create_func_info'
/usr/bin/ld: (.text+0x11ae): undefined reference to `sframe_encoder_add_funcdesc'
/usr/bin/ld: (.text+0x11f6): undefined reference to `sframe_encoder_add_fre'
/usr/bin/ld: (.text+0x124f): undefined reference to `sframe_encode'
/usr/bin/ld: /usr/lib/libbfd.a(elf-sframe.o): in function `_bfd_elf_parse_sframe':
(.text+0x13d): undefined reference to `sframe_decode'
/usr/bin/ld: (.text+0x157): undefined reference to `sframe_decoder_get_num_fidx'
/usr/bin/ld: (.text+0x287): undefined reference to `sframe_decoder_free'
/usr/bin/ld: /usr/lib/libbfd.a(elf-sframe.o): in function `_bfd_elf_discard_section_sframe':
(.text+0x2ec): undefined reference to `sframe_decoder_get_num_fidx'
/usr/bin/ld: /usr/lib/libbfd.a(elf-sframe.o): in function `_bfd_elf_merge_section_sframe':
(.text+0x757): undefined reference to `sframe_decoder_get_abi_arch'
/usr/bin/ld: (.text+0x762): undefined reference to `sframe_encoder_get_abi_arch'
/usr/bin/ld: (.text+0x778): undefined reference to `sframe_decoder_get_num_fidx'
/usr/bin/ld: (.text+0x787): undefined reference to `sframe_encoder_get_num_fidx'
/usr/bin/ld: (.text+0x818): undefined reference to `sframe_decoder_get_funcdesc'
/usr/bin/ld: (.text+0x869): undefined reference to `sframe_decoder_get_hdr_size'
/usr/bin/ld: (.text+0x8f2): undefined reference to `sframe_encoder_add_funcdesc'
/usr/bin/ld: (.text+0x92d): undefined reference to `sframe_decoder_get_fre'
/usr/bin/ld: (.text+0x945): undefined reference to `sframe_encoder_add_fre'
/usr/bin/ld: (.text+0x98d): undefined reference to `sframe_decoder_free'
/usr/bin/ld: (.text+0xb85): undefined reference to `sframe_decoder_get_abi_arch'
/usr/bin/ld: (.text+0xb96): undefined reference to `sframe_decoder_get_fixed_fp_offset'
/usr/bin/ld: (.text+0xba6): undefined reference to `sframe_decoder_get_fixed_ra_offset'
/usr/bin/ld: (.text+0xbcc): undefined reference to `sframe_encode'
/usr/bin/ld: /usr/lib/libbfd.a(elf-sframe.o): in function `_bfd_elf_write_section_sframe':
(.text+0xc89): undefined reference to `sframe_encoder_write'
/usr/bin/ld: (.text+0xcb7): undefined reference to `sframe_encoder_free'
/usr/bin/ld: /usr/lib/libbfd.a(compress.o): in function `decompress_contents':
(.text+0x196): undefined reference to `ZSTD_decompress'
/usr/bin/ld: (.text+0x19f): undefined reference to `ZSTD_isError'
/usr/bin/ld: /usr/lib/libbfd.a(compress.o): in function `bfd_compress_section_contents':
(.text+0x1338): undefined reference to `ZSTD_compress'
/usr/bin/ld: (.text+0x1346): undefined reference to `ZSTD_isError'
cvonelm commented 1 year ago

The easiest solution, I think, would be checking whether libsframe exists, and if it exists linking to both libsframe and libzstd. Both new dependencies appear to arrived in the 2.40 release of binutils.

The only problem I have spotted, at least on my system, is that there is no static libzstd, so we might need to change the default lo2s_USE_STATIC_LIBS=MOSTLY build option to link binutils dynamically.