I've been struggling with this for ~2 days now and I can't seem to find the solution. I recently switched to a new laptop and installed Ubuntu 19.04, and now something with my c++ compiler is not working. I'm trying to load the CMakeLists.txt file in CLion using the GNU compiler from here, but I keep getting the following error message:
-- Add a local project.cmake file to add your own targets.
-- Configuring done
You have changed variables that require your cache to be deleted.
Configure will be re-run and you may have to reset some variables.
The following variables have changed:
CMAKE_C_COMPILER= /usr/bin/arm-none-eabi-gdb
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/arm-none-eabi-gcc
And eventually these lines:
arm-none-eabi-g++: error trying to exec 'cc1plus': execvp: No such file or directory
arm-none-eabi-gcc: error trying to exec 'cc1': execvp: No such file or directory
On my old (working) laptop it says:
-- The C compiler identification is GNU 6.3.1
-- The CXX compiler identification is GNU 6.3.1
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/arm-none-eabi-gcc
I've checked many forum posts, but I can't get it to work. There are many things I've tried many things, including:
sudo apt-get install --reinstall build-essential
The following command:
g++ --print-prog-name=cc1plus
Returns:
/usr/lib/gcc/x86_64-linux-gnu/8/cc1plus
And this:
which arm-none-eabi-g++
Returns:
/usr/bin/arm-none-eabi-g++
But:
which cc1plus
Returns nothing.
I feel like there should be a simple fix that points CLion to the right cc1 compilers, but the toolchain settings are the same as on my working laptop, but the new CLion doesn't work. Any help is greatly appreciated.
Jack
EDIT:
This is how the CMake is set
CMAKE_MINIMUM_REQUIRED(VERSION 3.9)
SET(CMAKE_SYSTEM_NAME Generic)
#SET(CMAKE_SYSTEM_PROCESSOR arm)
SET(CMAKE_CROSSCOMPILING TRUE)
# force compiler settings
SET(CMAKE_C_COMPILER_WORKS TRUE)
SET(CMAKE_CXX_COMPILER_WORKS TRUE)
# force cmake compilers
SET(CMAKE_ASM_COMPILER "arm-none-eabi-gcc")
SET(CMAKE_C_COMPILER "arm-none-eabi-gcc")
SET(CMAKE_CXX_COMPILER "arm-none-eabi-g++")
SET(ELF2BIN "arm-none-eabi-objcopy")
# if the environment does not specify build type, set to Debug
IF(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Debug"
CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
FORCE)
ENDIF()