Skip to content

Mold error on older pc #73

@SibaldH

Description

@SibaldH

Sup,

Im building my nixos config, and came across the following problem.
my cpu is too old and does not have the flags sse4_2 and avx2.
This way, mold will not work.

But the way this flake is set up, it force uses mold. While it should fall back onto BFD linker.

On rebuilding my config, I get the following error:

Running phase: unpackPhase
@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking source archive /nix/store/x261z6b95lxynmdxs78sma6wk9jlni73-y2pvri00bhv75ay4vam2h623h8rbaznf-source
source root is y2pvri00bhv75ay4vam2h623h8rbaznf-source
Running phase: patchPhase
@nix { "action": "setPhase", "phase": "patchPhase" }
Running phase: updateAutotoolsGnuConfigScriptsPhase
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
Running phase: configurePhase
@nix { "action": "setPhase", "phase": "configurePhase" }
fixing cmake files...
cmake flags: -DCMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY=OFF -DCMAKE_FIND_USE_PACKAGE_REGISTRY=OFF -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TESTING=OFF -DCMAKE_INSTALL_LOCALEDIR=/nix/store/h>
-- The C compiler identification is GNU 15.1.0
-- The CXX compiler identification is GNU 15.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /nix/store/b8zkhsq397qvbrrz0ffaxlx61k0wpgmf-gcc-wrapper-15.1.0/bin/gcc
-- Check for working C compiler: /nix/store/b8zkhsq397qvbrrz0ffaxlx61k0wpgmf-gcc-wrapper-15.1.0/bin/gcc - broken
CMake Error at /nix/store/a3w3ka2d796ghlhf31il839c0658m5ih-cmake-3.31.7/share/cmake-3.31/Modules/CMakeTestCCompiler.cmake:67 (message):
  The C compiler

    "/nix/store/b8zkhsq397qvbrrz0ffaxlx61k0wpgmf-gcc-wrapper-15.1.0/bin/gcc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: '/build/y2pvri00bhv75ay4vam2h623h8rbaznf-source/build/CMakeFiles/CMakeScratch/TryCompile-eJRSes'

    Run Build Command(s): /nix/store/a3w3ka2d796ghlhf31il839c0658m5ih-cmake-3.31.7/bin/cmake -E env VERBOSE=1 /nix/store/dlidjkvgpd8g9fqxjnrvybwlv47j1qjc-gnumake-4.4.1/bin/make -f Makefile cmTC_0e249/fast
    /nix/store/dlidjkvgpd8g9fqxjnrvybwlv47j1qjc-gnumake-4.4.1/bin/make  -f CMakeFiles/cmTC_0e249.dir/build.make CMakeFiles/cmTC_0e249.dir/build
    make[1]: Entering directory '/build/y2pvri00bhv75ay4vam2h623h8rbaznf-source/build/CMakeFiles/CMakeScratch/TryCompile-eJRSes'
    Building C object CMakeFiles/cmTC_0e249.dir/testCCompiler.c.o
    /nix/store/b8zkhsq397qvbrrz0ffaxlx61k0wpgmf-gcc-wrapper-15.1.0/bin/gcc    -o CMakeFiles/cmTC_0e249.dir/testCCompiler.c.o -c /build/y2pvri00bhv75ay4vam2h623h8rbaznf-source/build/CMakeFiles/CMakeScratch/TryCompile-eJRSes/tes>
    Linking C executable cmTC_0e249
    /nix/store/a3w3ka2d796ghlhf31il839c0658m5ih-cmake-3.31.7/bin/cmake -E cmake_link_script CMakeFiles/cmTC_0e249.dir/link.txt --verbose=1
    /nix/store/q41ax77j719mc0ni96fi4qsbfn10bkl2-binutils-wrapper-2.44/bin/ld.mold: line 273:   141 Illegal instruction        (core dumped) /nix/store/3iw14hj9wv43l2vbsgj4skdiwdkj1s6n-mold-2.40.3/bin/ld.mold ${extraBefore+"${e>
    collect2: error: ld returned 132 exit status
    /nix/store/b8zkhsq397qvbrrz0ffaxlx61k0wpgmf-gcc-wrapper-15.1.0/bin/gcc CMakeFiles/cmTC_0e249.dir/testCCompiler.c.o -o cmTC_0e249
    make[1]: *** [CMakeFiles/cmTC_0e249.dir/build.make:102: cmTC_0e249] Error 1
    make[1]: Leaving directory '/build/y2pvri00bhv75ay4vam2h623h8rbaznf-source/build/CMakeFiles/CMakeScratch/TryCompile-eJRSes'
    make: *** [Makefile:134: cmTC_0e249/fast] Error 2





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:7 (project)


-- Configuring incomplete, errors occurred!

I have tried setting env variables to use BFD:
NIX_CFLAGS_LINK = prev.lib.mkForce "-fuse-ld=bfd";
But this does not work, because it is set in the repo itself.
When I check the derivation:

➜ nix derivation show /nix/store/r0na27cccyy6f971d3ydn0rb2kqqlvnb-hyprutils-0.8.2+date=2025-08-06_df6b882.drv | grep NIX_CFLAGS_LINK
      "NIX_CFLAGS_LINK": " -fuse-ld=mold",

Here is my cpuinfo:

processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model       : 23
model name  : Pentium(R) Dual-Core CPU       T4300  @ 2.10GHz
stepping    : 10
microcode   : 0xa0b
cpu MHz     : 2094.762
cache size  : 1024 KB
physical id : 0
siblings    : 2
core id     : 0
cpu cores   : 2
apicid      : 0
initial apicid  : 0
fpu     : yes
fpu_exception   : yes
cpuid level : 13
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good nopl cpuid aperfmperf pni dte s64 monitor ds_cpl est tm2 ssse3 cx16 xtpr pdcm xsave lahf_lm pti dtherm
bugs        : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit spectre_v2_user
bogomips    : 4189.50
clflush size    : 64
cache_alignment : 64
address sizes   : 36 bits physical, 48 bits virtual
power management:

processor   : 1
vendor_id   : GenuineIntel
cpu family  : 6
model       : 23
model name  : Pentium(R) Dual-Core CPU       T4300  @ 2.10GHz
stepping    : 10
microcode   : 0xa0b
cpu MHz     : 2094.752
cache size  : 1024 KB
physical id : 0
siblings    : 2
core id     : 1
cpu cores   : 2
apicid      : 1
initial apicid  : 1
fpu     : yes
fpu_exception   : yes
cpuid level : 13
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good nopl cpuid aperfmperf pni dte
s64 monitor ds_cpl est tm2 ssse3 cx16 xtpr pdcm xsave lahf_lm pti dtherm
bugs        : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit spectre_v2_user
bogomips    : 4189.50
clflush size    : 64
cache_alignment : 64
address sizes   : 36 bits physical, 48 bits virtual
power management:

My current nixos-flake with hyprland: https://github.com/SibaldH/nixos/tree/hyprland

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions