Skip to content

Linux: static archives link in scan order, so interdependent package libraries fail (libcurl → libssl.a needs libcrypto.a) #1193

Closed

Description

@ehartford

Release validation 35388740596, linux-x86_64, release-libcurl-uat:

/usr/bin/ld: …/openssl/3.6.4/lib/libssl.a(libssl-lib-ssl_lib.o): in function `SSL_get0_peer_scts':
ssl_lib.c: undefined reference to `OCSP_SINGLERESP_get1_ext_d2i'
… undefined reference to `CT_POLICY_EVAL_CTX_new_ex' (and 6 more)

Exact lines. conan_scan_libraries (src/compiler/ConanClient.w) collects a package's libraries with conan_sorted_insert_unique, i.e. alphabetically: crypto before ssl. Both ELF link paths in src/compiler/Link.w — the compiler-driver path (link_stage_make_link_command, the link_libs loop) and the direct plan (link_stage_make_linux_llvm_link_command) — emit -l<lib> in that order with no grouping. GNU ld and lld resolve static archives left to right, once, so libssl.a's references into libcrypto.a are never satisfied. ld64 is order-insensitive, which is why the same package links on darwin.

Fix. Wrap the user libraries in --start-group … --end-group on ELF targets (both paths), so any set of interdependent archives links regardless of the order a scan produced. Ordering by the package graph would fix openssl but not a package whose own archives are mutually dependent.

Part of the with get campaign (PR #1191).

Activity

  1. added a commit that references this issue on Sep 19, 2026
    ed77ccc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions