FS#77179 - [binutils] ZSTD_compress ld library error

Attached to Project: Arch Linux
Opened by HcgRandon (HcgRandon) - Thursday, 19 January 2023, 01:16 GMT
Last edited by freswa (frederik) - Thursday, 19 January 2023, 15:39 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To freswa (frederik)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description: Updating to 2.40-1 has caused an issue with using make, seems to be related to ld. The following message appears and is reproducible on several systems:
```
/usr/bin/ld: /usr/lib/libbfd.a(compress.o): undefined reference to symbol 'ZSTD_compress'
/usr/bin/ld: /usr/lib/libzstd.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/looking-glass-client.dir/build.make:492: looking-glass-client] Error 1
make[1]: *** [CMakeFiles/Makefile2:382: CMakeFiles/looking-glass-client.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
```
Downgrading back to 2.39-4 resolve the issue.

Additional info:
* 2.40-1

Steps to reproduce:
Following the build steps at this URL will result with the error on 2.40-1
https://looking-glass.io/docs/B6/build/#building
This task depends upon

Closed by  freswa (frederik)
Thursday, 19 January 2023, 15:39 GMT
Reason for closing:  Fixed
Additional comments about closing:  binutils-2.40-2
Comment by loqs (loqs) - Thursday, 19 January 2023, 01:55 GMT
libbfd.so which Arch uses to redirect linking to the static library does not link in lstd.
The attached diff, does not seem to resolve the issue as linking still fails.
Comment by Toolybird (Toolybird) - Thursday, 19 January 2023, 02:51 GMT
I haven't looked at toolchain stuff lately... but a quick glance reveals zstd is a new binutils dep. I haven't tested anything yet, but it seems likely this line in the PKGBUILD will need to be adjusted?

echo 'INPUT( /usr/lib/libbfd.a -liberty -lz -ldl )' > "$pkgdir/usr/lib/libbfd.so"
Comment by HcgRandon (HcgRandon) - Thursday, 19 January 2023, 02:52 GMT
@loqs, Oh so is this is a project issue then not a arch core issue? My apologies, was just trying to do due diligence and report, just seemed weird that it broke because of a system package update.
Comment by Toolybird (Toolybird) - Thursday, 19 January 2023, 03:01 GMT
@HcgRandon, please try this quick test:

1. Edit `/usr/lib/libbfd.so' (it's an ASCII text file) so that it reads:

INPUT( /usr/lib/libbfd.a -lzstd -liberty -lz -ldl )

Does that solve the problem?
Comment by HcgRandon (HcgRandon) - Thursday, 19 January 2023, 03:12 GMT
No that seems to of made things much angrier:

/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'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/looking-glass-client.dir/build.make:492: looking-glass-client] Error 1
make[1]: *** [CMakeFiles/Makefile2:382: CMakeFiles/looking-glass-client.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
Comment by Toolybird (Toolybird) - Thursday, 19 January 2023, 03:42 GMT
Ok, thanks for trying. Sorry for the "unhelpful" suggestion. Until we figure this out properly, you can always build looking-glass with:

cmake -DENABLE_BACKTRACE=no ../

which will avoid linking against binutils libbfd.
Comment by loqs (loqs) - Thursday, 19 January 2023, 03:45 GMT
Needs libsframe as well
echo 'INPUT( /usr/lib/libbfd.a -lsframe -liberty -lz -lzstd -ldl )' > "$pkgdir/usr/lib/libbfd.so"

@HcgRandon sorry for the earlier noise.
Comment by freswa (frederik) - Thursday, 19 January 2023, 13:00 GMT
Changes added to trunk. @HcgRandon please check loqs latest comment and report if that solves your issue.
Comment by Netboy3 (Netboy3) - Thursday, 19 January 2023, 14:15 GMT
The latest changes suggested by loqs seem to fix the build issue. Thanks for the quick response!
Comment by HcgRandon (HcgRandon) - Thursday, 19 January 2023, 15:30 GMT
@frederik

Can confirm that the changes @loqs suggested have fixed the issue and things compile properly now. :D

Loading...