Switch the CMAKE_CXX_STANDARD to 17 so this can be compiled in macOS
Add support for macfuse (the successor to osxfuse)
CMAKE_CXX_STANDARD
The recent macOS SDKs require this, otherwise the compile fails with something like this:
mseeger@mseeger-mbp build % make xarexec_fuse
[ 20%] Building CXX object CMakeFiles/XarHelperLib.dir/xar/XarHelpers.cpp.o
In file included from /Users/mseeger/workspace/xar/xar/XarHelpers.cpp:7:
/Users/mseeger/workspace/xar/xar/XarHelpers.h:155:6: error: no template named 'optional' in namespace 'std'
std::optional<ino_t> read_sysfs_cgroup_inode(const char *filename);
~~~~~^
/Users/mseeger/workspace/xar/xar/XarHelpers.cpp:14:6: error: no template named 'optional' in namespace 'std'
std::optional<std::string> read_file_prefix(const char *filename,
~~~~~^
/Users/mseeger/workspace/xar/xar/XarHelpers.cpp:18:17: error: no member named 'nullopt' in namespace 'std'
return std::nullopt;
~~~~~^
/Users/mseeger/workspace/xar/xar/XarHelpers.cpp:25:17: error: no member named 'nullopt' in namespace 'std'
return std::nullopt;
~~~~~^
/Users/mseeger/workspace/xar/xar/XarHelpers.cpp:30:17: error: no member named 'nullopt' in namespace 'std'
return std::nullopt;
~~~~~^
/Users/mseeger/workspace/xar/xar/XarHelpers.cpp:33:10: error: no viable conversion from returned value of type 'std::string' (aka 'basic_string<char, char_traits<char>, allocator<char> >') to function return type 'int'
return buf;
^~~
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/string:875:5: note: candidate function
operator __self_view() const _NOEXCEPT { return __self_view(data(), size()); }
^
/Users/mseeger/workspace/xar/xar/XarHelpers.cpp:93:6: error: no template named 'optional' in namespace 'std'
std::optional<ino_t> read_sysfs_cgroup_inode(const char *filename) {
~~~~~^
/Users/mseeger/workspace/xar/xar/XarHelpers.cpp:96:17: error: no member named 'nullopt' in namespace 'std'
return std::nullopt;
~~~~~^
/Users/mseeger/workspace/xar/xar/XarHelpers.cpp:100:17: error: no member named 'nullopt' in namespace 'std'
return std::nullopt;
~~~~~^
/Users/mseeger/workspace/xar/xar/XarHelpers.cpp:107:17: error: no member named 'nullopt' in namespace 'std'
return std::nullopt;
~~~~~^
/Users/mseeger/workspace/xar/xar/XarHelpers.cpp:125:15: error: no member named 'nullopt' in namespace 'std'
return std::nullopt;
~~~~~^
11 errors generated.
make[3]: *** [CMakeFiles/XarHelperLib.dir/xar/XarHelpers.cpp.o] Error 1
make[2]: *** [CMakeFiles/XarHelperLib.dir/all] Error 2
make[1]: *** [CMakeFiles/xarexec_fuse.dir/rule] Error 2
make: *** [xarexec_fuse] Error 2
squashfuse_ll@macfuse0 on /System/Volumes/Data/mnt/xarfuse/uid-0/1d33f049 (macfuse, synchronous)
Adding 'macfuse' as a valid filesystem type fixes the 'wait forever for it to mount' issue that macfuse otherwise causes
Testing
I scp'ed the resulting binary to an existing host that had macfuse installed and confirmed that it did indeed correctly mount + execute a xar file (as opposed to just hang + getting a timeout)
This PR does two things:
CMAKE_CXX_STANDARD
The recent macOS SDKs require this, otherwise the compile fails with something like this:
Macfuse
As you can see on https://osxfuse.github.io/, osxfuse is now macfuse.
The mount looks like this:
Adding 'macfuse' as a valid filesystem type fixes the 'wait forever for it to mount' issue that macfuse otherwise causes
Testing
I scp'ed the resulting binary to an existing host that had macfuse installed and confirmed that it did indeed correctly mount + execute a xar file (as opposed to just hang + getting a timeout)