Hello,
I am trying to cross compile a project using cmake, I am running:
$ mkdir build
$ cd build
$ cmake .. -DCMAKE_CXX_COMPILER=x86_64-openwrt-linux-musl-g++ -DCMAKE_INSTALL_PREFIX=/usr -DSYSINSTALL_BINDINGS=ON -DBUILD_GO=OFF -DBUILD_PYTHON=OFF -DBUILD_RUBY=OFF -DBUILD_EXAMPLES=OFF
But I am getting this error:
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is unknown
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
CMake Error at CMakeLists.txt:5 (project):
The CMAKE_CXX_COMPILER:
x86_64-openwrt-linux-musl-g++
is not a full path and was not found in the PATH.
Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.
-- Configuring incomplete, errors occurred!
The CMakeErrorLog file shows:
The output was:
No such file or directory
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: x86_64-openwrt-linux-musl-g++
Build flags:
Id flags: -c
The output was:
No such file or directory
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: x86_64-openwrt-linux-musl-g++
Build flags:
Id flags: --c++
The output was:
No such file or directory
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: x86_64-openwrt-linux-musl-g++
Build flags:
Id flags: --ec++
The output was:
No such file or directory
I tried to change the cmake file and add CXX path:
set(CMAKE_CXX_COMPILER "/usr/bin/g++")
But I got another error:
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/g++
-- Check for working CXX compiler: /usr/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- 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_CXX_COMPILER= x86_64-openwrt-linux-musl-g++
Any idea how to fix this compiler issue please?
Thanks