Mold (#14)
All checks were successful
Conan Packaging / Package cli11/2.6.1 (push) Successful in 26s
Conan Packaging / Package eabase/01082025 (push) Successful in 19s
Conan Packaging / Package flatbuffers/25.12.19 (push) Successful in 43s
Conan Packaging / Package meshoptimizer/1.0 (push) Successful in 19s
Conan Packaging / Package mold/2.41.0 (push) Successful in 4m35s
Conan Packaging / Package rapidhash/3.0 (push) Successful in 20s
Conan Packaging / Package spirv-cross/1.4.341.0 (push) Successful in 56s
Conan Packaging / Package stduuid/1.2.3 (push) Successful in 20s
Conan Packaging / Package vulkan-headers/1.4.341.0 (push) Successful in 20s
Conan Packaging / Package eastl/3.27.01 (push) Successful in 20s
Conan Packaging / Package spirv-tools/1.4.341.0 (push) Successful in 2m8s
Conan Packaging / Package vulkan-memory-allocator/3.3.0 (push) Successful in 23s
Conan Packaging / Package vulkan-utility-libraries/1.4.341.0 (push) Successful in 22s
Conan Packaging / Package assimp/6.0.4 (push) Successful in 1m59s
Conan Packaging / Package imgui/1.92.6-docking (push) Successful in 27s
Conan Packaging / Package lodepng/cci.20260210 (push) Successful in 20s
Conan Packaging / Package mimalloc/3.3.1 (push) Successful in 22s
Conan Packaging / Package pixelmatch-cpp17/1.0.3 (push) Successful in 23s
Conan Packaging / Package spirv-headers/1.4.341.0 (push) Successful in 19s
Conan Packaging / Package sqlite3/3.51.2 (push) Successful in 39s
Conan Packaging / Package unordered_dense/4.8.1 (push) Successful in 19s
Conan Packaging / Package glslang/1.4.341.0 (push) Successful in 2m29s
Conan Packaging / Package vulkan-validationlayers/1.4.341.0 (push) Successful in 5m43s
Conan Packaging / Package shaderc/2026.1 (push) Successful in 2m51s

Reviewed-on: #14
Co-authored-by: Romain BOULLARD <romain.boullard@protonmail.com>
Co-committed-by: Romain BOULLARD <romain.boullard@protonmail.com>
This commit was merged in pull request #14.
This commit is contained in:
2026-04-26 14:44:55 +00:00
committed by Romain BOULLARD
parent e326415f12
commit f2685edfd5
11 changed files with 266 additions and 9 deletions

View File

@@ -10,7 +10,6 @@ env:
CCACHE_DIR: /ccache CCACHE_DIR: /ccache
CCACHE_MAXSIZE: 10G CCACHE_MAXSIZE: 10G
CCACHE_BASEDIR: /root/.conan2 CCACHE_BASEDIR: /root/.conan2
CCACHE_NOHASHDIR: "true"
CCACHE_COMPILERCHECK: "%compiler% -dumpversion" CCACHE_COMPILERCHECK: "%compiler% -dumpversion"
jobs: jobs:
@@ -25,6 +24,8 @@ jobs:
strategy: strategy:
matrix: matrix:
package: [ package: [
{ name: "mold", version: "2.41.0", location: "all" },
{ name: "eabase", version: "01082025", location: "all" }, { name: "eabase", version: "01082025", location: "all" },
{ name: "vulkan-headers", version: "1.4.341.0", location: "all" }, { name: "vulkan-headers", version: "1.4.341.0", location: "all" },
@@ -37,7 +38,7 @@ jobs:
{ name: "flatbuffers", version: "25.12.19", location: "all" }, { name: "flatbuffers", version: "25.12.19", location: "all" },
{ name: "unordered_dense", version: "4.8.1", location: "all" }, { name: "unordered_dense", version: "4.8.1", location: "all" },
{ name: "mimalloc", version: "3.2.8", location: "all" }, { name: "mimalloc", version: "3.3.1", location: "all" },
{ name: "meshoptimizer", version: "1.0", location: "all" }, { name: "meshoptimizer", version: "1.0", location: "all" },
{ name: "sqlite3", version: "3.51.2", location: "all" }, { name: "sqlite3", version: "3.51.2", location: "all" },
{ name: "rapidhash", version: "3.0", location: "all" }, { name: "rapidhash", version: "3.0", location: "all" },

View File

@@ -17,12 +17,10 @@ tools.meson.mesontoolchain:extra_machine_files+={{profile_dir}}/Toolchains/ipo.i
tools.system.package_manager:mode=install tools.system.package_manager:mode=install
tools.system.package_manager:sudo=True tools.system.package_manager:sudo=True
tools.build:exelinkflags=["-fuse-ld=mold"]
tools.build:sharedlinkflags=["-fuse-ld=mold"]
tools.build:compiler_executables={"c": "clang", "cpp": "clang++"} tools.build:compiler_executables={"c": "clang", "cpp": "clang++"}
tools.cmake.cmaketoolchain:generator=Ninja
[tool_requires] [tool_requires]
!cmake/*: cmake/[>=4.2] !cmake/*: cmake/[>=4.2]
[buildenv]
CCACHE_NOHASHDIR=1

View File

@@ -17,4 +17,7 @@ tools.build:cflags=["/Zc:preprocessor", "/Zc:__STDC__", "/D_CRT_DECLARE_NONSTDC_
tools.build:cxxflags=["/Zc:preprocessor", "/permissive-", "/Zc:__cplusplus", "/Zc:enumTypes", "/Zc:templateScope"] tools.build:cxxflags=["/Zc:preprocessor", "/permissive-", "/Zc:__cplusplus", "/Zc:enumTypes", "/Zc:templateScope"]
[tool_requires] [tool_requires]
!cmake/*: cmake/[>=4.2] !cmake/*: cmake/[>=4.2]
[buildenv]
CCACHE_NOHASHDIR=1

View File

@@ -1,4 +1,7 @@
sources: sources:
"3.3.1":
url: "https://github.com/microsoft/mimalloc/archive/v3.3.1.tar.gz"
sha256: "42c16914168ac6741eeb407e83b93a12b2b7ee25a7e14e6b4807fab8b577a540"
"3.2.8": "3.2.8":
url: "https://github.com/microsoft/mimalloc/archive/v3.2.8.tar.gz" url: "https://github.com/microsoft/mimalloc/archive/v3.2.8.tar.gz"
sha256: "68163666575518c213a6593850099adce3863b340ca2751103dbd1f253664e05" sha256: "68163666575518c213a6593850099adce3863b340ca2751103dbd1f253664e05"

View File

@@ -1,4 +1,6 @@
versions: versions:
"3.3.1":
folder: all
"3.2.8": "3.2.8":
folder: all folder: all
"3.1.5": "3.1.5":

22
mold/README.md Normal file
View File

@@ -0,0 +1,22 @@
# mold: A Modern Linker
mold is a faster drop-in replacement for existing Unix linkers. It is several
times quicker than the LLVM lld linker, the second-fastest open-source linker.
mold aims to enhance developer productivity by minimizing build time,
particularly in rapid debug-edit-rebuild cycles.
You can configure Conan to download the latest version of `mold` and use it as the linker
when building your dependencies and projects from source. Currently only supported
when targeting Linux as the platform.
To use mold automatically as the linker, you can add the following section to your
_host_ profile that targets Linux. When using gcc, please note that the following
flags require gcc 12.1 or greater.
```
[tool_requires]
*:mold/[*]
[conf]
tools.build:exelinkflags=['-fuse-ld=mold']
tools.build:sharedlinkflags=['-fuse-ld=mold']
```

39
mold/all/conandata.yml Normal file
View File

@@ -0,0 +1,39 @@
sources:
"2.41.0":
url: "https://github.com/rui314/mold/archive/refs/tags/v2.41.0.tar.gz"
sha256: "0a61abac85d818437b425df856822e9d6e9982baeae5a93bcb02fe6c0060c61a"
"2.40.1":
url: "https://github.com/rui314/mold/archive/refs/tags/v2.40.1.tar.gz"
sha256: "d1ce09a69941f8158604c3edcc96c7178231e7dba2da66b20f5ef6e112c443b7"
"2.36.0":
url: "https://github.com/rui314/mold/archive/refs/tags/v2.36.0.tar.gz"
sha256: "3f57fe75535500ecce7a80fa1ba33675830b7d7deb1e5ee9a737e2bc43cdb1c7"
"2.34.1":
url: "https://github.com/rui314/mold/archive/refs/tags/v2.34.1.tar.gz"
sha256: "a8cf638045b4a4b2697d0bcc77fd96eae93d54d57ad3021bf03b0333a727a59d"
"2.33.0":
url: "https://github.com/rui314/mold/archive/refs/tags/v2.33.0.tar.gz"
sha256: "37b3aacbd9b6accf581b92ba1a98ca418672ae330b78fe56ae542c2dcb10a155"
"2.32.1":
url: "https://github.com/rui314/mold/archive/refs/tags/v2.32.1.tar.gz"
sha256: "f3c9a527d884c635834fe7d79b3de959b00783bf9446280ea274d996f0335825"
"2.32.0":
url: "https://github.com/rui314/mold/archive/refs/tags/v2.32.0.tar.gz"
sha256: "4b7e4146ea0f52be9adae8b417399f3676a041e65b55e3f25f088120d30a320b"
"2.31.0":
url: "https://github.com/rui314/mold/archive/refs/tags/v2.31.0.tar.gz"
sha256: "3dc3af83a5d22a4b29971bfad17261851d426961c665480e2ca294e5c74aa1e5"
"2.4.0":
url: "https://github.com/rui314/mold/archive/refs/tags/v2.4.0.tar.gz"
sha256: "be65f3d785d32ece7b3204ecaa57810847fdd25c232cf704cbfff2dafb1ac107"
"2.0.0":
url: "https://github.com/rui314/mold/archive/refs/tags/v2.0.0.tar.gz"
sha256: "2ae8a22db09cbff626df74c945079fa29c1e5f60bbe02502dcf69191cf43527b"
"1.11.0":
url: "https://github.com/rui314/mold/archive/refs/tags/v1.11.0.tar.gz"
sha256: "99318eced81b09a77e4c657011076cc8ec3d4b6867bd324b8677974545bc4d6f"
patches:
"2.40.1":
- patch_file: "patches/2.40.1/0001-patch-enforce-c-11-for-tbb.patch"
patch_description: "Fix bundled oneTBB build by enforcing C++11 standard"
patch_type: "conan"

125
mold/all/conanfile.py Normal file
View File

@@ -0,0 +1,125 @@
import os
from conan import ConanFile
from conan.tools.build import check_min_cppstd
from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps
from conan.tools.files import copy, get, rmdir, apply_conandata_patches, export_conandata_patches
from conan.errors import ConanInvalidConfiguration
from conan.tools.scm import Version
from conan.tools.env import VirtualBuildEnv
required_conan_version = ">2.0"
class MoldConan(ConanFile):
name = "mold"
description = (
"mold is a faster drop-in replacement for existing Unix linkers. "
"It is several times faster than the LLVM lld linker."
)
license = ("AGPL-3.0", "MIT")
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/rui314/mold/"
topics = ("ld", "linkage", "compilation", "pre-built")
package_type = "application"
settings = "os", "arch", "compiler", "build_type"
options = {
"with_mimalloc": [True, False],
}
default_options = {
"with_mimalloc": False,
}
def configure(self):
if Version(self.version) < "2.0.0":
self.license = "AGPL-3.0"
else:
self.license = "MIT"
def layout(self):
cmake_layout(self, src_folder="src")
def requirements(self):
self.requires("zlib/[>=1.2.11 <2]")
self.requires("xxhash/0.8.2")
if self.options.with_mimalloc:
self.requires("mimalloc/3.3.1")
if Version(self.version) < "2.2.0":
# Newer versions use vendored-in BLAKE3
self.requires("openssl/[>=1.1 <4]")
def package_id(self):
del self.info.settings.compiler
def validate_build(self):
# perform these checks in validate_build() - since the compiler is removed from the package_id,
# this lets the compatibility plugin consider the executable built with other compilers
if Version(self.version) >= "2.34.0":
# mold has required C+20 since 1.4.1. However, C++20 features are used for the first time in 2.34.0.
check_min_cppstd(self, 20)
if self.settings.compiler in ["gcc", "clang", "intel-cc"] and self.settings.compiler.libcxx != "libstdc++11":
raise ConanInvalidConfiguration('Mold can only be built with libstdc++11; specify mold:compiler.libcxx=libstdc++11 in your build profile')
if self.settings.compiler == "msvc":
raise ConanInvalidConfiguration(f'{self.name} can not be built on {self.settings.os}.')
if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "10":
raise ConanInvalidConfiguration("GCC version 10 or higher required")
if self.settings.compiler in ('clang', 'apple-clang') and Version(self.settings.compiler.version) < "12":
raise ConanInvalidConfiguration("Clang version 12 or higher required")
if Version(self.version) >= "2.34.0" and self.settings.compiler == "apple-clang" and Version(self.settings.compiler.version) < "14":
raise ConanInvalidConfiguration("Apple-Clang version 14 or higher required due to C++20 features")
if self.settings.compiler == "apple-clang" and "armv8" == self.settings.arch :
raise ConanInvalidConfiguration(f'{self.name} is still not supported by Mac M1.')
if Version(self.version) == "2.33.0" and self.settings.compiler == "apple-clang" and Version(self.settings.compiler.version) < "14":
raise ConanInvalidConfiguration(f'{self.ref} doesn\'t support Apple-Clang < 14.')
def build_requirements(self):
self.tool_requires("cmake/[>=3.18.0 <4]")
def export_sources(self):
export_conandata_patches(self)
def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
apply_conandata_patches(self)
def generate(self):
tc = CMakeToolchain(self)
tc.variables["MOLD_USE_MIMALLOC"] = self.options.with_mimalloc
tc.variables["MOLD_USE_SYSTEM_MIMALLOC"] = True
tc.variables["MOLD_USE_SYSTEM_TBB"] = False # see https://github.com/conan-io/conan-center-index/pull/23575#issuecomment-2059154281
tc.variables["CMAKE_INSTALL_LIBEXECDIR"] = "libexec"
tc.generate()
cd = CMakeDeps(self)
cd.generate()
vbe = VirtualBuildEnv(self)
vbe.generate()
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def package(self):
cmake = CMake(self)
cmake.install()
copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
rmdir(self, os.path.join(self.package_folder, "share"))
def package_info(self):
self.cpp_info.includedirs = []
self.cpp_info.libdirs = []
self.cpp_info.frameworkdirs = []
self.cpp_info.resdirs = []
if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.system_libs = ["m", "pthread", "dl"]
bindir = os.path.join(self.package_folder, "bin")
mold_executable = os.path.join(bindir, "mold")
self.conf_info.define("user.mold:path", mold_executable)
self.buildenv_info.define_path("MOLD_ROOT", bindir)
self.buildenv_info.define("LD", mold_executable)

View File

@@ -0,0 +1,28 @@
From 2f29fc752620180d88e82792adb2ff8a1d886bd1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tim=20Friedrich=20Br=C3=BCggemann?=
<tim.brueggemann@dampsoft.de>
Date: Tue, 17 Jun 2025 09:48:43 +0200
Subject: [PATCH] patch: Enforce C++11 for TBB
---
third-party/tbb/CMakeLists.txt | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/third-party/tbb/CMakeLists.txt b/third-party/tbb/CMakeLists.txt
index 12273b3e..21c4e2ef 100644
--- a/third-party/tbb/CMakeLists.txt
+++ b/third-party/tbb/CMakeLists.txt
@@ -77,9 +77,7 @@ include(CMakeDependentOption)
# ---------------------------------------------------------------------------------------------------------
# Handle C++ standard version.
if (NOT MSVC) # no need to cover MSVC as it uses C++14 by default.
- if (NOT CMAKE_CXX_STANDARD)
- set(CMAKE_CXX_STANDARD 11)
- endif()
+ set(CMAKE_CXX_STANDARD 11)
if (CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION) # if standard option was detected by CMake
set(CMAKE_CXX_STANDARD_REQUIRED ON)
--
2.25.1

View File

@@ -0,0 +1,13 @@
from conan import ConanFile
from conan.tools.build import can_run
class MoldTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
def requirements(self):
self.requires(self.tested_reference_str)
def test(self):
if can_run(self):
self.run("mold -v", env="conanrun")

23
mold/config.yml Normal file
View File

@@ -0,0 +1,23 @@
versions:
"2.41.0":
folder: all
"2.40.1":
folder: all
"2.36.0":
folder: all
"2.34.1":
folder: all
"2.33.0":
folder: all
"2.32.1":
folder: all
"2.32.0":
folder: all
"2.31.0":
folder: all
"2.4.0":
folder: all
"2.0.0":
folder: all
"1.11.0":
folder: all