cotire icon indicating copy to clipboard operation
cotire copied to clipboard

Error on OSX 10.13.2, XCode 9.2, CMake 3.10.1

Open ysolovyov opened this issue 7 years ago • 4 comments

Homebrew fresh installation

When trying to use cotire in my project getting the following error

In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/include/emmintrin.h:27:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/include/xmmintrin.h:39:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/include/mm_malloc.h:27:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdlib.h:94:
In file included from /usr/include/stdlib.h:65:
In file included from /usr/include/sys/wait.h:110:
/usr/include/sys/resource.h:196:2: fatal error: unknown type name 'uint8_t'
        uint8_t  ri_uuid[16];
        ^
1 error generated.

File /usr/include/sys/resource.h contain

#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
#include <stdint.h>
#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */

and /usr/include/stdint.h is present and everything looks fine with it. Project contain only cpp files and I'm using set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wfatal-errors -fPIC -std=c++14 -pedantic")

ysolovyov avatar Dec 19 '17 09:12 ysolovyov

I have seen the same problem with math.h. Compiling with clang++

#include "/usr/include/math.h"
int main(int argc, char* argv[]) { return 0; }

works just fine, but

#include "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h"
int main(int argc, char* argv[]) { return 0; }

produces errors like:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h:693:41: error: no member named 'fabsf' in the global namespace
abs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);}

the issue seems to be with digging all the way down to the Xcode includes.

galbramc avatar Feb 04 '18 16:02 galbramc

my project fails as well. The issue seems to be that cotire includes the xcode header, but not the system header of the same name and so various typedefs and functions are not found

For example cotire creates this header that fails to compile

/* cotire.cmake 1.7.10 generated file */
/* /Users/foo/bar/lib/cotire/blister_lib_CXX_prefix.cxx */
#pragma clang system_header
#ifdef __cplusplus
#include "/usr/include/unistd.h"
#include "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/limits.h"
#include "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdint.h"
#include "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdio.h"
#include "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdlib.h"
#include "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string.h"

but adding the system includes will compile

/* cotire.cmake 1.7.10 generated file */
/* /Users/foo/bar/lib/cotire/blister_lib_CXX_prefix.cxx */
#pragma clang system_header
#ifdef __cplusplus
#include "/usr/include/unistd.h"
#include "/usr/include/stdlib.h"
#include "/usr/include/limits.h"
#include "/usr/include/string.h"
#include "/usr/include/stdio.h"
#include "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/limits.h"
#include "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdint.h"
#include "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdio.h"
#include "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdlib.h"
#include "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string.h"

todd-richmond avatar Mar 14 '18 22:03 todd-richmond

llvm fails as well

In file included from /usr/local/Cellar/llvm/6.0.1/lib/clang/6.0.1/include/emmintrin.h:27:
In file included from /usr/local/Cellar/llvm/6.0.1/lib/clang/6.0.1/include/xmmintrin.h:39:
In file included from /usr/local/Cellar/llvm/6.0.1/lib/clang/6.0.1/include/mm_malloc.h:27:
In file included from /usr/local/Cellar/llvm/6.0.1/include/c++/v1/stdlib.h:94:
In file included from /usr/include/stdlib.h:65:
In file included from /usr/include/sys/wait.h:110:
/usr/include/sys/resource.h:196:2: fatal error: unknown type name 'uint8_t'
        uint8_t  ri_uuid[16];
        ^
1 error generated.
CMake Error at .../CMake/cotire.cmake:1990 (message):
  cotire: error 1 precompiling
 

Does Cotire works on mac os for anyone?

ysolovyov avatar Jul 20 '18 12:07 ysolovyov

+1, I have many errors in MacOS similar to those listed by others.

The problem seems to go away when using #include <cmath> instead of #include <math.h>, but that doesn't work when I have a 3rd party dependency including a C header, so I still can't use this to fix things, but it does narrow down the problem.

ImOnALampshade avatar Mar 01 '19 04:03 ImOnALampshade