Skip to content

linker error when building on alpine linux 3.19Β #1735

@plarsson

Description

@plarsson

Build fails on docker alpine 3.19 (golang:1.21.5-alpine). Works fine on 3.18 (golang:1.21.5-alpine3.18)

using build-base apk update && apk upgrade && apk add --no-cache ca-certificates git openssh build-base

RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build \
   -ldflags='-w -s -extldflags "-static"' \
   -o /out/main ./cmd/api-service/

It looks like its a newer musl version that is the problem musl-dev (1.2.4_git20230717-r4)

#20 64.87 /usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
#20 64.87 /usr/lib/gcc/x86_64-alpine-linux-musl/13.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /go/pkg/mod/github.com/osohq/[email protected]/internal/ffi/native/linux/amd64/libpolar.a(std-df986adbef8b2eb0.std.3c2b20ec-cgu.0.rcgu.o): in function std::sys::unix::fs::File::file_attr': #20 64.87 /rustc/9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0/library/std/src/sys/unix/fs.rs:1023:(.text._ZN3std2fs4read5inner17he426ae8d55037015E+0x132): undefined reference to fstat64'
...

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