Cmake build failed with CMAKE_AR-NOTFOUND (cr exe not found)
Asked Answered
A

2

5

cmake build failed with

CMAKE_AR-NOTFOUND cr libperfutils.a

When i checked build folder ar is not set. x86_64-linux\gtest-native\1.7.0-r5\build\CMakeCache.txt

CMAKE_AR:FILEPATH=CMAKE_AR-NOTFOUND

//CXX compiler.
CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/g++

How to set ar in cmake ?

Wheni see the cmake config below output . cmake automatically finding the g++ & why it not detecting ar

-- The CXX compiler identification is GNU 4.8.4
-- Check for working CXX compiler: g++
-- Check for working CXX compiler: g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done

When i check ar in machine manually its available.

/usr/bin/ar
Agony answered 24/10, 2016 at 3:38 Comment(2)
What CMake version do you use? Is you trying to cross-compile? In any case, content of CMakeLists.txt (in form of minimal reproducible example) would be helpful.Heptahedron
cmake-2.8.12.2 builing for x86_64 GNU/LinuxAgony
A
4

cmake ar should set in cmake lib build , temperorly solved the issue by manally setting in my local Cmake file

set( CMAKE_AR "${AR}" CACHE FILEPATH "Archiver" )
Agony answered 2/11, 2016 at 4:24 Comment(0)
S
6

CMake should have been able to detect /usr/bin/ar by itself, but you can manually override this, with the -D CMAKE_AR=/usr/bin/ar option.

Here's the list of useful variables:

https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/Useful-Variables

Sesquipedalian answered 28/10, 2016 at 9:56 Comment(0)
A
4

cmake ar should set in cmake lib build , temperorly solved the issue by manally setting in my local Cmake file

set( CMAKE_AR "${AR}" CACHE FILEPATH "Archiver" )
Agony answered 2/11, 2016 at 4:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.