Building yescrypt on Alpine Linux requires apk add linux-headers for our #include <linux/mman.h> /* for MAP_HUGE_2MB */. That's rather unfortunate. It got me thinking of defining MAP_HUGE_2MB ourselves, but then we'd try to use it even on old systems that lack it, so would fail at runtime on RHEL6. Which also reminds me that the same failure would happen if a binary is moved from a newer to an older Linux system (if it's otherwise compatible enough to run).
Maybe the right way is to try (the numeric value of) MAP_HUGE_2MB and fallback to not using it at runtime.
Building yescrypt on Alpine Linux requires
apk add linux-headersfor our#include <linux/mman.h> /* for MAP_HUGE_2MB */. That's rather unfortunate. It got me thinking of definingMAP_HUGE_2MBourselves, but then we'd try to use it even on old systems that lack it, so would fail at runtime on RHEL6. Which also reminds me that the same failure would happen if a binary is moved from a newer to an older Linux system (if it's otherwise compatible enough to run).Maybe the right way is to try (the numeric value of)
MAP_HUGE_2MBand fallback to not using it at runtime.