PyICU build failing on Mac OS Monterey
Issue Description
We are trying to build pyicu on a new macbook with Apple silicon that apparently comes with the latest MacOS Monterey. The build is failing with below error and we believe (based on this) it is due to the fact that stat64 isn't supported by the latest mac os anymore. It has been deprecated for quite some time now but now eventually it is completely incompatible with Monterey.
The steps we tried are from this link - https://programmerah.com/solved-pip-install-icu-failed-command-python-setup-py-egg_info-failed-with-error-code-1-in-28259/ These worked just fine on non-M1 machines but throwing below errors when running the build command on an M1 machine with Monterey installed.
Note: ICU 70.1 was used and it was installed using brew
We would like to know
- if our findings are correct
- if there are any plans to fix this in the near future
- if anybody has any workarounds until a permanent fix is found
Context
We had to fall back to building and installing pyicu from source after failing to do so via pip install and many of our mac (non-M1) machines. The issue we faced there is for another day.
Error Trace
./common.h:459:19: error: use of undeclared identifier 'UnicodeString'; did you mean 'isUnicodeString'?
int32_t toUChar32(UnicodeString& u, UChar32 *c, UErrorCode& status);
^~~~~~~~~~~~~
isUnicodeString
./common.h:458:5: note: 'isUnicodeString' declared here
int isUnicodeString(PyObject *arg);
^
./common.h:459:37: error: unexpected type name 'UChar32': expected expression
int32_t toUChar32(UnicodeString& u, UChar32 *c, UErrorCode& status);
^
./common.h:459:46: error: use of undeclared identifier 'c'
int32_t toUChar32(UnicodeString& u, UChar32 *c, UErrorCode& status);
^
./common.h:459:49: error: unexpected type name 'UErrorCode': expected expression
int32_t toUChar32(UnicodeString& u, UChar32 *c, UErrorCode& status);
^
./common.h:459:61: error: use of undeclared identifier 'status'
int32_t toUChar32(UnicodeString& u, UChar32 *c, UErrorCode& status);
^
./common.h:459:34: error: use of undeclared identifier 'u'
int32_t toUChar32(UnicodeString& u, UChar32 *c, UErrorCode& status);
^
./common.h:459:61: warning: 'stat64' is deprecated: first deprecated in macOS 10.6 [-Wdeprecated-declarations]
int32_t toUChar32(UnicodeString& u, UChar32 *c, UErrorCode& status);
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/stat.h:427:9: note: 'stat64' has been explicitly marked deprecated here
int stat64(const char *, struct stat64 *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_NA, __IPHONE_NA);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
202 warnings and 20 errors generated.
error: command '/usr/bin/gcc' failed with exit status 1