Skip to content

Add x64-linux triplets and toolchains - #127

Open
LelandJin wants to merge 3 commits into
carbonengine:mainfrom
LelandJin:x64-linux-support
Open

Add x64-linux triplets and toolchains#127
LelandJin wants to merge 3 commits into
carbonengine:mainfrom
LelandJin:x64-linux-support

Conversation

@LelandJin

Copy link
Copy Markdown

Summary

Adds x64-linux support to the registry, mirroring the existing macOS/Windows structure:

  • Triplets: x64-linux-debug, x64-linux-internal, x64-linux-release, x64-linux-trinitydev — identical to their x64-osx counterparts (dynamic CRT/library linkage, VCPKG_BUILD_TYPE release, per-port static-linkage overrides), with VCPKG_CMAKE_SYSTEM_NAME Linux and no Apple-specific variables.
  • Toolchains: x64-linux-carbon.cmake (C++17, PIC, hidden visibility, IPO, CCP_PLATFORM=Linux, the shared warning set, and MATH_OPTIMIZE_FLAG with a GCC branch — GCC has no -fhonor-infinities/-fhonor-nans, so it uses -ffast-math -fno-finite-math-only to keep Inf/NaN honored like the Clang platforms) and x64-linux-triplet.cmake (chainload shim including vcpkg's linux.cmake).

This is a companion to the carbon core PR that adds x64-linux CMake presets and a POSIX port of the platform-specific code.

Validation

Used to configure, build, and test carbon core on Fedora Linux 43 (WSL2, GCC 15.2.1) via the new x64-linux-debug preset; all 20 dependencies (tracy, gtest, lz4, python3 host tools and their transitive deps) build with these triplets, and core's full gtest suite passes (184/184).

Note for CI environments: vcpkg's bundled patchelf 0.15.5 corrupted the ELF DT_INIT entry of dynamic libraries produced by newer binutils during RPATH adjustment (loader crash in call_init on dlopen, observed with libffi/liblzma). Building with patchelf ≥ 0.18 resolves it; this may be worth pinning when Linux CI is set up.

Mirror the x64-osx structure for Linux: dynamic linkage with the same per-port static overrides, a carbon toolchain (C++17, PIC, hidden visibility, IPO, shared warning set) with a GCC-compatible MATH_OPTIMIZE_FLAG branch, and a chainload shim that includes vcpkg's linux.cmake.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3aee2f4e9e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread triplets/x64-linux-debug.cmake
Comment thread toolchains/x64-linux-carbon.cmake
…default

Extend carbon-core's supports expression with (linux & x64) now that the port is validated there. Remove the global IPO default from the Linux toolchain: Clang's -flto requires an LLVM-aware linker (lld/LLVMgold) and a toolchain-wide default fails configure-time compiler checks on plain binutils setups; consuming projects can still opt in. The carbon umbrella port is left unchanged since most of its components have no Linux port yet.
@sverrirsccp

Copy link
Copy Markdown
Contributor

Hey LelandJin - thanks a lot for your contribution!

I work at Fenris Creations and wanted to let you know that we've acknowledged your PR. We'll take a proper look at it as soon as we can and really appreciate you taking the time to contribute.

@TrueBrain

Copy link
Copy Markdown

Ha, so I am not the only weirdo that wants Linux support :D

If you are interested, I have this and even more patches and fixes for Linux here: https://github.com/TrueBrain/carbonengine-linux/ . Might avoid you walking into the same pitfalls I did :)

You have a nicer way of dealing with clang/gcc; I am going to borrow that :)

@CCP-Aporia CCP-Aporia left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hi @LelandJin ,

thank you for this interesting PR, there are some good bits in here. See the inline comments for requested changes.

Please take note that we are still in the process of sorting out specifics around accepting contributions. So even with those requested changes, the PR may sit here for a while longer.

Comment thread ports/carbon-core/vcpkg.json
Comment thread toolchains/x64-linux-carbon.cmake Outdated
…rts change

Restore CMAKE_INTERPROCEDURAL_OPTIMIZATION ON to match the other platforms; with Clang this requires an LLVM-aware linker (lld or LLVMgold) in the build environment. The carbon-core supports update moves to a separate PR to avoid a circular dependency with carbonengine/core#31.
@LelandJin

Copy link
Copy Markdown
Author

Thanks for the review @CCP-Aporia! Both points are addressed: the carbon-core supports change moved to #129 to break the circular dependency, and IPO is back on for Linux with the linker requirement documented. No rush on the contribution-process side — happy to keep this in sync with main in the meantime.

@ccpgames-carbon

ccpgames-carbon commented Jul 20, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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.

5 participants