diff options
author | Lily Ballard <lily@sb.org> | 2020-04-15 11:11:15 -0700 |
---|---|---|
committer | Lily Ballard <lily@sb.org> | 2020-04-15 11:16:24 -0700 |
commit | f3ccd5d6ba32890d69d2a533c21f4be92c4d05bf (patch) | |
tree | 7883a96b40e4c3f1bee83e37f63151179665c3e8 /pkgs/applications/editors/vim | |
parent | 57e20c5d8735ab46e394d6a0ca1193082e4298be (diff) |
macvim: Fix compatibility with Xcode 11.4
Xcode 11.4 has an updated sys/_types/_fd_def.h header that references a
new symbol from libSystem. This is a problem because we're using
`/usr/bin/clang` to compile the non-Xcode portion, and this pulls in
headers from Xcode's SDK. Somehow it's still linking to the Nix
libraries (I can't figure out where configure finds these to put into
`LDFLAGS` as we're not using the cc-wrapper). The end result is we get a
linker error where this new symbol can't be found at link time, even
though it's a weak import and isn't required at runtime.
Ideally we'd provide a full 10.12 SDK to `/usr/bin/clang`, but we can't
do that because even the DevSDK package we use for our 10.12 SDK doesn't
contain everything (in particular it's missing nearly all dylibs) so we
just get linker errors if we do that.
Instead we'll just do a horrible hack and provide an `-isystem` path to
a folder structure that contains only the 10.12 `sys/_types/_fd_def.h`
header. This avoids the new symbol without causing all the errors that
happen if we pull in the entire `${darwin.Libsystem}/include`.
Diffstat (limited to 'pkgs/applications/editors/vim')
-rw-r--r-- | pkgs/applications/editors/vim/macvim.nix | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/pkgs/applications/editors/vim/macvim.nix b/pkgs/applications/editors/vim/macvim.nix index 9eabadae3b05..238f93d3d36d 100644 --- a/pkgs/applications/editors/vim/macvim.nix +++ b/pkgs/applications/editors/vim/macvim.nix @@ -22,6 +22,14 @@ let mkdir -p $out/bin ln -s /usr/bin/xcrun /usr/bin/xcodebuild /usr/bin/tiffutil /usr/bin/qlmanage $out/bin ''; + # I'm not really sure how configure finds Nix Libsystem, but we get link errors when using + # Xcode 11.4 if we're compiling against Xcode's SDK but using Nix Libsystem. We can't just pass + # Libsystem's includes though as that causes other issues, particularly with availability macros. + # This is a horrible hack but let's just pass the header that's causing problems. + fakeLibsystemInclude = runCommand "macvim-libsystem-include-shim" {} '' + mkdir -p $out/include/sys/_types + ln -s ${darwin.Libsystem}/include/sys/_types/_fd_def.h $out/include/sys/_types + ''; in stdenv.mkDerivation { @@ -92,6 +100,8 @@ stdenv.mkDerivation { DEV_DIR=$(/usr/bin/xcode-select -print-path)/Platforms/MacOSX.platform/Developer configureFlagsArray+=( "--with-developer-dir=$DEV_DIR" + # Also pass `-g -O` because configure would add those if we weren't setting CFLAGS. + "CFLAGS=-g -O -isystem ${fakeLibsystemInclude}/include" ) '' # For some reason having LD defined causes PSMTabBarControl to fail at link-time as it |