Skip to content

Issues building m68k #875

Open
Open

Description

@techmetx11

I've been trying to build rustc_codegen_gcc for m68k-unknown-none-elf (basically, bare-metal m68k with only libcore) in a Docker container. But, I've hit a dead-end: whatever I try to do in the Dockerfile, the image compilation never progresses past trying to build the sysroot because rustc_codegen_gcc cannot load the libgccjit.so file, even though it's right there (found by the find command) and was just built before building rustc_codegen_gcc

I was wondering if you could help me fix this. It would mean a lot to me

CI logs: https://ci.codeberg.org/repos/16937/pipeline/11/3#L3118
Docker source repository: https://codeberg.org/techmetx11/rustc-gcc-m68k

Activity

  1. antoyo commented on Apr 28, 2026

    @antoyo
    Contributor

    Hi.
    Your CI logs shows the paths it looks for the lib:

    #20 35.21   Could not load libgccjit.so. Attempted paths: [
    #20 35.21       "/opt/rustc_codegen_gcc/build/build_sysroot/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/lib/m68k/libgccjit.so",
    #20 35.21       "/root/.rustup/toolchains/nightly-2026-03-26-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/lib/m68k/libgccjit.so",
    #20 35.21   ]
    

    Could you please check whether the step building the sysroot copied your libgccjit.so file in the first location (/opt/rustc_codegen_gcc/build/build_sysroot/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/lib/m68k/libgccjit.so)?
    If not, could you try using find to see whether it was copied elsewhere?

    A next step would be to add some logging around here to check where it was copied.

    You might already know, but just in case we have a CI workflow to build cg_gcc for m68k.

  2. techmetx11 commented on Apr 28, 2026

    @techmetx11
    ContributorAuthor

    Hi. Your CI logs shows the paths it looks for the lib:

    #20 35.21   Could not load libgccjit.so. Attempted paths: [
    #20 35.21       "/opt/rustc_codegen_gcc/build/build_sysroot/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/lib/m68k/libgccjit.so",
    #20 35.21       "/root/.rustup/toolchains/nightly-2026-03-26-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/lib/m68k/libgccjit.so",
    #20 35.21   ]
    

    Could you please check whether the step building the sysroot copied your libgccjit.so file in the first location (/opt/rustc_codegen_gcc/build/build_sysroot/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/lib/m68k/libgccjit.so)? If not, could you try using find to see whether it was copied elsewhere?

    A next step would be to add some logging around here to check where it was copied.

    You might already know, but just in case we have a CI workflow to build cg_gcc for m68k.

    I modified the Dockerfile to check if those paths existed. Due to a Docker quirk I failed to account for (compilation stops after the first command that returns a non-zero error code), it only checked the first path.

    32.79 ls: cannot access '/opt/rustc_codegen_gcc/build/build_sysroot/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/lib/m68k/libgccjit.so': No such file or directory

    So the build system didn't create the symlink to libgccjit.so in the sysroot, I'll have to restart the build again to check where it actually symlinked the file

  3. antoyo commented on Apr 28, 2026

    @antoyo
    Contributor

    Just to make sure, are you attempting to build a cross-compiler or a native rustc for m68k?

  4. techmetx11 commented on Apr 28, 2026

    @techmetx11
    ContributorAuthor

    Cross-compiler for m68k.

  5. antoyo commented on Apr 28, 2026

    @antoyo
    Contributor

    If you follow the instructions without Docker, you are able to get further?

    I would still suggest you change the line I linked above so you see whether the symlink is created before building the sysroot and where it is created.

  6. techmetx11 commented on Apr 28, 2026

    @techmetx11
    ContributorAuthor

    If you follow the instructions without Docker, you are able to get further?

    I would still suggest you change the line I linked above so you see whether the symlink is created before building the sysroot and where it is created.

    Sorry for not responding, I spent a long time building this manually and modified the build system to print where it symlinked:

    Creating symlink to "/gcc/lib/libgccjit.so" at: "build/build_sysroot/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/lib/m68k-unknown-none-elf/libgccjit.so"

    I did a temporary fix by symlinking the m68k-unknown-none-elf directory to m68k

  7. antoyo commented on Apr 28, 2026

    @antoyo
    Contributor

    It seems it's a bug on the side of cg_gcc around here.
    It seems to use m68k instead of m68k-unknown-none-elf.

    I'll try to fix this, but it might take a few days.
    Are you currently blocked on this?

  8. techmetx11 commented on Apr 29, 2026

    @techmetx11
    ContributorAuthor

    It seems it's a bug on the side of cg_gcc around here. It seems to use m68k instead of m68k-unknown-none-elf.

    I'll try to fix this, but it might take a few days. Are you currently blocked on this?

    Not really, I can modify my Dockerfile to work around this issue. But it might be more difficult doing it manually outside of Docker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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