NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
16.83k stars 13.22k forks source link

macvim fails to install on MacOS Ventura #201197

Open toraritte opened 1 year ago

toraritte commented 1 year ago

Describe the bug

Unable to "install" macvim. Found issue macvim fails to install #73514, but it didn't help (or I didn't understand it to make it work).

Metadata

Please run `and paste the result.

% nix-shell -p nix-info --run "nix-info -m"`
 - system: `"aarch64-darwin"`
 - host os: `Darwin 22.1.0, macOS 13.0.1`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.11.1`
 - channels(root): `"nixpkgs"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`

Steps To Reproduce

(Ran nix log /nix/store/d8554mkbwy36a8mkdmvapx2vgmrli9jr-macvim-8.2.3455.drv as recommended in the end, but it yielded the same output as the one below.)

% nix-shell -p macvim

this derivation will be built:
  /nix/store/d8554mkbwy36a8mkdmvapx2vgmrli9jr-macvim-8.2.3455.drv
building '/nix/store/d8554mkbwy36a8mkdmvapx2vgmrli9jr-macvim-8.2.3455.drv'...
unpacking sources
unpacking source archive /nix/store/16jkfhw9zqcdwacdj5zfzyz5rd4qzlqn-source
source root is source
patching sources
applying patch /nix/store/h9b5i59bh389p7rn5645nb0l84w6j1ai-macvim.patch
patching file src/MacVim/vimrc
patching file src/Makefile
patching file src/auto/configure
patching file src/vim.h
patching file src/vimtutor
Hunk #1 succeeded at 16 with fuzz 1.
Patching file src/MacVim/MacVim.xcodeproj/project.pbxproj
updateAutotoolsGnuConfigScriptsPhase
configuring
configure flags: --prefix=/nix/store/2ca7vw0q799xshfrb0akc9wxv4ni235n-macvim-8.2.3455 --enable-cscope --enable-fail-if-missing --with-features=huge --enable-gui=macvim --enable-multibyte --enable-nls --enable-luainterp=dynamic --enable-python3interp=dynamic --enable-perlinterp=dynamic --enable-rubyinterp=dynamic --enable-tclinterp=yes --without-local-dir --with-luajit --with-lua-prefix=/nix/store/krr5ik92gdh486rzygvxs0lsxph74g31-luajit-2.1.0-2022-10-04 --with-python3-command=/nix/store/2f08fqj0xns5pn3x686ssywj5d6w6ysl-python3-3.7.15/bin/python3 --with-ruby-command=/nix/store/cj30izf3sdw6kih60mkr5wlaf2gbn6d2-ruby-2.7.6/bin/ruby --with-tclsh=/nix/store/k6n0zb4zfpcflx2krwdw58xfx4knqs2c-tcl-8.6.11/bin/tclsh --with-tlib=ncurses --with-compiledby=Nix --disable-sparkle --with-developer-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer LDFLAGS=-L/nix/store/7q091ljvra1bxf08lngd1nzfm05aghwd-ncurses-6.3-p20220507/lib CPPFLAGS=-isystem\ /nix/store/sf26lpmcv9cy3p9svpp30hlvz7y0cbaq-ncurses-6.3-p20220507-dev/include CFLAGS=-Wno-error=implicit-function-declaration XCODEFLAGS=-scheme\ MacVim\ -derivedDataPath\ /private/tmp/nix-build-macvim-8.2.3455.drv-0/derivedData --with-xcodecfg=Release
configure: creating cache auto/config.cache
checking whether make sets $(MAKE)... yes
checking for gcc... /usr/bin/clang
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /usr/bin/clang accepts -g... yes
checking for /usr/bin/clang option to accept ISO C89... none needed
checking for /usr/bin/clang option to accept ISO C99... none needed
checking how to run the C preprocessor... /usr/bin/clang -E
checking for grep that handles long lines and -e... /nix/store/xapknpl637q9hbnvw0xzwqwdkz6f8xz2-gnugrep-3.7/bin/grep
checking for egrep... /nix/store/xapknpl637q9hbnvw0xzwqwdkz6f8xz2-gnugrep-3.7/bin/grep -E
checking for fgrep... /nix/store/xapknpl637q9hbnvw0xzwqwdkz6f8xz2-gnugrep-3.7/bin/grep -F
checking for library containing strerror... none required
checking for gawk... gawk
checking for strip... strip
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for unsigned long long int... yes
checking for long long int... yes
checking if the compiler supports trailing commas... yes
checking if the compiler supports C++ comments... yes
checking --enable-fail-if-missing argument... yes
checking for clang version... 1400000029
checking if clang supports -fno-strength-reduce... no
configure: checking for buggy tools...
- sh is 'GNU bash, version 5.1.16(1)-release (aarch64-apple-darwin21.6.0)
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.' - probably OK.
checking for Haiku... no
checking for QNX... no
checking for Darwin (Mac OS X)... yes
checking --disable-darwin argument... no
checking if Darwin files are there... yes
checking --disable-sparkle argument... yes
checking --with-developer-dir argument... /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer
checking --with-macsdk argument... using default
checking --with-macarchs argument... defaulting to native arch
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking Cocoa/Cocoa.h usability... yes
checking Cocoa/Cocoa.h presence... yes
checking for Cocoa/Cocoa.h... yes
checking AvailabilityMacros.h usability... yes
checking AvailabilityMacros.h presence... yes
checking for AvailabilityMacros.h... yes
checking --with-local-dir argument... no
checking --with-vim-name argument... Defaulting to vim
checking --with-ex-name argument... Defaulting to ex
checking --with-view-name argument... Defaulting to view
checking --with-global-runtime argument... no
checking --with-modified-by argument... no
checking if character set is EBCDIC... no
checking --disable-smack argument... no
checking linux/xattr.h usability... no
checking linux/xattr.h presence... no
checking for linux/xattr.h... no
checking --disable-selinux argument... no
checking for is_selinux_enabled in -lselinux... no
checking --with-features argument... huge
checking --with-compiledby argument... Nix
checking --disable-xsmp argument... no
checking --disable-xsmp-interact argument... no
checking --enable-luainterp argument... dynamic
checking --with-lua-prefix argument... /nix/store/krr5ik92gdh486rzygvxs0lsxph74g31-luajit-2.1.0-2022-10-04
checking --with-luajit... yes
checking for luajit... /nix/store/krr5ik92gdh486rzygvxs0lsxph74g31-luajit-2.1.0-2022-10-04/bin/luajit
checking LuaJIT version... 2.1
checking Lua version of LuaJIT... 5.1
checking if lua.h can be found in /nix/store/krr5ik92gdh486rzygvxs0lsxph74g31-luajit-2.1.0-2022-10-04/include/luajit-2.1... yes
checking if libluajit*.dylib* can be found in /nix/store/krr5ik92gdh486rzygvxs0lsxph74g31-luajit-2.1.0-2022-10-04... yes
checking libluajit*.dylib* (arm64)... <none>
checking --enable-mzschemeinterp argument... no
checking --enable-perlinterp argument... dynamic
checking for perl... /nix/store/f4q3hvlpnw1ldip67xhk4i7fcm0d53pd-perl-5.36.0/bin/perl
checking Perl version... OK
checking if compile and link flags for Perl are sane... no: PERL DISABLED
configure: error: could not configure perl
error: builder for '/nix/store/d8554mkbwy36a8mkdmvapx2vgmrli9jr-macvim-8.2.3455.drv' failed with exit code 1;
       last 10 log lines:
       > checking Lua version of LuaJIT... 5.1
       > checking if lua.h can be found in /nix/store/krr5ik92gdh486rzygvxs0lsxph74g31-luajit-2.1.0-2022-10-04/include/luajit-2.1... yes
       > checking if libluajit*.dylib* can be found in /nix/store/krr5ik92gdh486rzygvxs0lsxph74g31-luajit-2.1.0-2022-10-04... yes
       > checking libluajit*.dylib* (arm64)... <none>
       > checking --enable-mzschemeinterp argument... no
       > checking --enable-perlinterp argument... dynamic
       > checking for perl... /nix/store/f4q3hvlpnw1ldip67xhk4i7fcm0d53pd-perl-5.36.0/bin/perl
       > checking Perl version... OK
       > checking if compile and link flags for Perl are sane... no: PERL DISABLED
       > configure: error: could not configure perl
       For full logs, run 'nix log /nix/store/d8554mkbwy36a8mkdmvapx2vgmrli9jr-macvim-8.2.3455.drv'. 
tjni commented 1 year ago

I spent time investigating this and haven't cracked it and don't know when I'll come back to this again, so I want to share my current findiings.

On my machine, this error occurs because the configuration script introspects perl to get the libraries it was linked against:

perllibs=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed -e 'ldopts' | \
    sed -e '/Warning/d' -e '/Note (probably harmless)/d' \
        -e 's/-bE:perl.exp//' -e 's/-lc //'`

The perl in nixpkgs is built with libxcrypt, so perllibs contains -lcrypt but it does not contain -L/path/to/libcrypt so the test script that configure runs fails.

I am not positive what the best fix for this is upstream, though I added the following line locally for testing:

# From above, perllibs includes libraries used to link perl. This
# can include, for example, "-lcrypt". The "ldopts" subroutine in
# the ExtUtils::Embed module does not add library search paths for
# these libraries. We prepend an appropriate search path here.
perllibs="`cd $srcdir; $vi_cv_path_perl -MConfig -e 'print ($Config{libsdirs} =~ s/^ *| +/ -L/gr)'` $perllibs"

This is enough to get past that configuration failure, but the next failures are:

In file included from if_python3.c:69:
/nix/store/p2dg6c2criaslr1m0mzypqj3n75ip5pp-python3-3.7.15/include/python3.7m/Python.h:44:10: fatal error: 'crypt.h' file not found
#include <crypt.h>
         ^~~~~~~~~
In file included from if_perl.xs:62:
In file included from /nix/store/7rm7caxckcl5w230468m84gvmjw2cncb-perl-5.36.0/lib/perl5/5.36.0/darwin-thread-multi-2level/CORE/perl.h:4163:
In file included from /nix/store/7rm7caxckcl5w230468m84gvmjw2cncb-perl-5.36.0/lib/perl5/5.36.0/darwin-thread-multi-2level/CORE/op.h:679:
/nix/store/7rm7caxckcl5w230468m84gvmjw2cncb-perl-5.36.0/lib/perl5/5.36.0/darwin-thread-multi-2level/CORE/reentr.h:124:16: fatal error: 'crypt.h' file not found
#      include <crypt.h>
               ^~~~~~~~~

So crypt.h (from libxcrypt) is needed, but I'm not sure what the best way to add this is, and why upstream does not run into this issue.

I hope that this helps whoever picks this up next (maybe it'll be future me).

virusdave commented 1 year ago

FWIW i ran into this also on Catalina last year, and basically got to the exact same spot & conclusion with debugging as @tjni did, so it's not Ventura-specific at all.

lilyball commented 9 months ago

I just submitted https://github.com/NixOS/nixpkgs/pull/260094 which should fix this.