~alpine/devel

Postgres dependent Rust project doesn't link | ld: fe-secure-common.c:(.text+0x320): undefined reference to `pg_strerror_r'

Details
Message ID
<CAMfPbcb4h2t5FbUfyARLw9Ybd7UeA=Rm04F+o8a6u03rObtX6w@mail.gmail.com>
DKIM signature
missing
Download raw message
Dockerfile available in my project, just build it `docker build .` to
replicate issue.
https://github.com/SamuelMarks/serve-actix-diesel-auth-scaffold

Taking a close look at the log, and it seems that I need musl-dev
libpq-dev postgresql16-dev. So I've added these dependencies. Errors
remain.
________________________________

Log snippet:

    Compiling rust-actix-diesel-auth-scaffold v0.0.1
(https://github.com/SamuelMarks/rust-actix-diesel-auth-scaffold#3a16ec03)
    Compiling serve-actix-diesel-auth-scaffold v0.0.1 (/src)
 error: linking with `cc` failed: exit status: 1
   |
   = note: LC_ALL="C"
PATH="/usr/local/rustup/toolchains/nightly-aarch64-unknown-linux-musl/lib/rustlib/aarch64-unknown-linux-musl/bin

[…]

           fe-secure-common.c:(.text+0xf0): undefined reference to
`pg_strcasecmp'
           /usr/lib/gcc/aarch64-alpine-linux-musl/13.2.1/../../../../aarch64-alpine-linux-musl/bin/ld:
fe-secure-common.c:(.text+0x168): undefined reference to
`pg_strcasecmp'
           /usr/lib/gcc/aarch64-alpine-linux-musl/13.2.1/../../../../aarch64-alpine-linux-musl/bin/ld:
/usr/lib/libpq.a(fe-secure-common.o): in function
`pq_verify_peer_name_matches_certificate_ip':
           fe-secure-common.c:(.text+0x250): undefined reference to
`pg_inet_net_ntop'
           /usr/lib/gcc/aarch64-alpine-linux-musl/13.2.1/../../../../aarch64-alpine-linux-musl/bin/ld:
fe-secure-common.c:(.text+0x320): undefined reference to
`pg_strerror_r'
           collect2: error: ld returned 1 exit status

________________________________

What am I doing wrong? - Does the linker need explicit paths setup
ahead of time? - Is it a Rust issue, are the linker dependencies not
transitively exposed?

Thanks for any suggestions,

Samuel Marks
Charity | consultancy | open-source | LinkedIn
Reply to thread Export thread (mbox)