# Cmake configuration build fails on test big endian

**URL:** https://discourse.cmake.org/t/cmake-configuration-build-fails-on-test-big-endian/1903
**Category:** Usage
**Created:** [September 23, 2020, 4:45pm UTC](https://discourse.cmake.org/t/cmake-configuration-build-fails-on-test-big-endian/1903 "2020-09-23T16:45:31Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![Oleg\_Karpenko](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/o/ecccb3/32.png) [@Oleg\_Karpenko](https://discourse.cmake.org/u/Oleg_Karpenko)
#### Post date: [September 23, 2020, 4:45pm UTC](https://discourse.cmake.org/t/cmake-configuration-build-fails-on-test-big-endian/1903/1 "2020-09-23T16:45:31Z")

</div>

**Hello,**

**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/CMake.app/Contents/share/cmake-3.15/Modules/TestBigEndian.cmake:50 (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/CMake.app/Contents/share/cmake-3.15/Modules/CMakeForceCompiler.cmake:75 (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/CMake.app/Contents/share/cmake-3.15/Modules/TestBigEndian.cmake:50 (message):  
no suitable type found  
Call Stack (most recent call first):  
CMakeLists.txt:54 (TEST\_BIG\_ENDIAN)

**Thank you for your help in advance**  
**Oleg**

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [September 23, 2020, 11:09pm UTC](https://discourse.cmake.org/t/cmake-configuration-build-fails-on-test-big-endian/1903/2 "2020-09-23T23:09:14Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Oleg\_Karpenko](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/o/ecccb3/32.png) [@Oleg\_Karpenko](https://discourse.cmake.org/u/Oleg_Karpenko)
#### Post date: [September 23, 2020, 11:33pm UTC](https://discourse.cmake.org/t/cmake-configuration-build-fails-on-test-big-endian/1903/3 "2020-09-23T23:33:21Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Oleg\_Karpenko](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/o/ecccb3/32.png) [@Oleg\_Karpenko](https://discourse.cmake.org/u/Oleg_Karpenko)
#### Post date: [September 24, 2020, 12:25am UTC](https://discourse.cmake.org/t/cmake-configuration-build-fails-on-test-big-endian/1903/4 "2020-09-24T00:25:41Z")

</div>

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

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [September 24, 2020, 10:42am UTC](https://discourse.cmake.org/t/cmake-configuration-build-fails-on-test-big-endian/1903/5 "2020-09-24T10:42:47Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![snikulov](https://discourse.cmake.org/user_avatar/discourse.cmake.org/snikulov/32/194_2.png) [@snikulov](https://discourse.cmake.org/u/snikulov)
#### Post date: [September 24, 2020, 4:41pm UTC](https://discourse.cmake.org/t/cmake-configuration-build-fails-on-test-big-endian/1903/6 "2020-09-24T16:41:28Z")

</div>

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.

HTH.

---

<div class="post-metadata">

### Author: ![Oleg\_Karpenko](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/o/ecccb3/32.png) [@Oleg\_Karpenko](https://discourse.cmake.org/u/Oleg_Karpenko)
#### Post date: [September 24, 2020, 5:03pm UTC](https://discourse.cmake.org/t/cmake-configuration-build-fails-on-test-big-endian/1903/7 "2020-09-24T17:03:51Z")

</div>

Hello

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](https://discourse.cmake.org/uploads/short-url/7rm8CHumacG16ebb8tDnUbXgrQN.cmake) (7.93 KB)

---

<div class="post-metadata">

### Author: ![Oleg\_Karpenko](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/o/ecccb3/32.png) [@Oleg\_Karpenko](https://discourse.cmake.org/u/Oleg_Karpenko)
#### Post date: [September 24, 2020, 5:34pm UTC](https://discourse.cmake.org/t/cmake-configuration-build-fails-on-test-big-endian/1903/8 "2020-09-24T17:34:24Z")

</div>

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

=== BUILD TARGET cmTC\_ad949 OF PROJECT CMAKE\_TRY\_COMPILE WITH CONFIGURATION Debug ===

Check dependencies  
target specifies product type ‘com.apple.product-type.tool’, 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.

\*\* BUILD FAILED \*\*

What am I doing wrong yet? Thanks

---

<div class="post-metadata">

### Author: ![snikulov](https://discourse.cmake.org/user_avatar/discourse.cmake.org/snikulov/32/194_2.png) [@snikulov](https://discourse.cmake.org/u/snikulov)
#### Post date: [September 24, 2020, 6:23pm UTC](https://discourse.cmake.org/t/cmake-configuration-build-fails-on-test-big-endian/1903/9 "2020-09-24T18:23:34Z")

</div>

Just curious, have you tried [documentation example](https://cmake.org/cmake/help/v3.18/manual/cmake-toolchains.7.html#cross-compiling-for-ios-tvos-or-watchos) ?  
Without using your toolchain file?

---

<div class="post-metadata">

### Author: ![Oleg\_Karpenko](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/o/ecccb3/32.png) [@Oleg\_Karpenko](https://discourse.cmake.org/u/Oleg_Karpenko)
#### Post date: [September 24, 2020, 8:37pm UTC](https://discourse.cmake.org/t/cmake-configuration-build-fails-on-test-big-endian/1903/10 "2020-09-24T20:37:26Z")

</div>

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

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [September 26, 2020, 6:20am UTC](https://discourse.cmake.org/t/cmake-configuration-build-fails-on-test-big-endian/1903/11 "2020-09-26T06:20:23Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Oleg\_Karpenko](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/o/ecccb3/32.png) [@Oleg\_Karpenko](https://discourse.cmake.org/u/Oleg_Karpenko)
#### Post date: [September 28, 2020, 9:27pm UTC](https://discourse.cmake.org/t/cmake-configuration-build-fails-on-test-big-endian/1903/12 "2020-09-28T21:27:34Z")

</div>

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.
