Can't build iOS app after migrating from v3.3.0

Background

I was upgrading realm SDK for React Native from 3.3.0 to 6.1.7.
This error also happens on v10.7.0.

Error

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstdlib:100:9: No member named 'div_t' in the global namespace; did you mean 'dev_t'?
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstdlib:101:9: No member named 'ldiv_t' in the global namespace; did you mean 'dev_t'?
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstdlib:103:9: No member named 'lldiv_t' in the global namespace

Too many errors emitted, stopping now

Screenshot

Version

  • Current Realm version: v3.3.0
  • Target Realm version:
  • OS version: macOS Big Sur 11.4