Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Debian Bookworm as base #67

Open
gsora opened this issue Feb 20, 2024 · 5 comments
Open

Use Debian Bookworm as base #67

gsora opened this issue Feb 20, 2024 · 5 comments

Comments

@gsora
Copy link

gsora commented Feb 20, 2024

Hi!

Due to a third-party dependency, a software I work on needs at least Debian Bookworm to compile correctly (C++ stdlib fails to link otherwise).

Is there a way I could run goreleaser-cross on Bookworm?

Thanks!

@nmattia
Copy link

nmattia commented Apr 26, 2024

I'm running into a very similar issue! This cpp reference is undefined: std::__throw_bad_array_new_length()

@troian would it be possible to bump bullseye to bookworm here? I'm copying & editing the various dockerfiles to give it a try and see if it solves the issue

@troian
Copy link
Member

troian commented Apr 26, 2024

@gsora you have to use sysroot for that

@nmattia
Copy link

nmattia commented Apr 26, 2024

@troian I tried to create a new image derived from your (bullseye) image but copying a sysroot from a newer (bookworm) debian:

FROM debian:bookworm as debian-latest

RUN \
    set -x; \
    echo "Starting image build for Debian" \
 && apt-get update \
 && apt-get install --no-install-recommends -y -q \
        wget \
        xz-utils \
        cmake \
        openssl \
        autoconf \
        automake \
        build-essential \
        gcc \
        g++

FROM ghcr.io/goreleaser/goreleaser-cross:v1.21.5

ENV CGO_ENABLED=1

RUN mkdir -p /sysroot/linux/amd64-latest

COPY --from=debian-latest /lib /sysroot/linux/amd64-latest/lib
COPY --from=debian-latest /lib64 /sysroot/linux/amd64-latest/lib64
COPY --from=debian-latest /usr /sysroot/linux/amd64-latest/usr
COPY --from=debian-latest /bin /sysroot/linux/amd64-latest/bin

here's the goreleaser environment I'm using:

builds:
- env:
    - PKG_CONFIG_SYSROOT_DIR=/sysroot/linux/amd64-latest
    - PKG_CONFIG_PATH=/sysroot/linux/amd64-latest/usr/local/lib/pkgconfig
    - CC=/sysroot/linux/amd64-latest/usr/bin/gcc
    - CXX=/sysroot/linux/amd64-latest/usr/bin/g++

still something's off, I need to figure out why /sysroot/linux/amd64-latest/usr/bin/gcc is using the host's libc:

# runtime/cgo
/sysroot/linux/amd64-latest/usr/bin/gcc: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.35' not fo
und (required by /sysroot/linux/amd64-latest/usr/bin/gcc)
/sysroot/linux/amd64-latest/usr/bin/gcc: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not fo
und (required by /sysroot/linux/amd64-latest/usr/bin/gcc)
/sysroot/linux/amd64-latest/usr/bin/gcc: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not fo
und (required by /sysroot/linux/amd64-latest/usr/bin/gcc)
/sysroot/linux/amd64-latest/usr/bin/gcc: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not fo
und (required by /sysroot/linux/amd64-latest/usr/bin/gcc)

EDIT: the mistake was to use gcc from the other install. As @troian says below, there's no need to install the compiler into the sysroot.

is this the general direction you were suggesting?

@troian
Copy link
Member

troian commented Apr 26, 2024

My suggestion would be to keep sysroot lets say as git repo and mount it during build process. Also, there is no need to install compiler into sysroot. Tho you can, it's main purpose here to provide libraries and headers.

Take a look at https://github.com/goreleaser/goreleaser-cross-example

@nmattia
Copy link

nmattia commented May 16, 2024

@troian the README says several platforms (darwin x86/arm, linux x86, etc) were verified. Can you share the repos used for verification? The example sysroot repo goreleaser/goreleaser-cross-example-sysroot is missing arm Darwin, Windows, etc.

Then I could just mount that repo/those repos, correct?


EDIT: actually I don't think the sysroot is necessary for Darwin builds; osxcross (installed in the image at /usr/local/osxcross) takes care of everything (including for ARM builds)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants