Skip to content

Draft: Updated Docker image to Ubuntu-24.04 and Cargo dependencies #1580

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JanDiederich
Copy link

There were attempts to update to Ubuntu 22 (#973), and then Ubuntu 24, but that seems to have stopped? Also the dependencies were outdated.

So I updated them, but I can't get it running. I tried to build the Docker image for ARM64 Linux, but it stops in an endless loop. The command line is cargo build-docker-image aarch64_be-unknown-linux-gnu-cross --tag local.
In crosstool-ng.sh:

    download() {
        # timeout is a command, not a built-in, so it won't
        # work with any bash functions: must call a command.
        timeout "${timeout}" \
            su "${username}" -c \
            "STOP=${step} CT_DEBUG_CT_SAVE_STEPS=1 ${crosstooldir}/bin/ct-ng build.${nproc}"
    }

    while silence_stdout download; [ $? -eq 124 ]; do
        # Indicates a timeout, repeat the command.
        sleep "${sleep}"
    done

Please, can anyone give me a hint how to fix that?

@JanDiederich JanDiederich requested a review from a team as a code owner October 26, 2024 22:43
@Emilgardis
Copy link
Member

/ci try

This comment has been minimized.

Copy link

Try run for comment

Failed Jobs

List

Successful Jobs

List

@Emilgardis Emilgardis marked this pull request as draft October 27, 2024 17:52
@JanDiederich
Copy link
Author

Looking at the died down predecessor #973 I don't expect any help soon. On the other hand: This project is super famous and used by many, many people.
If you added a donate button I would donate a little bit. Maybe others too? Maybe even if the single tips are small, they sum up to something bigger and were enough of a motivation?

@Emilgardis
Copy link
Member

Thank you for the consideration, I'd rather get help with contributions like this rather than money <3 I don't think a way to donate would motivate me, but maybe it could motivate other invited maintainers? I have no clue :3

I'll look into the issue you reported, but try setting VERBOSE=1 in the dockerfile to see if there's an error message, we're silencing stdout

@JanDiederich
Copy link
Author

VERBOSE=1 didn't help, but I could get it a bit further in the compiling, so I get now the following error in my build process when I use the updated "cross":

LC_ALL="C" PATH="/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin" VSLANG="1033" "cc" "-Wl,--version-script=/tmp/rustceDa4y3/list" "-Wl,--no-undefined-version" "/tmp/rustceDa4y3/symbols.o" "/target/aarch64-unknown-linux-gnu/release/deps/zune_jpeg-83beae640ba15514.zune_jpeg.21f0ac8659d152a4-cgu.0.rcgu.o" "/target/aarch64-unknown-linux-gnu/release/deps/zune_jpeg-83beae640ba15514.zune_jpeg.21f0ac8659d152a4-cgu.1.rcgu.o" "/tar ...

Note how it is filled with nightly-x86_64-unknown-linux-gnu instead of ...aarch64..., how can I fix that?

@Emilgardis
Copy link
Member

nightly-x86_64-unknown-linux-gnu is the correct toolchain to use though, the target may be aarch64, but the toolchain runs on x86_64

@petehayes102
Copy link

I managed to get all the way to testing the targets before bombing: https://github.com/petehayes102/cross/actions/runs/12102553312.

You can see my commits on top of your original one: https://github.com/petehayes102/cross/commits/trying/. I messed up this branch so it says its miles ahead of main, though that's just a dodgy rebase!

@JanDiederich
Copy link
Author

@petehayes102:
I got sidetracked with other projects, but I continued trying to get it to work. So I continued based on your work. Big thanks for that.
So far I changed only my own code. I compile in cross with: cargo build-docker-image aarch64_be-unknown-linux-gnu-cross --tag local. My Dockerfile uses:

FROM ghcr.io/cross-rs/aarch64_be-unknown-linux-gnu-cross:local
ARG DEBIAN_FRONTEND=noninteractive
RUN dpkg --add-architecture arm64
RUN apt-get install -y \
  gcc-aarch64-linux-gnu \
  g++-aarch64-linux-gnu \
  binutils-aarch64-linux-gnu \
  libfontconfig1-dev

I had to configure all my libraries which used some CPU specific SIMD code in their defaults to use other libraries / "vendor" feature, etc.. Then, when I cross-compile my project, I get a lot of this messages: Relocations in generic ELF (EM: 183). Which means that the compiler or linker used is for the wrong architecture.

Any ideas how to solve that?

@Emilgardis
Copy link
Member

I'd guess gcc-aarch64-linux-gnu is not correct for be

@JanDiederich
Copy link
Author

I'd guess gcc-aarch64-linux-gnu is not correct for be

Ups. Yes, you were right, I was mixing be and le. Fixed that. Now it's cargo build-docker-image aarch64-unknown-linux-gnu --tag local on the cross side.
And in my project I tried this Dockerfile:

FROM ghcr.io/cross-rs/aarch64-unknown-linux-gnu:local
ARG DEBIAN_FRONTEND=noninteractive
RUN dpkg --add-architecture arm64
RUN echo -e "Types: deb\n\
URIs: http://ports.ubuntu.com/ubuntu-ports\n\
Suites: noble\n\
Components: main universe\n\
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg\n\
Enabled: yes" >> "/etc/apt/sources.list.d/ubuntu.sources"

RUN apt-get update -o APT::Architecture="arm64" -o APT::Architectures="arm64"; exit 0
RUN apt-get install -y \
  gcc-aarch64-linux-gnu \
  g++-aarch64-linux-gnu \
  binutils-aarch64-linux-gnu \
  libfontconfig1-dev

But I always get the same error lines at the end:

note: /usr/lib/gcc-cross/aarch64-linux-gnu/13/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libfreetype.so when searching for -lfreetype
          /usr/lib/gcc-cross/aarch64-linux-gnu/13/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libfreetype.a when searching for -lfreetype
          /usr/lib/gcc-cross/aarch64-linux-gnu/13/../../../../aarch64-linux-gnu/bin/ld: cannot find -lfreetype: No such file or directory
          /usr/lib/gcc-cross/aarch64-linux-gnu/13/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libfreetype.so when searching for -lfreetype
          /usr/lib/gcc-cross/aarch64-linux-gnu/13/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libgcc_s.so.1 when searching for libgcc_s.so.1
          collect2: error: ld returned 1 exit status

@Emilgardis
Copy link
Member

Emilgardis commented Mar 30, 2025

don't you need libfontconfig1-dev:arm64 ?

also, why install gcc etc again?

@JanDiederich
Copy link
Author

don't you need libfontconfig1-dev:arm64 ?
also, why install gcc etc again?

Failed attempts to solve dependency problems. When I append ":arm64" the installation failed.
When adding arm64 I can get only something like this:

#9 0.487 The following packages have unmet dependencies:
#9 0.523  adduser : Depends: passwd but it is not going to be installed
#9 0.523  autoconf : Depends: perl (> 5.005) but it is not going to be installed
#9 0.523             Depends: m4 (>= 1.4.13) but it is not going to be installed
#9 0.523             Depends: debianutils (>= 1.8) but it is not going to be installed
#9 0.523  bsdextrautils : Depends: libsmartcols1 (>= 2.39.1) but it is not going to be installed
#9 0.523  g++-13-aarch64-linux-gnu:amd64 : Depends: libstdc++-13-dev-arm64-cross:amd64 (>= 13) but it is not installable
   ... and so on and on ...

For me it seems it runs like this:

  • Install "package:arm64". Solve dependency "y".
  • Try to find "y"... Without ":arm64", therefore trying to install amd64.
  • And then fails because "amd64" is of course incompatible to "arm64".

To solve this I tried this in the Dockerfile:

# Disable all non-arm64 sources
RUN sed -i -e 's/Enabled: yes/Enabled: no/g' /etc/apt/sources.list.d/ubuntu.sources

# Add arm64 sources as the only valid sources
RUN echo -e "Types: deb\n\
URIs: http://ports.ubuntu.com/ubuntu-ports\n\
Suites: noble\n\
Components: main universe\n\
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg\n\
Enabled: yes" >> "/etc/apt/sources.list.d/ubuntu.sources"

It doesn't seem to help at all.

@JanDiederich
Copy link
Author

@Emilgardis Regarding the package installation problems, do you have any idea how this problem happens?
I get this:

debianutils : Conflicts: debianutils:amd64
debianutils:amd64 : Conflicts: debianutils but 5.17build1 is to be installed

when I try to install the debianutils:arm64 package.
Should it be ":amd64", while the other packages stay ":arm64"?
I'm confused?!

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

Successfully merging this pull request may close these issues.

3 participants