Skip to content

[zig cc] libresolv symbol not found under linux #25787

@michaelortmann

Description

@michaelortmann

Zig Version

0.15.2

Steps to Reproduce and Observed Behavior

> cat test.c 
#include <resolv.h>
#include <stdio.h>
#include <string.h>

int main() {
    const char *s = "test";
    char out[sizeof s << 1];

    b64_ntop((const unsigned char *) s, strlen(s), out, sizeof out);

    printf("%s\n", out);
}
> clang -Wall test.c -o test -lresolv`
> ./test
dGVzdA==
> zig cc -Wall test.c -o test -lresolv
ld.lld: error: undefined symbol: __b64_ntop
>>> referenced by test.c:9
>>>               /home/michael/.cache/zig/o/d3eb4eae11967bfaa9bf667ce900d74b/test.o:(main)

Under FreeBSD it is working fine without -lresolv

Expected Behavior

I expect zig cc to resolve symbols (in system libc/libresolv/zigs musl libc)

Metadata

Metadata

Assignees

Labels

bugObserved behavior contradicts documented or intended behaviorfrontendTokenization, parsing, AstGen, Sema, and Liveness.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions