On Mojave, I ran into a situation while trying to install CryptX via CPAN:

"/usr/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- CryptX.bs blib/arch/auto/CryptX/CryptX.bs 644
"/usr/bin/perl" "/System/Library/Perl/5.18/ExtUtils/xsubpp"  -typemap '/System/Library/Perl/5.18/ExtUtils/typemap' -typemap '/Users/a.leofreddi/.cpan/build/CryptX-0.063-EfIC0d/typemap'  CryptX.xs > CryptX.xsc
mv CryptX.xsc CryptX.c
cc -c  -DLTM_DESC -Isrc/ltc/headers -Isrc/ltm -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector -Os   -DVERSION=\"0.063\" -DXS_VERSION=\"0.063\"  "-I/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE"   CryptX.c
CryptX.xs:2:10: fatal error: 'EXTERN.h' file not found
#include "EXTERN.h"
         ^~~~~~~~~~
1 error generated.
make: *** [CryptX.o] Error 1

Not surprisingly, the /System/Library/Perl/5.18/darwin-thread-multi-2level/CORE directory doesn't contain any header file!

Fortunately there is a (rather obscure fix) from Apple:

sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

Credits to the pyenv team for the fix!