Skip to content

std.net.curl doesn't work with -static #10629

Open

Description

@trikko

Compiling an app that uses curl with musl+ldc+alpine results in a single working static (portable!) executable. However, std.net.curl does not work correctly because it attempts to load the dynamic library libcurl.so.

The main reason is that the check at this line fails, likely because dlopen does not work in static binaries, and thus the symbol is incorrectly not detected. I guess it works with static symbols on dynamic executable?

Incidentally, a simple program using etc.c.curl works because the symbols are present, as can be confirmed by analyzing the executable file.

Perhaps a different check should be used (e.g., __traits(compiles)?), but the entire structure would then need to be adjusted accordingly.

Linked libs: "-lcurl", "-lunistring", "-lbrotlicommon", "-lbrotlienc", "-licuuc", "-licudata", "-lcares_static", "-lnghttp2", "-lidn2", "-lpsl", "-lssl", "-lcrypto", "-lzstd", "-lbrotlidec", "-lz"

Activity

  1. added theissue type on Feb 22, 2026
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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions