Fix build with latest Xcode on OSX#14282
Conversation
The latest Xcode 9 cannot successfully build CoreCLR PAL. There are several issues. First, it complains that min / max macros cannot be defined in C++ code, since they would collide with the std::min and std::max functions. Second, some of the headers that PAL includes pull in declarations of several template classes that we explicitly define in PAL and also the new operator declaration. To fix that, I have undefined the min and max macros for PAL and replaced their usage by the std::min / max functions. I have also removed the manual declaration of the colliding template classes and new operator and added inclusion of the proper C++ headers instead. The PAL was including non-pal safemath.h and to make this change compatible with it, I have added definition of USE_STL that makes safemath.h include type_trait from STL instead of our local trimmed copy. I have also removed some dead code that I have discovered during the process. Fixes #14279
|
CC: @4creators |
|
All ARM legs are failing due to some C++ headers stuff. I need to look into it. |
|
There are still errors on my local machine when building you PR (this could be outdated dependencies - pls advise): End it ends at 34% with the following message: |
|
@4creators this is really strange. Would it be possible for you to upgrade to the latest Xcode 9? It seems like there is something broken with your includes. Unfortunately, I am no expert on Xcode, so I don't know how it sets include paths etc. And it may be that 8.3.2 had some problem in it that doesn't occur on 8.3.3. that I was using before migrating to 9. |
|
After upgrade to Xcode 9.0 build is OK excepto for some warnings. |
|
@4creators good to hear that. As for the warnings, are these warnings from the native code build or the managed stuff build? |
|
@janvorli Pls find all warnings below. They all come from native build. |
|
@jkotas I've fixed the ARM32 build issue. It turned out to be two things - one was 32 bit build related and the other was due to the fact that the Tizen and Ubuntu 16.04 ARM32 rootfs use very recent GLIBCXX. The type_traits in that version of GLIBCXX cannot compile if the wchar_t is redefined like we do in PAL. I've looked for options to fix that and the cleanest one turned out to be to pre-include the type_traits in palinternal.h before including pal.h that redefines the wchar_t. |
The latest Xcode 9 cannot successfully build CoreCLR PAL. There are
several issues. First, it complains that min / max macros cannot be defined
in C++ code, since they would collide with the std::min and std::max
functions. Second, some of the headers that PAL includes pull in declarations
of several template classes that we explicitly define in PAL and also
the new operator declaration.
To fix that, I have undefined the min and max macros for PAL and replaced
their usage by the std::min / max functions. I have also removed the manual
declaration of the colliding template classes and new operator and added
inclusion of the proper C++ headers instead.
The PAL was including non-pal safemath.h and to make this change compatible
with it, I have added definition of USE_STL that makes safemath.h include
type_trait from STL instead of our local trimmed copy.
I have also removed some dead code that I have discovered during the process.
Fixes #14279