This extension contains various components of the Rust stable toolchain.
In order to use the (fast) mold
linker:
- Add
org.freedesktop.Sdk.Extension.llvm16
along with this extension in order to getclang
. - Add
/usr/lib/sdk/llvm16/bin
toappend-path
. See llvm16 SDK extension readme for more information. - Set environment variables:
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER
toclang
, andCARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS
to-C link-arg=-fuse-ld=/usr/lib/sdk/rust-stable/bin/mold
.
In total, the changed parts of your flatpak manifest should look like this:
{
"sdk-extensions": [
"org.freedesktop.Sdk.Extension.rust-stable",
"org.freedesktop.Sdk.Extension.llvm16"
],
"build-options": {
"append-path": "/usr/lib/sdk/rust-stable/bin:/usr/lib/sdk/llvm16/bin",
"env": {
"CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER": "clang",
"CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS": "-C link-arg=-fuse-ld=/usr/lib/sdk/rust-stable/bin/mold",
"CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER": "clang",
"CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUSTFLAGS": "-C link-arg=-fuse-ld=/usr/lib/sdk/rust-stable/bin/mold"
}
}
}
Note: llvm16
is needed until there is a release of gcc12.1
.
As soon as gcc12.1
is in the freedesktop sdk, gcc
can be used instead of clang
.
In order to use this extension in flatpak SDK environment you may add all provided tools in your PATH by executing first:
source /usr/lib/sdk/rust-stable/enable.sh
You can also combine this extension with lldb
using the LLVM SDK extension. See the extension's readme for more information.