Hello!
I keep getting this error from CMake in CLion:
"/Users/matt/Library/Application Support/JetBrains/Toolbox/apps/CLion/ch-0/192.6817.32/CLion.app/Contents/bin/cmake/mac/bin/cmake" -DCMAKE_BUILD_TYPE=uno -G "CodeBlocks - Unix Makefiles" /Users/matt/Downloads/spooky-candy-surprise
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/matt/Downloads/spooky-candy-surprise/cmake-build-uno
Problems were encountered while collecting compiler information:
avr-g++: error: unrecognized command line option '-mmacosx-version-min=10.14'
[Finished]
Here is the GitHub repo to the project files.
Does anyone know why this is happening or how I can fix this?
Thanks
Have a look through this thread… it looks to be something to do with a newer version of XCode (and the SDK it installs?)
A few version numbers to help put the issue in context -
macOS 10.14
CLion 2019.2.2
PlatformIO 4.0.3
espressif32 1.10.0
toolchain-xtensa32 2.50200.80
I’ve used PIO + CLion successfully before, and it’s an amazing combination of tools. For whatever reason, I went to use it tonight and when I create my first empty .cpp file in a new PIO project, I get an error in the CMake output frame:
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xct…
1 Like
Hmm… I see. I’d rather not downgrade my Xcode version, though, because I also do iOS development. Is there another solution? Perhaps installing a non-Xcode toolchain?
I tried downgrading to Xcode 10.3, but now I get an additional error:
"/Users/matt/Library/Application Support/JetBrains/Toolbox/apps/CLion/ch-0/192.6817.32/CLion.app/Contents/bin/cmake/mac/bin/cmake" -DCMAKE_BUILD_TYPE=uno -G "CodeBlocks - Unix Makefiles" /Users/matt/Downloads/spooky-candy-surprise
CMake Warning at /Users/matt/Library/Application Support/JetBrains/Toolbox/apps/CLion/ch-0/192.6817.32/CLion.app/Contents/bin/cmake/mac/share/cmake-3.15/Modules/Platform/Darwin-Initialize.cmake:131 (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):
/Users/matt/Library/Application Support/JetBrains/Toolbox/apps/CLion/ch-0/192.6817.32/CLion.app/Contents/bin/cmake/mac/share/cmake-3.15/Modules/CMakeSystemSpecificInitialize.cmake:21 (include)
CMakeLists.txt:9 (project)
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/matt/Downloads/spooky-candy-surprise/cmake-build-uno
Problems were encountered while collecting compiler information:
avr-g++: error: unrecognized command line option '-mmacosx-version-min=10.14'
[Finished]
For me, the solution to this problem was to set -nostdlib
like this:
SET(CMAKE_C_COMPILER "$ENV{HOME}/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gcc")
SET(CMAKE_CXX_COMPILER "$ENV{HOME}/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-g++")
SET(CMAKE_CXX_FLAGS "-nostdlib")
SET(CMAKE_C_FLAGS "-nostdlib")
# optional
SET(CMAKE_OSX_SYSROOT "$ENV{HOME}/.platformio/packages/toolchain-xtensa32/xtensa-esp32-elf/sysroot")
IMPORTANT! Add these lines BEFORE project(...)
Hope this helps someone