umd-lhcb / root-curated

A curated software root (foundation) for most of our analysis repos
BSD 2-Clause "Simplified" License
3 stars 0 forks source link

ROOT 6.12 doesn't build on Big Sur #7

Closed yipengsun closed 3 years ago

yipengsun commented 3 years ago

@Svende has the following problem when trying to build ROOT 6.12/06 on Big Sur (in the histfactory-fitter-demo repo:

In file included from input_line_1:1:
In file included from /nix/store/bcaknchzdrazlmscllxkvivys6z2p0ks-libcxx-7.1.0-dev/include/c++/v1/new:91:
In file included from /nix/store/bcaknchzdrazlmscllxkvivys6z2p0ks-libcxx-7.1.0-dev/include/c++/v1/exception:82:
In file included from /nix/store/bcaknchzdrazlmscllxkvivys6z2p0ks-libcxx-7.1.0-dev/include/c++/v1/cstdlib:86:
In file included from /nix/store/bcaknchzdrazlmscllxkvivys6z2p0ks-libcxx-7.1.0-dev/include/c++/v1/stdlib.h:94:
/private/tmp/nix-build-root-6.12.06.drv-0/root-6.12.06/build/etc/cling/lib/clang/5.0.0/include/stdlib.h:8:15: fatal error: 'stdlib.h' file not found
#include_next <stdlib.h>
              ^~~~~~~~~~
In file included from input_line_4:1:
/private/tmp/nix-build-root-6.12.06.drv-0/root-6.12.06/build/etc/cling/lib/clang/5.0.0/include/assert.h:8:15: fatal error: 'assert.h' file not found
#include_next <assert.h>
              ^~~~~~~~~~
Error: Error loading the default header files.
yipengsun commented 3 years ago

Might be related: This ROOT forum post.

Svende commented 3 years ago

Here is the log file: log_nix-build-root-6.12.06.txt

yipengsun commented 3 years ago

The headers that cause us troubles are here: https://github.com/umd-lhcb/root/tree/histfactory_patch_v6-12-06/interpreter/llvm/ROOT

yipengsun commented 3 years ago

From the original commit message, it looks like the ROOT developers included these stub headers to solve problems for glibc. Well, the good news is that macOS doesn't use glibc at all. Naively we'd just delete everything here and maybe it'll work.

yipengsun commented 3 years ago

I decide to borrow Quan's laptop, which has macOS Big Sur installed for debugging for a night.

yipengsun commented 3 years ago

@manuelfs @Svende Let me report my guess (educated) on why ROOT 6.12 doesn't build on Big Sur, yet 6.16 does:

Note that ROOT maintainer for nix patches ROOT's build system for macOS only. This is because ROOT tries to detect different versions of macOS (e.g. 10.14 and 10.15 should be different), whereas nix tries really hard to abstract away the differences between these platforms.

if you take a look at: https://github.com/umd-lhcb/root-curated/blob/1d5ccb77d3e23d012e8ed9575e600a9d054a5b69/nix/root_6_16/sw_vers.patch#L10 You'll see that we PIN the macOS version as 10.12! In other words, no matter what your macOS version actually is, we pretend that we are always on macOS 10.12

Now, if you look at the same patch for ROOT 6.12: https://github.com/umd-lhcb/root-curated/blob/1d5ccb77d3e23d012e8ed9575e600a9d054a5b69/nix/root_6_12/sw_vers.patch#L9 The macOS version is pinned at 10.7. There's a mismatch between our stated macOS version (10.7), and macOS SDK provided in nix (10.12), so it could create all sorts of problems (i.e. impurities) and it doesn't work for Big Sur.

My guess would be: If we change 7 -> 12, ROOT 6.12 should also build for Big Sur. I'll try that out now.

yipengsun commented 3 years ago

No. It still doesn't work.