Issue building libpressio 1.0.4 (and `master`) on macOS with Apple Clang
I recently learned about libpressio and saw it was in spack and thought, hey, why not? I first tried building the latest version in spack (0.99.4) and it failed. So updated the package with 1.0.4 and it failed. So then, okay, master and still a failure.
My build is using apple-clang 17 and gfortran 15 (not sure if libpressio has a fortran requirement)
The current failures I'm seeing are:
149 In file included from /var/folders/4t/b2c40c4149dfm599b9pc_7mr0000gp/T/mathomp4/spack-stage/spack-stage-libpressio-master-hjcbzg4ud2dskehssdmlweecwf4bqrmy/spack-src/src/plug
ins/compressors/mask_interpolation.cc:1:
>> 150 /Users/mathomp4/spack-mathomp4/opt/spack/darwin-m2/libstdcompat-0.0.21-ycshq72256etr7yjtsyowy42qcgztwti/include/std_compat/cmath.h:24:30: error: no member named 'declval' in
namespace 'std'
151 24 | typedef decltype(test(std::declval<Tp>())) type;
and:
>> 166 /var/folders/4t/b2c40c4149dfm599b9pc_7mr0000gp/T/mathomp4/spack-stage/spack-stage-libpressio-master-hjcbzg4ud2dskehssdmlweecwf4bqrmy/spack-src/src/plugins/compressors/mask_i
nterpolation.cc:130:34: error: call to 'lerp' is ambiguous
167 130 | return compat::lerp(left, right, static_cast<double>(left_pos)/static_cast<double>(left_pos+right_pos));
168 | ^~~~~~~~~~~~
Now the first one, per internet, seems to be that declval is now in utility (https://en.cppreference.com/w/cpp/utility/declval.html) so there is a need for:
#include <utility>
somewhere. (I am a Fortran programmer, not C++, so ... I can't be too helpful 🙂 )
The second one seems to happen a LOT. Internet seems to think it might be a conflict with C++20? I see here: https://en.cppreference.com/w/cpp/numeric/lerp.html that a double lerp came in with C++20 so perhaps there is now a "double" declaration?
NOTE: I know there is #32 but my errors seem to not correspond with changes there...I think. (Again, not C++ coder)
Please try the version from https://github.com/robertu94/spack_packages/, which is much newer.
It shouldn't have a fortran dependency unless you build with MPI which by default requires it.
std::lerp comes from <cmath> or is supposed to. compat::lerp is an adapter from stdcompat which provides a defintion of this function when the compiler does not support it. You can try setting cpp_compat variant to 23 and cpp_unstable which may fix it, or you can update to [email protected] which I just pushed which has this fix.
@robertu94 Ahh. Okay. I'll try out the new repo. Give me a bit as every time I incorporate a new repo, I tend to break things :)
Especially with the Spack 1.0 changes.