Skip to content

keystone: fix build with cmake 4 & gcc15 - #450265

Merged
leona-ya merged 2 commits into
NixOS:masterfrom
Ambossmann:keystone
Oct 11, 2025
Merged

keystone: fix build with cmake 4 & gcc15#450265
leona-ya merged 2 commits into
NixOS:masterfrom
Ambossmann:keystone

Conversation

@Ambossmann

Copy link
Copy Markdown
Contributor

Things done

Fixes #449493

Adds two patches from keystone-engine/keystone#593 to fix building with cmake 4 and gcc15.

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. labels Oct 9, 2025
@nixpkgs-ci nixpkgs-ci Bot added the 12.approvals: 1 This PR was reviewed and approved by one person. label Oct 9, 2025
@SuperSandroBot

Copy link
Copy Markdown

nixpkgs-review result

Generated using nixpkgs-review-gha

Command: nixpkgs-review pr 450265
Commit: 0b1b0f2e9d5c7af9032d5626dc1cca2b95eb11f2 (subsequent changes)
Merge: 6a833fc1a029a6f2646386b9eb2432cbf2ee2a53

Logs: https://github.com/SuperSandro2000/nixpkgs-review-gha/actions/runs/18376922479


x86_64-linux

✅ 11 packages built:
  • clps2c-compiler
  • edl
  • edl.dist
  • gef
  • haskellPackages.heystone
  • haskellPackages.heystone.doc
  • keystone
  • python312Packages.keystone-engine
  • python312Packages.keystone-engine.dist
  • python313Packages.keystone-engine
  • python313Packages.keystone-engine.dist

aarch64-linux

✅ 11 packages built:
  • clps2c-compiler
  • edl
  • edl.dist
  • gef
  • haskellPackages.heystone
  • haskellPackages.heystone.doc
  • keystone
  • python312Packages.keystone-engine
  • python312Packages.keystone-engine.dist
  • python313Packages.keystone-engine
  • python313Packages.keystone-engine.dist

x86_64-darwin (sandbox = true)

❌ 6 packages failed to build:
  • clps2c-compiler
  • gef
  • haskellPackages.heystone
  • haskellPackages.heystone.doc
  • python313Packages.keystone-engine
  • python313Packages.keystone-engine.dist
✅ 3 packages built:
  • keystone
  • python312Packages.keystone-engine
  • python312Packages.keystone-engine.dist

Error logs: `x86_64-darwin`
haskellPackages.heystone
@nix { "action": "setPhase", "phase": "setupCompilerEnvironmentPhase" }
Build with /nix/store/j02vrdkdm50c434abghb69vayndm6s13-ghc-9.10.3.
Running phase: unpackPhase
@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking source archive /nix/store/nhpzc87a81mj6k32kqzw613rz0av2fb2-heystone-0.1.0.tar.gz
source root is heystone-0.1.0
setting SOURCE_DATE_EPOCH to timestamp 1000000000 of file "heystone-0.1.0/src/Heystone/Internal/Util.hs"
Running phase: patchPhase
@nix { "action": "setPhase", "phase": "patchPhase" }
Run jailbreak-cabal to lift version restrictions on build inputs.
Running phase: compileBuildDriverPhase
@nix { "action": "setPhase", "phase": "compileBuildDriverPhase" }
setupCompileFlags: -package-db=/nix/build/nix-23433-2732406384/tmp.dk0ULPaxhb/setup-package.conf.d -threaded
[1 of 2] Compiling Main             ( Setup.hs, /nix/build/nix-23433-2732406384/tmp.dk0ULPaxhb/Main.o )
[2 of 2] Linking Setup
Running phase: configurePhase
@nix { "action": "setPhase", "phase": "configurePhase" }
configureFlags: --verbose --prefix=/nix/store/y23psgygvjz0mj2skbz30qhqr7v39aa0-heystone-0.1.0 --libdir=$prefix/lib/$compiler/lib --libsubdir=$abi/$libname --docdir=/nix/store/848gfjd51gnh42y7pw6qsrmda4zc62b5-heystone-0.1.0-doc/share/doc/heystone-0.1.0 --with-gcc=clang --package-db=/nix/build/nix-23433-2732406384/tmp.dk0ULPaxhb/package.conf.d --ghc-option=-j3 --ghc-option=+RTS --ghc-option=-A64M --ghc-option=-RTS --enable-library-profiling --profiling-detail=exported-functions --disable-profiling --enable-shared --disable-coverage --enable-static --disable-executable-dynamic --enable-tests --disable-benchmarks --enable-library-vanilla --disable-library-for-ghci --disable-split-sections --enable-library-stripping --enable-executable-stripping --ghc-option=-haddock --extra-lib-dirs=/nix/store/5x83y6qzlmgwiii8hga5522df4ibjzvi-ncurses-6.5/lib --extra-lib-dirs=/nix/store/0xsp4slb5x1g35pnypvzyff9h5672jbr-libffi-39/lib --extra-lib-dirs=/nix/store/w2f81k7jvsr7l8vzgynfxi7b0mgcd7pn-gmp-with-cxx-6.3.0/lib --extra-lib-dirs=/nix/store/9digjvqvhpnkhg8bc1d7k86g8bqymp2p-libiconv-109/lib --extra-include-dirs=/nix/store/b4fhdw54iry97k2cx758xmmjmawmwbhv-libcxx-19.1.2+apple-sdk-15.5/include --extra-lib-dirs=/nix/store/b4fhdw54iry97k2cx758xmmjmawmwbhv-libcxx-19.1.2+apple-sdk-15.5/lib --extra-include-dirs=/nix/store/r844100ks1fbdp29xddn55qjbxqfj766-compiler-rt-libc-21.1.1-dev/include --extra-lib-dirs=/nix/store/mm1vjj1v01rd3jx54c9l8f3glnji0yrg-compiler-rt-libc-21.1.1/lib --extra-include-dirs=/nix/store/c4y02k63m09957mlf1a5jkmzx8y691fz-keystone-0.9.2/include --extra-lib-dirs=/nix/store/c4y02k63m09957mlf1a5jkmzx8y691fz-keystone-0.9.2/lib --extra-include-dirs=/nix/store/c1m5b901gfsqv907szn6h3yw4b5al4gv-libiconv-109-dev/include --extra-lib-dirs=/nix/store/9digjvqvhpnkhg8bc1d7k86g8bqymp2p-libiconv-109/lib --extra-include-dirs=/nix/store/p9wfgkrqiy1bshd6rh1llh0j4km64v9s-libresolv-83-dev/include --extra-lib-dirs=/nix/store/b8cny9ng6himysxgzs78gy0mf7gj8jgr-libresolv-83/lib --extra-include-dirs=/nix/store/i0jjki1ml5hjkhvy6fmgkh8w1zzdfj35-libsbuf-14.1.0-dev/include --extra-lib-dirs=/nix/store/0lchn4clfvilgh16pfr3wzdnahfq1sfl-libsbuf-14.1.0/lib --extra-lib-dirs=/nix/store/s96w2qxif339rlcfdpsb4d2arrg1zk12-libutil-72/lib --extra-include-dirs=/nix/store/g3x8a95js4r78a2wi8djab19piy1ndci-cups-headers-2.4.14/include --extra-lib-dirs=/nix/store/dc5nw6xfzaj5m8mlgrd94wqfzkwz6jch-Csu-88/lib
Using Parsec parser
Configuring heystone-0.1.0...
python313Packages.keystone-engine
adding 'keystone_engine-0.9.2.dist-info/WHEEL'
adding 'keystone_engine-0.9.2.dist-info/top_level.txt'
adding 'keystone_engine-0.9.2.dist-info/zip-safe'
adding 'keystone_engine-0.9.2.dist-info/RECORD'
removing build/bdist.macosx-11.3-x86_64/wheel
Finished executing setuptoolsBuildPhase
Running phase: installPhase
@nix { "action": "setPhase", "phase": "installPhase" }
Executing pypaInstallPhase
Successfully installed keystone_engine-0.9.2-py2.py3-none-macosx_11_3_x86_64.whl
Finished executing pypaInstallPhase
Running phase: pythonOutputDistPhase
@nix { "action": "setPhase", "phase": "pythonOutputDistPhase" }
Executing pythonOutputDistPhase
Finished executing pythonOutputDistPhase
Running phase: fixupPhase
@nix { "action": "setPhase", "phase": "fixupPhase" }
checking for references to /nix/build/nix-23433-2732406386/ in /nix/store/ib8s3ka4dfigpxxxb19l9q4ar5p622l3-python3.13-keystone-engine-0.9.2...
patching script interpreter paths in /nix/store/ib8s3ka4dfigpxxxb19l9q4ar5p622l3-python3.13-keystone-engine-0.9.2
stripping (with command strip and flags -S) in  /nix/store/ib8s3ka4dfigpxxxb19l9q4ar5p622l3-python3.13-keystone-engine-0.9.2/lib

aarch64-darwin (sandbox = true)

❌ 9 packages failed to build:
  • clps2c-compiler
  • gef
  • haskellPackages.heystone
  • haskellPackages.heystone.doc
  • keystone
  • python312Packages.keystone-engine
  • python312Packages.keystone-engine.dist
  • python313Packages.keystone-engine
  • python313Packages.keystone-engine.dist

Error logs: `aarch64-darwin`
keystone
-- Looking for mktemp - found
-- Looking for closedir
-- Looking for closedir - found
-- Looking for opendir
-- Looking for opendir - found
-- Looking for readdir
-- Looking for readdir - found
-- Looking for getcwd
-- Looking for getcwd - found
-- Looking for gettimeofday
-- Looking for gettimeofday - found
-- Looking for getrlimit
-- Looking for getrlimit - found
-- Looking for posix_spawn
-- Looking for posix_spawn - found
-- Looking for pread
-- Looking for pread - found
-- Looking for realpath
-- Looking for realpath - found
-- Looking for sbrk

@Ambossmann

Copy link
Copy Markdown
Contributor Author

The build errors on darwin seem to be caused by issues with the sandbox in other packages, based on these lines in the log:

  • x86_64-darwin:
error: derivation '/nix/store/04nmknfyw1mjr8kyn9b35hc99ccz6rb5-CLPS2C-Compiler-1.0.1.drv' specifies a sandbox profile, but this is only allowed when 'sandbox' is 'relaxed'
  • aarch64-darwin:
error: derivation '/nix/store/n6azv6a3ih408illpw6b04vw792ha6k7-dotnet-stage0-vmr-8.0.20.drv' specifies a sandbox profile, but this is only allowed when 'sandbox' is 'relaxed'

It looks like all builds are aborted once this occurs, which then results in nixpkgs-review reporting them as failed.

@leona-ya
leona-ya added this pull request to the merge queue Oct 11, 2025
Merged via the queue into NixOS:master with commit 31f65e7 Oct 11, 2025
30 of 32 checks passed
imheresamir pushed a commit to imheresamir/keystone that referenced this pull request Apr 29, 2026
imheresamir pushed a commit to imheresamir/keystone that referenced this pull request Apr 29, 2026
amaanq pushed a commit to keystone-engine/keystone that referenced this pull request Jul 18, 2026
* Support building with CMake 4

Adapted from NixOS/nixpkgs#450265

* Support building with GCC 15

Adapted from NixOS/nixpkgs#450265

* Fix building with MSVC

* RISCV: Add RegSize/Alignment fields to RISCVGenRegisterInfo.inc initializers

Keystone's MCRegisterClass retains the RegSize and Alignment fields from
the LLVM 4.0 era, before they were moved to TargetRegisterInfo in LLVM 5.0
(D31783) and eventually removed from MCRegisterClass entirely in LLVM 7.0
(rL339350).

The RISCV backend was ported from a newer LLVM snapshot where these fields
no longer existed, so RISCVGenRegisterInfo.inc was generated without them,
causing a member count mismatch against keystone's MCRegisterClass definition
and a compile error on MSVC (C3852).

Add the missing RegSize and Alignment values to each register class
initializer to match the layout expected by MCRegisterClass. The values
chosen reflect the natural register width of each class (4 bytes for FPR32,
8 bytes for all others). These fields are structurally required to satisfy
the initializer but are never consulted by the assembler — spill slot
calculations belong to the codegen layer which keystone does not include.

All other architectures in keystone were ported from pre-LLVM-5.0 and have
correct initializers. This change makes RISCV consistent with them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build failure: keystone

4 participants