NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.14k stars 13.42k forks source link

Build failure: z3-4.8.5 #326120

Open cmovcc opened 1 month ago

cmovcc commented 1 month ago

Steps To Reproduce

Steps to reproduce the behavior:

  1. build z3.4.8.5 using nixos-unstable

Build log

nix build .#z3_4_8_5

z3> Traceback (most recent call last):
z3>   File "/build/source/scripts/mk_make.py", line 9, in <module>
z3>     from mk_util import *
z3>   File "/build/source/scripts/mk_util.py", line 18, in <module>
z3>     import distutils.sysconfig
z3> ModuleNotFoundError: No module named 'distutils'
error: builder for '/nix/store/rksx05p231nvzb0icz3hf6fb8hxhik2b-z3-4.8.5.drv' failed with exit code 1;
       last 10 log lines:
       > /build/source/scripts/mk_genfile_common.py:764: SyntaxWarning: invalid escape sequence '\('
       >   initializer_prio_pat = re.compile('[ \t]*ADD_INITIALIZER\(\'([^\']*)\',[ \t]*(-?[0-9]*)\)')
       > /build/source/scripts/mk_genfile_common.py:765: SyntaxWarning: invalid escape sequence '\('
       >   finalizer_pat        = re.compile('[ \t]*ADD_FINALIZER\(\'([^\']*)\'\)')
       > Traceback (most recent call last):
       >   File "/build/source/scripts/mk_make.py", line 9, in <module>
       >     from mk_util import *
       >   File "/build/source/scripts/mk_util.py", line 18, in <module>
       >     import distutils.sysconfig
       > ModuleNotFoundError: No module named 'distutils'
       For full logs, run 'nix log /nix/store/rksx05p231nvzb0icz3hf6fb8hxhik2b-z3-4.8.5.drv'.

Additional context

distutil removal in Python 3.12 that is now the default Python version since #320924. z3 4.8.5 is an fstar package dependency. Other versions of z3 work, I will look for a possible fix.

Notify maintainers

@thoughtpolice @ttuegel

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
output here

Add a :+1: reaction to issues you find important.

alarkworthy commented 1 month ago

I may be wrong but it seems like the python package setuptools needs to be installed for Python 3.12 and also imported with import setuptools before import distutils wherever distutils was being used. I am still quite a novice when it comes to the inner workings of NixOS but the below should hopefully help pinpoint where changes need to be made

@nix { "action": "setPhase", "phase": "checkPhase" }
Running phase: checkPhase
check flags: -j16 check-runtimes
[0/1] Running runtimes regression tests
/build/source/compiler-rt/test/lit.common.cfg.py:639: SyntaxWarning: invalid escape sequence '\$'
  config.substitutions.append( ("%ld_flags_rpath_exe" + postfix, "-Wl,-z,origin -Wl,-rpath,\$ORIGIN -L%T -l%xdynamiclib_namespec" + postfix) )
/build/source/compiler-rt/test/lit.common.cfg.py:642: SyntaxWarning: invalid escape sequence '\$'
  config.substitutions.append( ("%ld_flags_rpath_exe" + postfix, "-Wl,-rpath,\$ORIGIN -L%T -l%xdynamiclib_namespec" + postfix) )
/build/source/compiler-rt/test/lit.common.cfg.py:645: SyntaxWarning: invalid escape sequence '\$'
  config.substitutions.append( ("%ld_flags_rpath_exe" + postfix, "-Wl,-R\$ORIGIN -L%T -l%xdynamiclib_namespec" + postfix) )
lit: /build/source/compiler-rt/test/lit.common.cfg.py:148: warning: Compiler lib dir != compiler-rt lib dir
Compiler libdir:     "/nix/store/kjav83vr3vhq96hj4wr95fbkxdgwcbqg-rocm-llvm-runtimes-6.0.2/lib/linux"
compiler-rt libdir:  "/build/source/runtimes/build/compiler-rt/lib/linux"
lit: /build/source/compiler-rt/test/lit.common.cfg.py:158: warning: COMPILER_RT_TEST_STANDALONE_BUILD_LIBS=ON, but this test suite does not support testing the just-built runtime libraries when the test compiler is configured to use different runtime libraries. Either modify this test suite to support this test configuration, or set COMPILER_RT_TEST_STANDALONE_BUILD_LIBS=OFF to test the runtime libraries included in the compiler instead.
lit: /build/source/compiler-rt/test/lit.common.cfg.py:169: note: Testing using libraries in "/build/source/runtimes/build/compiler-rt/lib/linux"
lit: /nix/store/yz7yczcfpipg2gdbs5xm9pxxl84h1pq7-python3.12-lit-18.1.7/lib/python3.12/site-packages/lit/TestingConfig.py:152: fatal: unable to parse config file '/build/source/compiler-rt/test/lit.common.cfg.py', traceback: Traceback (most recent call last):
  File "/nix/store/yz7yczcfpipg2gdbs5xm9pxxl84h1pq7-python3.12-lit-18.1.7/lib/python3.12/site-packages/lit/TestingConfig.py", line 140, in load_from_path
    exec(compile(data, path, "exec"), cfg_globals, None)
  File "/build/source/compiler-rt/test/lit.common.cfg.py", line 519, in <module>
    from distutils.version import LooseVersion
ModuleNotFoundError: No module named 'distutils'

FAILED: CMakeFiles/check-runtimes /build/source/runtimes/build/CMakeFiles/check-runtimes 
cd /build/source/runtimes/build && /nix/store/z7xxy35k7620hs6fn6la5fg2lgklv72l-python3-3.12.4/bin/python3.12 /nix/store/yz7yczcfpipg2gdbs5xm9pxxl84h1pq7-python3.12-lit-18.1.7/bin/.lit-wrapped -sv --show-xfail --show-unsupported /build/source/runtimes/build/compiler-rt/test/builtins/TestCases /build/source/runtimes/build/compiler-rt/test/builtins/Unit/X86_64LinuxConfig
ninja: build stopped: subcommand failed.

This is where is fails for me, I used nix log /nix/store/x0cc4afsyk5m2ly5lhg2mycwqbg2zarb-rocm-llvm-compiler-rt-6.0.2.drv to get this output.