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

Add compilation instructions for RISC-V #9862

Merged
merged 1 commit into from
Sep 7, 2024

Conversation

MBCX
Copy link
Contributor

@MBCX MBCX commented Aug 29, 2024

This adds detailed instructions for how to successfully build 4.x (and possibly 3.x) versions of Godot for this ISA.

While these instructions are more focused on cross-compilation, it should also work on native RISC-V devices.

Solves #91381.

@AThousandShips AThousandShips added enhancement area:contributing Issues and PRs related to the Contributing/Development section of the documentation topic:buildsystem labels Aug 29, 2024
@MBCX MBCX requested review from aaronfranke and DSOE1024 August 30, 2024 16:43
Copy link
Contributor

@DSOE1024 DSOE1024 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@MBCX MBCX force-pushed the riscv-cross-compilation branch from 6eee116 to 7864d01 Compare September 3, 2024 14:35
@MBCX
Copy link
Contributor Author

MBCX commented Sep 3, 2024

Squashed the commits, hopefully all is good now!

Copy link
Member

@aaronfranke aaronfranke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried following these instructions on an Ubuntu 24.04 x86_64 host and it failed at linking: EDIT: 22.04

[Initial build] Compiling core/error/error_list.cpp ...
[Initial build] Compiling core/error/error_macros.cpp ...
[Initial build] progress_finish(["progress_finish"], [])
[Initial build] Generating servers/rendering/renderer_rd/shaders/environment/voxel_gi_sdf.glsl.gen.h ...
[Initial build] Generating servers/rendering/renderer_rd/shaders/giprobe_write.glsl.gen.h ...
[Initial build] Linking Static Library servers/libservers.linuxbsd.editor.rv64.llvm.a ...
Ranlib Library servers/libservers.linuxbsd.editor.rv64.llvm.a ...
[Initial build] Linking Static Library core/libcore.linuxbsd.editor.rv64.llvm.a ...
Ranlib Library core/libcore.linuxbsd.editor.rv64.llvm.a ...
[Initial build] Linking Program bin/godot.linuxbsd.editor.rv64.llvm ...
mold: unknown -m argument: elf64lriscv
clang: error: linker command failed with exit code 1 (use -v to see invocation)
scons: *** [bin/godot.linuxbsd.editor.rv64.llvm] Error 1
scons: building terminated because of errors.
[Time elapsed: 00:02:42.42]

@MBCX
Copy link
Contributor Author

MBCX commented Sep 4, 2024

I tried following these instructions on an Ubuntu 24.04 x86_64 host and it failed at linking:

[Initial build] Compiling core/error/error_list.cpp ...
[Initial build] Compiling core/error/error_macros.cpp ...
[Initial build] progress_finish(["progress_finish"], [])
[Initial build] Generating servers/rendering/renderer_rd/shaders/environment/voxel_gi_sdf.glsl.gen.h ...
[Initial build] Generating servers/rendering/renderer_rd/shaders/giprobe_write.glsl.gen.h ...
[Initial build] Linking Static Library servers/libservers.linuxbsd.editor.rv64.llvm.a ...
Ranlib Library servers/libservers.linuxbsd.editor.rv64.llvm.a ...
[Initial build] Linking Static Library core/libcore.linuxbsd.editor.rv64.llvm.a ...
Ranlib Library core/libcore.linuxbsd.editor.rv64.llvm.a ...
[Initial build] Linking Program bin/godot.linuxbsd.editor.rv64.llvm ...
mold: unknown -m argument: elf64lriscv
clang: error: linker command failed with exit code 1 (use -v to see invocation)
scons: *** [bin/godot.linuxbsd.editor.rv64.llvm] Error 1
scons: building terminated because of errors.
[Time elapsed: 00:02:42.42]

I see elf64lriscv in the mold command, which I will assume you downloaded the wrong toolchain. You have to download the glibc one as I have specifically mention in the documentation.

Direct download to glibc one.

@aaronfranke
Copy link
Member

@MBCX That is the exact file I downloaded. Filename riscv64-glibc-ubuntu-18.04-nightly-2021.12.22-nightly.tar.gz with MD5 hash c529cbebf72e358e9a9ce18afee6f9a4.

@MBCX
Copy link
Contributor Author

MBCX commented Sep 4, 2024

Interesting then. Let me try to compile with the prebuilt and see if I can reproduce it (I compile with a custom-built toolchain).

@MBCX
Copy link
Contributor Author

MBCX commented Sep 4, 2024

@aaronfranke Sadly, I wasn't able to reproduce your issue on my Zorin OS 16.3 laptop (Ubuntu 20.04.3 LTS based) with the same toolchain (18.04 and 20.04). I will set-up a Ubuntu 24.04 VM and try to reproduce it there.

In the meantime, could you try enabling verbose=yes and/or trying the 20.04 version of the toolchain and see if that does it for you?

@MBCX
Copy link
Contributor Author

MBCX commented Sep 4, 2024

Still unable to reproduce on my freshly set-up Ubuntu 24.04 VM (and using the 18.04 toolchain).

image

@DSOE1024
Copy link
Contributor

DSOE1024 commented Sep 5, 2024

仍然无法在我新设置的 Ubuntu 24.04 VM 上重现(并使用工具链)。18.04

image

According to my test, the openKylin 2.0 system can be compiled successfully, which is my compilation step.

https://bbs.openkylin.top/t/topic/171569

Don't forget that you need GCC13

Copy link
Member

@aaronfranke aaronfranke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies, I figured out what was wrong. I thought my desktop was Ubuntu 24.04 but it was actually 22.04, which has too old of a Mold version in its repositories.

A simple change to the documentation will fix this: Add a note for how to check the supported architectures of Mold.

@MBCX MBCX force-pushed the riscv-cross-compilation branch from 49cde51 to 2a85b24 Compare September 5, 2024 15:00
@MBCX MBCX requested a review from aaronfranke September 5, 2024 15:01
Copy link
Member

@aaronfranke aaronfranke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@skyace65 skyace65 merged commit aa297fd into godotengine:master Sep 7, 2024
1 check passed
@skyace65
Copy link
Contributor

skyace65 commented Sep 7, 2024

Thanks! And congrats on your first merged PR!

@MBCX MBCX deleted the riscv-cross-compilation branch September 7, 2024 17:38
@mhilbrunner
Copy link
Member

Cherry-picked to 4.3 in #10038.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:contributing Issues and PRs related to the Contributing/Development section of the documentation enhancement topic:buildsystem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants