Skip to content

CMake: Incorrect link order for static OpenSSL and Curl dependencies in httpfs extension #151

@ed-w-ds

Description

@ed-w-ds

When building DuckDB with the httpfs extension and linking against static versions of libcurl and OpenSSL (libcurl.a, libssl.a, libcrypto.a), linker errors occur.

The build fails with undefined reference errors for OpenSSL symbols (e.g., OCSP_basic_verify, SSL_alert_desc_string_long) that are required by libcurl's OpenSSL backend functions.

This happens because the target_link_libraries commands in the httpfs extension's CMakeLists.txt link the OpenSSL libraries before the libcurl library for the httpfs_extension and httpfs_loadable_extension targets.
When linking static libraries, the linker generally requires that libraries providing symbols appear after the libraries that use those symbols on the final link command line. The current CMake order results in an incorrect linker command order, causing the linker to fail to resolve symbols needed by libcurl.a.

This is easily solved by linking curl before openssl in CMakeLists.txt file.

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