Bug 29288 - Dependent libraries cannot be found with default sysroot search dir and rpath using cross ld
Summary: Dependent libraries cannot be found with default sysroot search dir and rpath...
Status: RESOLVED INVALID
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.38
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-06-26 13:19 UTC by William Tang
Modified: 2022-07-04 00:41 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description William Tang 2022-06-26 13:19:40 UTC
When I build for arm-linux-gnu-binutils using this script (https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=arm-linux-gnueabihf-binutils), the search path of result ld has an extra '=' before the search path:

[william@NoteBook ~]$ arm-linux-gnueabihf-ld --verbose | grep SEARCH
SEARCH_DIR("/usr/lib/binutils/arm-linux-gnueabihf"); SEARCH_DIR("=/usr/arm-linux-gnueabihf/lib");
Comment 1 William Tang 2022-06-26 17:08:03 UTC
Okay, the issue is related to sysroot searchdir.  For detailed description, please refer to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106088
Comment 2 William Tang 2022-06-27 14:49:24 UTC
Okay, it seems there is another issue.  Although the ld is configured with --with-sysroot option.  The -rpath values are still not used for shared library dependency resolution.

This is against the behavior stated in the documentation (https://sourceware.org/binutils/docs-2.38/ld/Options.html#Options):

"The -rpath option is also used when locating shared objects which are needed by shared objects explicitly included in the link; see the description of the -rpath-link option. Searching -rpath in this way is only supported by native linkers and cross linkers which have been configured with the --with-sysroot option."
Comment 3 Nick Clifton 2022-06-28 15:49:28 UTC
Hi William,

  OK, so just to confirm - are the missing shared objects actually in the 
  /usr/arm-linux-gnueabihf/lib/  directory ?  Because that is where the
  linker will be looking for them (I think).

  Also - you say that the -rpath option is not working properly, but the
  example you reported in the gcc bug report does not use that option...

  If you run the failing command with -Wl,--verbose added you should get
  more output, including details about the places where the linker looks
  for the object files.  Could you try that and see what the linker does ?

Cheers
  Nick
Comment 4 William Tang 2022-06-29 03:50:12 UTC
Hi, Nick

Here are the logs you requested:

[william@NoteBook cross-compile](master)$ ls /usr/arm-linux-gnueabihf/lib/libcrypto.so.1.1 
/usr/arm-linux-gnueabihf/lib/libcrypto.so.1.1
[william@NoteBook cross-compile](master)$ arm-linux-gnueabihf-gcc main.c -Wl,--verbose -larchive
GNU ld (GNU Binutils) 2.38
  Supported emulations:
   armelf_linux_eabi
   armelfb_linux_eabi
using internal linker script:
==================================================
/* Script for -pie -z combreloc */
/* Copyright (C) 2014-2022 Free Software Foundation, Inc.
   Copying and distribution of this script, with or without modification,
   are permitted in any medium without royalty provided the copyright
   notice and this notice are preserved.  */
OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm",
	      "elf32-littlearm")
OUTPUT_ARCH(arm)
ENTRY(_start)
SEARCH_DIR("/usr/lib/binutils/arm-linux-gnueabihf"); SEARCH_DIR("=/usr/arm-linux-gnueabihf/lib");
SECTIONS
{
  /* Read-only sections, merged into text segment: */
  PROVIDE (__executable_start = SEGMENT_START("text-segment", 0)); . = SEGMENT_START("text-segment", 0) + SIZEOF_HEADERS;
  .interp         : { *(.interp) }
  .note.gnu.build-id  : { *(.note.gnu.build-id) }
  .hash           : { *(.hash) }
  .gnu.hash       : { *(.gnu.hash) }
  .dynsym         : { *(.dynsym) }
  .dynstr         : { *(.dynstr) }
  .gnu.version    : { *(.gnu.version) }
  .gnu.version_d  : { *(.gnu.version_d) }
  .gnu.version_r  : { *(.gnu.version_r) }
  .rel.dyn        :
    {
      *(.rel.init)
      *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
      *(.rel.fini)
      *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
      *(.rel.data.rel.ro .rel.data.rel.ro.* .rel.gnu.linkonce.d.rel.ro.*)
      *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
      *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
      *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
      *(.rel.ctors)
      *(.rel.dtors)
      *(.rel.got)
      *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
      *(.rel.iplt)
    }
  .rela.dyn       :
    {
      *(.rela.init)
      *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
      *(.rela.fini)
      *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
      *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
      *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
      *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
      *(.rela.ctors)
      *(.rela.dtors)
      *(.rela.got)
      *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
      *(.rela.iplt)
    }
  .rel.plt        :
    {
      *(.rel.plt)
    }
  .rela.plt       :
    {
      *(.rela.plt)
    }
  .init           :
  {
    KEEP (*(SORT_NONE(.init)))
  }
  .plt            : { *(.plt) }
  .iplt           : { *(.iplt) }
  .text           :
  {
    *(.text.unlikely .text.*_unlikely .text.unlikely.*)
    *(.text.exit .text.exit.*)
    *(.text.startup .text.startup.*)
    *(.text.hot .text.hot.*)
    *(SORT(.text.sorted.*))
    *(.text .stub .text.* .gnu.linkonce.t.*)
    /* .gnu.warning sections are handled specially by elf.em.  */
    *(.gnu.warning)
    *(.glue_7t) *(.glue_7) *(.vfp11_veneer) *(.v4_bx)
  }
  .fini           :
  {
    KEEP (*(SORT_NONE(.fini)))
  }
  PROVIDE (__etext = .);
  PROVIDE (_etext = .);
  PROVIDE (etext = .);
  .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
  .rodata1        : { *(.rodata1) }
  .ARM.extab   : { *(.ARM.extab* .gnu.linkonce.armextab.*) }
  .ARM.exidx   :
    {
      PROVIDE_HIDDEN (__exidx_start = .);
      *(.ARM.exidx* .gnu.linkonce.armexidx.*)
      PROVIDE_HIDDEN (__exidx_end = .);
    }
  .eh_frame_hdr   : { *(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*) }
  .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) *(.eh_frame.*) }
  .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
  .gnu_extab   : ONLY_IF_RO { *(.gnu_extab*) }
  /* These sections are generated by the Sun/Oracle C++ compiler.  */
  .exception_ranges   : ONLY_IF_RO { *(.exception_ranges*) }
  /* Adjust the address for the data segment.  We want to adjust up to
     the same address within the page on the next page up.  */
  . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
  /* Exception handling  */
  .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) *(.eh_frame.*) }
  .gnu_extab      : ONLY_IF_RW { *(.gnu_extab) }
  .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
  .exception_ranges   : ONLY_IF_RW { *(.exception_ranges*) }
  /* Thread Local Storage sections  */
  .tdata	  :
   {
     PROVIDE_HIDDEN (__tdata_start = .);
     *(.tdata .tdata.* .gnu.linkonce.td.*)
   }
  .tbss		  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
  .preinit_array    :
  {
    PROVIDE_HIDDEN (__preinit_array_start = .);
    KEEP (*(.preinit_array))
    PROVIDE_HIDDEN (__preinit_array_end = .);
  }
  .init_array    :
  {
    PROVIDE_HIDDEN (__init_array_start = .);
    KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
    KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))
    PROVIDE_HIDDEN (__init_array_end = .);
  }
  .fini_array    :
  {
    PROVIDE_HIDDEN (__fini_array_start = .);
    KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))
    KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))
    PROVIDE_HIDDEN (__fini_array_end = .);
  }
  .ctors          :
  {
    /* gcc uses crtbegin.o to find the start of
       the constructors, so we make sure it is
       first.  Because this is a wildcard, it
       doesn't matter if the user does not
       actually link against crtbegin.o; the
       linker won't look for a file to match a
       wildcard.  The wildcard also means that it
       doesn't matter which directory crtbegin.o
       is in.  */
    KEEP (*crtbegin.o(.ctors))
    KEEP (*crtbegin?.o(.ctors))
    /* We don't want to include the .ctor section from
       the crtend.o file until after the sorted ctors.
       The .ctor section from the crtend file contains the
       end of ctors marker and it must be last */
    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
    KEEP (*(SORT(.ctors.*)))
    KEEP (*(.ctors))
  }
  .dtors          :
  {
    KEEP (*crtbegin.o(.dtors))
    KEEP (*crtbegin?.o(.dtors))
    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
    KEEP (*(SORT(.dtors.*)))
    KEEP (*(.dtors))
  }
  .jcr            : { KEEP (*(.jcr)) }
  .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }
  .dynamic        : { *(.dynamic) }
  . = DATA_SEGMENT_RELRO_END (0, .);
  .got            : { *(.got.plt) *(.igot.plt) *(.got) *(.igot) }
  .data           :
  {
    PROVIDE (__data_start = .);
    *(.data .data.* .gnu.linkonce.d.*)
    SORT(CONSTRUCTORS)
  }
  .data1          : { *(.data1) }
  _edata = .; PROVIDE (edata = .);
  . = .;
  __bss_start = .;
  __bss_start__ = .;
  .bss            :
  {
   *(.dynbss)
   *(.bss .bss.* .gnu.linkonce.b.*)
   *(COMMON)
   /* Align here to ensure that the .bss section occupies space up to
      _end.  Align after .bss to ensure correct alignment even if the
      .bss section disappears because there are no input sections.
      FIXME: Why do we need it? When there is no .bss section, we do not
      pad the .data section.  */
   . = ALIGN(. != 0 ? 32 / 8 : 1);
  }
  _bss_end__ = .; __bss_end__ = .;
  . = ALIGN(32 / 8);
  . = SEGMENT_START("ldata-segment", .);
  . = ALIGN(32 / 8);
  __end__ = .;
  _end = .; PROVIDE (end = .);
  . = DATA_SEGMENT_END (.);
  /* Stabs debugging sections.  */
  .stab          0 : { *(.stab) }
  .stabstr       0 : { *(.stabstr) }
  .stab.excl     0 : { *(.stab.excl) }
  .stab.exclstr  0 : { *(.stab.exclstr) }
  .stab.index    0 : { *(.stab.index) }
  .stab.indexstr 0 : { *(.stab.indexstr) }
  .comment       0 : { *(.comment) }
  .gnu.build.attributes : { *(.gnu.build.attributes .gnu.build.attributes.*) }
  /* DWARF debug sections.
     Symbols in the DWARF debugging sections are relative to the beginning
     of the section so we begin them at 0.  */
  /* DWARF 1.  */
  .debug          0 : { *(.debug) }
  .line           0 : { *(.line) }
  /* GNU DWARF 1 extensions.  */
  .debug_srcinfo  0 : { *(.debug_srcinfo) }
  .debug_sfnames  0 : { *(.debug_sfnames) }
  /* DWARF 1.1 and DWARF 2.  */
  .debug_aranges  0 : { *(.debug_aranges) }
  .debug_pubnames 0 : { *(.debug_pubnames) }
  /* DWARF 2.  */
  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
  .debug_abbrev   0 : { *(.debug_abbrev) }
  .debug_line     0 : { *(.debug_line .debug_line.* .debug_line_end) }
  .debug_frame    0 : { *(.debug_frame) }
  .debug_str      0 : { *(.debug_str) }
  .debug_loc      0 : { *(.debug_loc) }
  .debug_macinfo  0 : { *(.debug_macinfo) }
  /* SGI/MIPS DWARF 2 extensions.  */
  .debug_weaknames 0 : { *(.debug_weaknames) }
  .debug_funcnames 0 : { *(.debug_funcnames) }
  .debug_typenames 0 : { *(.debug_typenames) }
  .debug_varnames  0 : { *(.debug_varnames) }
  /* DWARF 3.  */
  .debug_pubtypes 0 : { *(.debug_pubtypes) }
  .debug_ranges   0 : { *(.debug_ranges) }
  /* DWARF 5.  */
  .debug_addr     0 : { *(.debug_addr) }
  .debug_line_str 0 : { *(.debug_line_str) }
  .debug_loclists 0 : { *(.debug_loclists) }
  .debug_macro    0 : { *(.debug_macro) }
  .debug_names    0 : { *(.debug_names) }
  .debug_rnglists 0 : { *(.debug_rnglists) }
  .debug_str_offsets 0 : { *(.debug_str_offsets) }
  .debug_sup      0 : { *(.debug_sup) }
  .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
  .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
  /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
}


==================================================
/usr/bin/arm-linux-gnueabihf-ld: mode armelf_linux_eabi
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/Scrt1.o succeeded
/usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/Scrt1.o
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/crti.o succeeded
/usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/crti.o
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/crtbeginS.o succeeded
/usr/lib/gcc/arm-linux-gnueabihf/12.1.0/crtbeginS.o
attempt to open /tmp/ccjA2rxo.o succeeded
/tmp/ccjA2rxo.o
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/libarchive.so failed
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/libarchive.a failed
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so succeeded
/usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/libgcc.so failed
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/libgcc.a succeeded
/usr/lib/gcc/arm-linux-gnueabihf/12.1.0/libgcc.a
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/libgcc_s.so failed
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/libgcc_s.a failed
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libgcc_s.so succeeded
opened script file /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libgcc_s.so
/usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libgcc_s.so
opened script file /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libgcc_s.so
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libgcc_s.so.1 succeeded
/usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libgcc_s.so.1
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/libgcc.so failed
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/libgcc.a succeeded
/usr/lib/gcc/arm-linux-gnueabihf/12.1.0/libgcc.a
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/libc.so failed
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/libc.a failed
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libc.so succeeded
opened script file /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libc.so
/usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libc.so
opened script file /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libc.so
attempt to open /usr/arm-linux-gnueabihf/usr/lib/libc.so.6 succeeded
/usr/arm-linux-gnueabihf/usr/lib/libc.so.6
attempt to open /usr/arm-linux-gnueabihf/usr/lib/libc_nonshared.a succeeded
/usr/arm-linux-gnueabihf/usr/lib/libc_nonshared.a
attempt to open /usr/arm-linux-gnueabihf/usr/lib/ld-linux-armhf.so.3 succeeded
/usr/arm-linux-gnueabihf/usr/lib/ld-linux-armhf.so.3
/usr/arm-linux-gnueabihf/usr/lib/libc_nonshared.a
/usr/arm-linux-gnueabihf/usr/lib/ld-linux-armhf.so.3
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/libgcc.so failed
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/libgcc.a succeeded
/usr/lib/gcc/arm-linux-gnueabihf/12.1.0/libgcc.a
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/libgcc_s.so failed
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/libgcc_s.a failed
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libgcc_s.so succeeded
opened script file /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libgcc_s.so
/usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libgcc_s.so
opened script file /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libgcc_s.so
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libgcc_s.so.1 succeeded
/usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libgcc_s.so.1
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/libgcc.so failed
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/libgcc.a succeeded
/usr/lib/gcc/arm-linux-gnueabihf/12.1.0/libgcc.a
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/crtendS.o succeeded
/usr/lib/gcc/arm-linux-gnueabihf/12.1.0/crtendS.o
attempt to open /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/crtn.o succeeded
/usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/crtn.o
libcrypto.so.1.1 needed by /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so
attempt to open /usr/lib/binutils/arm-linux-gnueabihf/libcrypto.so.1.1 failed
attempt to open /usr/arm-linux-gnueabihf/usr/arm-linux-gnueabihf/lib/libcrypto.so.1.1 failed
attempt to open /usr/lib/binutils/arm-linux-gnueabihf/libcrypto.so.1.1 failed
attempt to open /usr/arm-linux-gnueabihf/usr/arm-linux-gnueabihf/lib/libcrypto.so.1.1 failed
/usr/bin/arm-linux-gnueabihf-ld: warning: libcrypto.so.1.1, needed by /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so, not found (try using -rpath or -rpath-link)
libacl.so.1 needed by /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so
attempt to open /usr/lib/binutils/arm-linux-gnueabihf/libacl.so.1 failed
attempt to open /usr/arm-linux-gnueabihf/usr/arm-linux-gnueabihf/lib/libacl.so.1 failed
attempt to open /usr/lib/binutils/arm-linux-gnueabihf/libacl.so.1 failed
attempt to open /usr/arm-linux-gnueabihf/usr/arm-linux-gnueabihf/lib/libacl.so.1 failed
/usr/bin/arm-linux-gnueabihf-ld: warning: libacl.so.1, needed by /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so, not found (try using -rpath or -rpath-link)
libexpat.so.1 needed by /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so
attempt to open /usr/lib/binutils/arm-linux-gnueabihf/libexpat.so.1 failed
attempt to open /usr/arm-linux-gnueabihf/usr/arm-linux-gnueabihf/lib/libexpat.so.1 failed
attempt to open /usr/lib/binutils/arm-linux-gnueabihf/libexpat.so.1 failed
attempt to open /usr/arm-linux-gnueabihf/usr/arm-linux-gnueabihf/lib/libexpat.so.1 failed
/usr/bin/arm-linux-gnueabihf-ld: warning: libexpat.so.1, needed by /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so, not found (try using -rpath or -rpath-link)
liblzma.so.5 needed by /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so
attempt to open /usr/lib/binutils/arm-linux-gnueabihf/liblzma.so.5 failed
attempt to open /usr/arm-linux-gnueabihf/usr/arm-linux-gnueabihf/lib/liblzma.so.5 failed
attempt to open /usr/lib/binutils/arm-linux-gnueabihf/liblzma.so.5 failed
attempt to open /usr/arm-linux-gnueabihf/usr/arm-linux-gnueabihf/lib/liblzma.so.5 failed
/usr/bin/arm-linux-gnueabihf-ld: warning: liblzma.so.5, needed by /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so, not found (try using -rpath or -rpath-link)
libzstd.so.1 needed by /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so
attempt to open /usr/lib/binutils/arm-linux-gnueabihf/libzstd.so.1 failed
attempt to open /usr/arm-linux-gnueabihf/usr/arm-linux-gnueabihf/lib/libzstd.so.1 failed
attempt to open /usr/lib/binutils/arm-linux-gnueabihf/libzstd.so.1 failed
attempt to open /usr/arm-linux-gnueabihf/usr/arm-linux-gnueabihf/lib/libzstd.so.1 failed
/usr/bin/arm-linux-gnueabihf-ld: warning: libzstd.so.1, needed by /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so, not found (try using -rpath or -rpath-link)
liblz4.so.1 needed by /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so
attempt to open /usr/lib/binutils/arm-linux-gnueabihf/liblz4.so.1 failed
attempt to open /usr/arm-linux-gnueabihf/usr/arm-linux-gnueabihf/lib/liblz4.so.1 failed
attempt to open /usr/lib/binutils/arm-linux-gnueabihf/liblz4.so.1 failed
attempt to open /usr/arm-linux-gnueabihf/usr/arm-linux-gnueabihf/lib/liblz4.so.1 failed
/usr/bin/arm-linux-gnueabihf-ld: warning: liblz4.so.1, needed by /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so, not found (try using -rpath or -rpath-link)
libbz2.so.1.0 needed by /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so
attempt to open /usr/lib/binutils/arm-linux-gnueabihf/libbz2.so.1.0 failed
attempt to open /usr/arm-linux-gnueabihf/usr/arm-linux-gnueabihf/lib/libbz2.so.1.0 failed
attempt to open /usr/lib/binutils/arm-linux-gnueabihf/libbz2.so.1.0 failed
attempt to open /usr/arm-linux-gnueabihf/usr/arm-linux-gnueabihf/lib/libbz2.so.1.0 failed
/usr/bin/arm-linux-gnueabihf-ld: warning: libbz2.so.1.0, needed by /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so, not found (try using -rpath or -rpath-link)
libz.so.1 needed by /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so
attempt to open /usr/lib/binutils/arm-linux-gnueabihf/libz.so.1 failed
attempt to open /usr/arm-linux-gnueabihf/usr/arm-linux-gnueabihf/lib/libz.so.1 failed
attempt to open /usr/lib/binutils/arm-linux-gnueabihf/libz.so.1 failed
attempt to open /usr/arm-linux-gnueabihf/usr/arm-linux-gnueabihf/lib/libz.so.1 failed
/usr/bin/arm-linux-gnueabihf-ld: warning: libz.so.1, needed by /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so, not found (try using -rpath or -rpath-link)
libgcc_s.so.1 needed by /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so
found libgcc_s.so.1 at /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libgcc_s.so.1
ld-linux-armhf.so.3 needed by /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so
found ld-linux-armhf.so.3 at /usr/arm-linux-gnueabihf/usr/lib/ld-linux-armhf.so.3
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `lzma_stream_encoder_mt@XZ_5.2'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `inflateReset'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `lzma_code@XZ_5.0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `lzma_raw_encoder@XZ_5.0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `lzma_stream_decoder@XZ_5.0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `LZ4_decompress_safe_usingDict'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `acl_get_qualifier@ACL_1.0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `LZ4_freeStream'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `acl_clear_perms@ACL_1.0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `XML_ParserCreate'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `LZ4_compress_HC'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `inflateEnd'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `acl_get_entry@ACL_1.0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `EVP_CIPHER_CTX_new@OPENSSL_1_1_0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `EVP_sha384@OPENSSL_1_1_0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `ZSTD_CCtx_setParameter'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `EVP_DigestUpdate@OPENSSL_1_1_0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `lzma_properties_size@XZ_5.0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `ZSTD_isError'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `lzma_lzma_preset@XZ_5.0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `BZ2_bzCompressInit'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `LZ4_loadDict'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `deflate'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `acl_get_fd@ACL_1.0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `ZSTD_maxCLevel'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `deflateInit_'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `HMAC_Init_ex@OPENSSL_1_1_0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `PKCS5_PBKDF2_HMAC_SHA1@OPENSSL_1_1_0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `XML_SetUserData'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `EVP_CIPHER_CTX_free@OPENSSL_1_1_0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `EVP_MD_CTX_free@OPENSSL_1_1_0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `BZ2_bzCompress'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `EVP_sha1@OPENSSL_1_1_0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `ZSTD_initCStream'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `lzma_raw_decoder@XZ_5.0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `acl_get_permset@ACL_1.0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `LZ4_saveDict'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `LZ4_saveDictHC'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `inflateInit2_'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `LZ4_compress_default'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `ZSTD_createCStream'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `inflate'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `acl_add_perm@ACL_1.0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `lzma_alone_encoder@XZ_5.0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `crc32'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `deflateEnd'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `ZSTD_createDStream'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `acl_create_entry@ACL_1.0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `deflateReset'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `acl_get_file@ACL_1.0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `LZ4_compress_HC_continue'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `EVP_sha256@OPENSSL_1_1_0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `acl_set_file@ACL_1.0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `ZSTD_decompressStream'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `BZ2_bzDecompress'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `HMAC_CTX_free@OPENSSL_1_1_0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `ZSTD_CStreamOutSize'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `LZ4_loadDictHC'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `LZ4_createStreamHC'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `inflateSetDictionary'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `LZ4_createStream'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `ZSTD_freeDStream'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `ZSTD_freeCStream'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `EVP_MD_CTX_new@OPENSSL_1_1_0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `LZ4_freeStreamHC'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `EVP_aes_128_ecb@OPENSSL_1_1_0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `lzma_cputhreads@XZ_5.2'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `EVP_aes_256_ecb@OPENSSL_1_1_0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `ZSTD_getErrorName'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `acl_free@ACL_1.0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `LZ4_decompress_safe'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `acl_get_perm@ACL_1.0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `LZ4_compress_fast_continue'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `EVP_aes_192_ecb@OPENSSL_1_1_0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `acl_get_tag_type@ACL_1.0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `lzma_properties_encode@XZ_5.0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `BZ2_bzDecompressEnd'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `ZSTD_compressStream'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `EVP_DigestInit@OPENSSL_1_1_0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `HMAC_CTX_new@OPENSSL_1_1_0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `lzma_end@XZ_5.0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `inflateInit_'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `lzma_alone_decoder@XZ_5.0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `XML_ParserFree'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `ZSTD_endStream'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `deflateInit2_'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `ZSTD_minCLevel'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `EVP_EncryptUpdate@OPENSSL_1_1_0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `acl_init@ACL_1.0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `EVP_md5@OPENSSL_1_1_0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `XML_SetElementHandler'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `XML_Parse'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `ZSTD_DStreamOutSize'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `lzma_crc32@XZ_5.0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `EVP_EncryptInit_ex@OPENSSL_1_1_0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `acl_set_tag_type@ACL_1.0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `LZ4_resetStreamHC'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `EVP_ripemd160@OPENSSL_1_1_0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `EVP_DigestFinal@OPENSSL_1_1_0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `EVP_sha512@OPENSSL_1_1_0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `lzma_memusage@XZ_5.0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `HMAC_Final@OPENSSL_1_1_0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `BZ2_bzDecompressInit'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `XML_SetCharacterDataHandler'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `lzma_properties_decode@XZ_5.0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `HMAC_Update@OPENSSL_1_1_0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `ZSTD_initDStream'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `BZ2_bzlibVersion'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `ZSTD_versionNumber'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `acl_set_fd@ACL_1.0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `acl_set_qualifier@ACL_1.0'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `BZ2_bzCompressEnd'
/usr/bin/arm-linux-gnueabihf-ld: /usr/lib/gcc/arm-linux-gnueabihf/12.1.0/../../../../arm-linux-gnueabihf/lib/libarchive.so: undefined reference to `lzma_stream_encoder@XZ_5.0'
/usr/bin/arm-linux-gnueabihf-ld: link errors found, deleting executable `a.out'
collect2: error: ld returned 1 exit status

The mentioned libraries did exist under /usr/arm-linux-gnueabihf/usr/lib.  And I noticed ld is searching "/usr/arm-linux-gnueabihf/usr/arm-linux-gnueabihf/lib" instead of "/usr/arm-linux-gnueabihf/usr/lib/".  Is it caused by misconfiguration or a bug?  How can I set the default search path of ld to "/usr/arm-linux-gnueabihf/lib" instead of "=/usr/arm-linux-gnueabihf/lib"?

As for the rpath issue, it's a separate issue. Please refer to my next comment.

William
Comment 5 William Tang 2022-06-29 04:39:08 UTC
So, the rapth issue is that, if the environment is located under other folders instead of /usr/arm-linux-gnueabihf/lib and compile the program with command

arm-linux-gnueabihf-gcc main.c -I /tmp/rpi-root/usr/include -Wl,--verbose -Wl,-rpath=/tmp/rpi-root/usr/lib /tmp/rpi-root/usr/lib/libarchive.so

The ld seems not searching /tmp/rpi-root/usr/lib, ld verbose log:

/usr/bin/arm-linux-gnueabihf-ld: warning: libcrypto.so.1.1, needed by /tmp/rpi-root/usr/lib/libarchive.so, not found (try using -rpath or -rpath-link)
libacl.so.1 needed by /tmp/rpi-root/usr/lib/libarchive.so
attempt to open /usr/arm-linux-gnueabihf/tmp/rpi-root/usr/lib/libacl.so.1 failed
attempt to open /usr/lib/binutils/arm-linux-gnueabihf/libacl.so.1 failed
attempt to open /usr/arm-linux-gnueabihf/usr/arm-linux-gnueabihf/lib/libacl.so.1 failed
attempt to open /usr/arm-linux-gnueabihf/tmp/rpi-root/usr/lib/libacl.so.1 failed
attempt to open /usr/lib/binutils/arm-linux-gnueabihf/libacl.so.1 failed
attempt to open /usr/arm-linux-gnueabihf/usr/arm-linux-gnueabihf/lib/libacl.so.1 failed

However, it did work with rpath-link option:

libcrypto.so.1.1 needed by /tmp/rpi-root/usr/lib/libarchive.so
found libcrypto.so.1.1 at /tmp/rpi-root/usr/lib/libcrypto.so.1.1
Comment 6 William Tang 2022-06-29 09:15:54 UTC
Also, I can confirm the issue does not exist when using gold, only happens when using bfd ld
Comment 7 Alan Modra 2022-06-30 01:37:55 UTC
sysroot and rpath are complicated, and can be difficult to get right.  If using sysroot you have a linker that has access to your entire file system, but default searches should be as if the linker was chroot'd at the sysroot.

BFD ld adds the sysroot to absolute paths in rpath when searching for shared library dependencies, ie. libraries not mentioned on the command line but found in DT_NEEDED entries of other libraries.  If you accept that linking against libraries not mentioned on the command line is a good thing (debatable), then emulating the run-time loader is necessary.  Note that gold doesn't go searching for library dependencies, hence the gold difference.

I don't believe BFD ld prefixes -rpath paths with the sysroot in other
circumstances.  (You definitely would not want the sysroot prefix added to DT_NEEDED in executables you create, since they then would have the wrong paths if copied over to a native environment.)

BFD ld also replaces an initial "=" or "$SYSROOT" in any -L or other
paths with the sysroot.  If configured with a sysroot, the default
library search paths have the "=" prefix.  eg. "=/usr/lib" and "=/lib".
Comment 8 William Tang 2022-06-30 12:37:51 UTC
(In reply to Alan Modra from comment #7)
> sysroot and rpath are complicated, and can be difficult to get right.  If
> using sysroot you have a linker that has access to your entire file system,
> but default searches should be as if the linker was chroot'd at the sysroot.
> 
> BFD ld adds the sysroot to absolute paths in rpath when searching for shared
> library dependencies, ie. libraries not mentioned on the command line but
> found in DT_NEEDED entries of other libraries.  If you accept that linking
> against libraries not mentioned on the command line is a good thing
> (debatable), then emulating the run-time loader is necessary.  Note that
> gold doesn't go searching for library dependencies, hence the gold
> difference.
> 
> I don't believe BFD ld prefixes -rpath paths with the sysroot in other
> circumstances.  (You definitely would not want the sysroot prefix added to
> DT_NEEDED in executables you create, since they then would have the wrong
> paths if copied over to a native environment.)
> 
> BFD ld also replaces an initial "=" or "$SYSROOT" in any -L or other
> paths with the sysroot.  If configured with a sysroot, the default
> library search paths have the "=" prefix.  eg. "=/usr/lib" and "=/lib".

Thanks for the detailed explanation.  But I still cannot understand why bfd ld always add "SEARCH_DIR("=/usr/arm-linux-gnueabihf/lib");" (which expanded to "/usr/arm-linux-gnueabihf/usr/arm-linux-gnueabihf/lib") to the search dir instead of something more reasonable like "SEARCH_DIR("=/lib");" (which expanded to "/usr/arm-linux-gnueabihf/lib").  The former path is pointing to an empty directory.
Comment 9 Alan Modra 2022-07-04 00:41:47 UTC
The script you used overrode the proper library path by specifying --with-lib-path.  Normally the library path is $tool_lib:/usr/local/lib:/lib:/usr/lib all of which are prefixed with "=" when sysrooted.  You instead got $tool_lib:$your_lib_path with just $tool_lib prefixed with "=".  (tool_lib, aka /$prefix/$target/lib predates sysroot by a long time and was an attempt to support cross target specific libs.)  The configure process assumes that you know exactly what you're doing if specifying --with-lib-path even down to *not* prefixing with "=".  Sadly, it appears your faith in the people who wrote/modified/maintained that script is misplaced.