CMake Errors... M1 Mac mini

M1 Mac mini
OSX 11.4 (Big Sur)

What I’ve done:
get clone code of Aseprite
directory: Users/Me/aseprite have build folder in it
get Ninja
get Skia
directroy: Users/Me/deps/skia …/Skia-macOS-Release-x64 have build folder and CMakeLists.txt in it, depot_tools folder installed
get CMake

when I tried to code from Github

cd aseprite
mkdir build
cd build
cmake \
  -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  -DCMAKE_OSX_ARCHITECTURES=x86_64 \
  -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 \
  -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk \
  -DLAF_BACKEND=skia \
  -DSKIA_DIR=$HOME/deps/skia \
  -DSKIA_LIBRARY_DIR=$HOME/deps/skia/out/Release-x64 \
  -DSKIA_LIBRARY=$HOME/deps/skia/out/Release-x64/libskia.a \
  -G Ninja \
  ..

result:


ninja aseprite
mkdir: build: File exists
CMake Deprecation Warning at CMakeLists.txt:16 (cmake_policy):
  The OLD behavior for policy CMP0046 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


CMake Warning at /opt/homebrew/Cellar/cmake/3.21.1/share/cmake/Modules/Platform/Darwin-Initialize.cmake:303 (message):
  Ignoring CMAKE_OSX_SYSROOT value:

   /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk

  because the directory does not exist.
Call Stack (most recent call first):
  /opt/homebrew/Cellar/cmake/3.21.1/share/cmake/Modules/CMakeSystemSpecificInitialize.cmake:21 (include)
  CMakeLists.txt:31 (project)


-- The C compiler identification is AppleClang 12.0.5.12050022
-- The CXX compiler identification is AppleClang 12.0.5.12050022
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - broken
CMake Error at /opt/homebrew/Cellar/cmake/3.21.1/share/cmake/Modules/CMakeTestCCompiler.cmake:69 (message):
  The C compiler

    "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /Users/Me/aseprite/build/CMakeFiles/CMakeTmp
    
    Run Build Command(s):/opt/homebrew/bin/ninja cmTC_5f62e && [1/2] Building C object CMakeFiles/cmTC_5f62e.dir/testCCompiler.c.o
    [2/2] Linking C executable cmTC_5f62e
    FAILED: cmTC_5f62e 
    : && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -arch x86_64 -mmacosx-version-min=10.9 -Wl,-search_paths_first -Wl,-headerpad_max_install_names  CMakeFiles/cmTC_5f62e.dir/testCCompiler.c.o -o cmTC_5f62e   && :
    ld: library not found for -lSystem
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    ninja: build stopped: subcommand failed.
    
    

  

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:31 (project)


-- Configuring incomplete, errors occurred!
See also "/Users/Me/aseprite/build/CMakeFiles/CMakeOutput.log".
See also "/Users/Me/aseprite/build/CMakeFiles/CMakeError.log".
ninja: error: loading 'build.ninja': No such file or directory
Me@Meui-Macmini build % 

please help…
thank you ㅠ_ㅠ

Hey there. I know this is a super necro, but I was struggling with this and couldn’t find a solid answer anywhere, so I figured I would post it here.

I followed the installation structions. Namely getting both cmake and ninja installed via Homebrew. I had everything set up in the right place, but couldn’t get it to make something for ninja to compile.

My issue was that /Applications/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk was not the actual location of my MacOS SDK.

It was located at /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk Once I changed that line of the command, it worked like a charm.

This was because I had the XCode developer command line tools installed, instead of simply XCode. If anyone else is having issues with this, I highly recommend checking out where your MacOSX.sdk is hiding at.

Also, you’re saying you’re running on the M1 Apple Silicon, you should set your -DCMAKE_OSX_ARCHITECTURES to ARM64 instead of the usual x86_64 architecture. Be doubly sure you’ve made the deps directory in your $HOME directory as well, then moved skia into there

1 Like