NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.38k stars 13.61k forks source link

Build failure: davinci-resolve #226671

Closed truvatech closed 1 year ago

truvatech commented 1 year ago

Steps To Reproduce

Steps to reproduce the behavior: nixos-rebuild switch

Build log

checking for references to /build/ in /nix/store/b0lv2di80qgnfhk7hxppmwz3xial1kny-davinci-resolve-17.4.3...
patching script interpreter paths in /nix/store/b0lv2di80qgnfhk7hxppmwz3xial1kny-davinci-resolve-17.4.3
"gcc" -MMD -MF /build/source/Build/OvmfX64/RELEASE_GCC5/X64/CryptoPkg/Library/OpensslLib/OpensslLibCrypto/OUTPUT/openssl/crypto/buffer/buffer.obj.deps @/build/source/Build/OvmfX64/RELEASE_GCC5/X64/CryptoPkg/Library/OpensslLib/OpensslLibCrypto/OUTPUT/cc_resp.txt -c -o /build/source/Build/OvmfX64/RELEASE_GCC5/X64/CryptoPkg/Library/OpensslLib/OpensslLibCrypto/OUTPUT/openssl/crypto/buffer/buffer.obj  /build/source/CryptoPkg/Library/OpensslLib/openssl/crypto/buffer/buffer.c
"gcc" -MMD -MF /build/source/Build/OvmfX64/RELEASE_GCC5/X64/NetworkPkg/HttpBootDxe/HttpBootDxe/OUTPUT/AutoGen.obj.deps -g -Os -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -include AutoGen.h -fno-common -ffunction-sections -fdata-sections -DSTRING_ARRAY_NAME=HttpBootDxeStrings -m64 -fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" -maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie -fno-asynchronous-unwind-tables -Wno-address -flto -DUSING_LTO -Os -Wno-unused-but-set-variable -Wno-unused-const-variable -DMDEPKG_NDEBUG -mno-mmx -mno-sse -D DISABLE_NEW_DEPRECATED_INTERFACES -D TDX_GUEST_SUPPORTED -D SECURE_BOOT_FEATURE_ENABLED -D ENABLE_MD5_DEPRECATED_INTERFACES -c -o /build/source/Build/OvmfX64/RELEASE_GCC5/X64/NetworkPkg/HttpBootDxe/HttpBootDxe/OUTPUT/./AutoGen.obj -I/build/source/NetworkPkg/HttpBootDxe -I/build/source/Build/OvmfX64/RELEASE_GCC5/X64/NetworkPkg/HttpBootDxe/HttpBootDxe/DEBUG -I/build/source/MdePkg -I/build/source/MdePkg/Include -I/build/source/MdePkg/Test/UnitTest/Include -I/build/source/MdePkg/Include/X64 -I/build/source/MdeModulePkg -I/build/source/MdeModulePkg/Include -I/build/source/NetworkPkg -I/build/source/NetworkPkg/Include /build/source/Build/OvmfX64/RELEASE_GCC5/X64/NetworkPkg/HttpBootDxe/HttpBootDxe/DEBUG/AutoGen.c
shrinking /nix/store/2d3bnm1kqpabf83sprldfpl78my8r3k8-wpsoffice-11.1.0.11691/opt/kingsoft/wps-office/office6/wpsoffice
ln: failed to create symbolic link '/nix/store/b0lv2di80qgnfhk7hxppmwz3xial1kny-davinci-resolve-17.4.3/libs/libcrypt.so.1': No such file or directory
/nix/store/5s1yg5l36wzgy1dj0vv1ibarc4g7vrdr-stdenv-linux/setup: line 136: pop_var_context: head of shell_variables not a function context
error: builder for '/nix/store/m0ww1p70xmkf5nbd5pl15pla96z143ic-davinci-resolve-17.4.3.drv' failed with exit code 1
error: 1 dependencies of derivation '/nix/store/dl3aqi8jyp4dl1r01vl14q3rfg99w2dx-davinci-wrapper.drv' failed to build
error: 1 dependencies of derivation '/nix/store/nhn6q746ihdzvhbavvhr5yji6wlc52dq-davinci-resolve-init.drv' failed to build
error (ignored): error: cannot unlink '/tmp/nix-build-python-2.7.18.6.drv-1': Directory not empty
error: 1 dependencies of derivation '/nix/store/bk5174z66xhg7qki70n1zkvj82kjz199-davinci-resolve-bwrap.drv' failed to build
error: 1 dependencies of derivation '/nix/store/9670b9sq1w556rbjf6wdlwjdxzjh0bfn-davinci-resolve.drv' failed to build
error: 1 dependencies of derivation '/nix/store/aqmayawlfrmc3b6lfb3dp9dfjiginblj-system-path.drv' failed to build

Additional context

Havn't updated this computer in a couple of weeks and now Davinci won't let me update NixOS as it fails the build

Notify maintainers

@jshcmpbll

Metadata

a99984b1799 commented 1 year ago

This occurred for me when I tried to run Davinci Resolve via nix run --impure or nix shell --impure, but not when I installed it via my host configuration. This + the line

/nix/store/5s1yg5l36wzgy1dj0vv1ibarc4g7vrdr-stdenv-linux/setup: line 136: pop_var_context: head of shell_variables not a function context

Makes me wonder if this issue is related to how environment variables are managed.

wegank commented 1 year ago

This occurred for me when I tried to run Davinci Resolve via nix run --impure or nix shell --impure

Yeah. That's the issue. Probably related to #223803?

but not when I installed it via my host configuration.

This means that your nix channels are not recent enough for the build to fail.

This + the line

/nix/store/5s1yg5l36wzgy1dj0vv1ibarc4g7vrdr-stdenv-linux/setup: line 136: pop_var_context: head of shell_variables not a function context

Makes me wonder if this issue is related to how environment variables are managed.

This line has no actual meaning: it simply means that the build fails.

jshcmpbll commented 1 year ago

I think #223803 is still valid. Looking at the build logs im seeing the following:

davinci-resolve> ++ appimage-run ./DaVinci_Resolve_17.4.3_Linux.run -i -y -n -C /nix/store/cmk9srlyrxj5081zq0jvrx98114i739r-davinci-resolve-17.4.3
davinci-resolve> Uncompress DaVinci_Resolve_17.4.3_Linux.run of type 02 @ offset 190880
davinci-resolve> DaVinci_Resolve_17.4.3_Linux.run is now installed in /build/home/.cache/appimage-run/0942a051d270a19f39d312a347c8cd0ebf45327aed008646f99d7bff78d5d8c4
davinci-resolve> This will install DaVinci Resolve on this computer
davinci-resolve> #Starting DaVinci Resolve install
davinci-resolve> Linux localhost 5.15.94 #1-NixOS SMP Tue Feb 14 18:18:05 UTC 2023 x86_64 GNU/Linux
davinci-resolve> Install Location : /nix/store/cmk9srlyrxj5081zq0jvrx98114i739r-davinci-resolve-17.4.3
davinci-resolve> User ID: 0
davinci-resolve> User Home: /build
davinci-resolve> Error: Installer failed
davinci-resolve>  Failed to copy file: share
davinci-resolve> ++ mkdir -p /nix/store/cmk9srlyrxj5081zq0jvrx98114i739r-davinci-resolve-17.4.3/configs /nix/store/cmk9srlyrxj5081zq0jvrx98114i739r-davinci-resolve-17.4.3/DolbyVision /nix/store/cmk9srlyrxj5081zq0jvrx98114i739r-davinci-resolve-17.4.3/easyDCP /nix/store/cmk9srlyrxj5081zq0jvrx98114i739r-davinci-resolve-17.4.3/Fairlight /nix/store/cmk9srlyrxj5081zq0jvrx98114i739r-davinci-resolve-17.4.3/GPUCache /nix/store/cmk9srlyrxj5081zq0jvrx98114i739r-davinci-resolve-17.4.3/logs /nix/store/cmk9srlyrxj5081zq0jvrx98114i739r-davinci-resolve-17.4.3/Media '/nix/store/cmk9srlyrxj5081zq0jvrx98114i739r-davinci-resolve-17.4.3/Resolve Disk Database' /nix/store/cmk9srlyrxj5081zq0jvrx98114i739r-davinci-resolve-17.4.3/.crashreport /nix/store/cmk9srlyrxj5081zq0jvrx98114i739r-davinci-resolve-17.4.3/.license /nix/store/cmk9srlyrxj5081zq0jvrx98114i739r-davinci-resolve-17.4.3/.LUT
davinci-resolve> ++ runHook postInstall

Still looking into it, maybe an issue with appimage

jshcmpbll commented 1 year ago
davinci-resolve> rewriting symlink /nix/store/sm7rs52pinjfh47iwh7mspnrzp9qv2lw-davinci-resolve-17.4.3/libs/libcrypt.so.1 to be relative to /nix/store/sm7rs52pinjfh47iwh7mspnrzp9qv2lw-davinci-resolve-17.4.3
git/nixpkgs git:(6b5a17c57d4)ls
CONTRIBUTING.md  COPYING  default.nix  doc  flake.nix  lib  maintainers  nixos  pkgs  README.md  result
git/nixpkgs git:(6b5a17c57d4)cd result
nixpkgs/result ls
bin
nixpkgs/result cd bin
result/bin ls
davinci-resolve
result/bin ./davinci-resolve

Tried building on 6b5a17c57d424baa3411fae0d321f94f4d85efe3 a commit shortly before #225748 and its working fine..

truvatech commented 1 year ago

@jshcmpbll thanks, had to wrap my head around pinning a specific nixpkgs commit, but I managed to get the system updated based on your commit suggestion. Adding this here in case it helps anybody else:

let pkgs = import (builtins.fetchTarball { url = "https://github.com/NixOS/nixpkgs/archive/6b5a17c57d424baa3411fae0d321f94f4d85efe3.tar.gz"; }) { config.allowUnfree = true; config.permittedInsecurePackages = [ "python-2.7.18.6" ]; }; myDavinci = pkgs.davinci-resolve; in and replacing davinci-resolve with myDavinci in system or user packages

jshcmpbll commented 1 year ago

Made a little more progress. Looks like #225748 also changed appimage-run. I was originally thinking it was an issue with the changes done to the davinci derivation but it was actually the change to appimage-run that is causing davinci to no longer build.

If you modify the appimage-run derivation to use buildFHSEnvChroot instead of buildFHSEnv davinci builds.

I'm guessing that's not something likely to change though.. so I might have to come up with a different solution.

@Atemu Im pretty unfamiliar with the changes made to buildFHSEnv so if you have any suggestions I would greatly appreciate it 😄

I can override it as seen in the PR below but I'm just not sure if that is a valid solution.

Atemu commented 1 year ago

Returning it to chroot is a valid workaround. Obviously, we'd want to get it fixed but that requires a more thorough investigation.

Atemu commented 1 year ago

Fixed by https://github.com/NixOS/nixpkgs/pull/229799

Atemu commented 1 year ago

I'm interested why it fixes this error though as this rather looks like fallout from the libxcrypt migration?

The solution to the issue at hand should be to have libxcrypt-legacy or check whether we actually still need to symlink it in the first place.