Cmake configuration build fails on test big endian


Cmake fails in the configuration stage with the following messages when I tried to compile with the iOS toolchain and Xcode generator.

Check size of unsigned long - failed
CMake Error at /Applications/ (message):
no suitable type found
Call Stack (most recent call first):
CMakeLists.txt:54 (TEST_BIG_ENDIAN)

This is preceded by this message

Check size of unsigned int - failed
Check size of unsigned long
CMake Deprecation Warning at /Applications/ (message):
The CMAKE_FORCE_C_COMPILER macro is deprecated. Instead just set
CMAKE_C_COMPILER and allow CMake to identify the compiler.
Call Stack (most recent call first):
/Users/mac/dev/ios-cmake/toolchain/iOS.cmake:40 (CMAKE_FORCE_C_COMPILER)
/Users/mac/dev/xcode/byview/CMakeFiles/3.15.5/CMakeSystem.cmake:6 (include)
/Users/mac/dev/xcode/byview/CMakeFiles/CMakeTmp/CMakeLists.txt:3 (project)

When I tried to generate yet, I get this

Check if the system is big endian
Searching 16 bit integer
CMake Error at /Applications/ (message):
no suitable type found
Call Stack (most recent call first):
CMakeLists.txt:54 (TEST_BIG_ENDIAN)

Thank you for your help in advance

What Xcode version are you using? Can you show the command line you used to invoke cmake?

I’d also suggest you try the latest CMake release. If you are using Xcode 12, perhaps even try out a master build of CMake, as some important improvements were made in the last few days for that.

Hi Craig,

Thank you for getting back. One Xcode, the one I’ve been dealing with, is 11 on Mojave while another one is 13 on Catalina. I’ve tried to use cmake-gui but with no success always bumping on the same issue that I posted. I started suspecting some architectural mess but could not fix anything yet. Your help would be much appreciated. Thank you

Hi Craig,
A bit of correction as the simulator runs on the SDK 13 and Mojave 10.14.6 OS.
Thank you

There is no Xcode 13. I’m specifically asking about the Xcode version, not the SDK version. Go to the Xcode --> About Xcode menu item if you need to find it. The X.Y full version info could be relevant, not just the first number.

Your original post mentioned that you were trying to “compile with the iOS toolchain”. How were you specifying that toolchain? If you were using a toolchain file, what are the contents of that file? You need to provide enough information for someone to reproduce your problem on their system.

Before we go any further, please do try with the latest CMake release. Also try running CMake from a command line and show the exact command line you used if you still see the problem with the latest release. That will make it easier to understand your issue.

Hello Oleg,

When you expecting issues with CMake - CMakeFiles/CMakeError.log is a good place to investigate what happens.
That file should have details about why the size check of unsigned {short,int,long} failed.



I’ve run it from the command line and -gui and get more or less the same error as I described in the post. I used Xcode 11.0 and cmake 18.2. The command that I used is

cmake … -G Xcode -DCMAKE_TOOLCHAIN_FILE=/users/mac/dev/ios-cmake/toolchain/iOS.cmake

and I ran it from the build directory. The toolchain file I’m attaching for your consideration.

Thanks a lot

iOS.cmake (7.93 KB)

I used iOS 13 as the build target for the Xcode project and got this


Check dependencies
target specifies product type ‘’, but there’s no such product type for the ‘iphoneos’ platform
warning: The armv7 architecture is deprecated for your deployment target (iOS 13.0). You should update your ARCHS build setting to remove the armv7 architecture.


What am I doing wrong yet? Thanks

Just curious, have you tried documentation example ?
Without using your toolchain file?

Very good point! I’ve just run it and it built well without errors but I’m yet to see how it can be used for my iOS project in Swift. I wonder if you would not know some documentation with examples as to how your products can be used with iOS and Swift that I could tap into for help? Thank you

I can’t help you with the Swift aspect, but looking at that iOS toolchain file you provided, it does a lot of things it shouldn’t. I strongly recommend you discard it and start with a minimal toolchain file that only sets the bare minimum (which would be setting CMAKE_SYSTEM_NAME to iOS and probably not much else).

A good way to test whether something should go into a toolchain file or not is to ask “Could I use this same toolchain file on a completely unrelated project?”. Anything you want to add to your toolchain file that would cause you to answer “No” to that question most likely belongs in the project itself, not the toolchain file.

Also, when targeting any Apple platform, use the most recent CMake release you can. Apple change things often, so you want to use a recent CMake version that has been updated to account for those changes.

Thank you. I used the command line to run an adopted example as suggested by Sergei previously to compile successfully. Now, I need to integrate the result into my Swift project so I can use the compiled code in my project and wonder if you would not know how to do it. Thanks a lot in advance.