How can I set proper compiler for Cmake using ninja? - jenkins

I want to set jenkins build my cmake project.
I set 'ninja' as make program.
and following error occurs
-- Running vcpkg install - done
-- The C compiler identification is MSVC 19.34.31937.0
-- The CXX compiler identification is MSVC 19.34.31937.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe - broken
CMake Error at C:/ProgramData/Jenkins/.jenkins/tools/hudson.plugins.cmake.CmakeTool/3.25.1/share/cmake-3.25/Modules/CMakeTestCCompiler.cmake:70 (message):
The C compiler
"C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/ProgramData/Jenkins/.jenkins/workspace/JenkinsTest/build/CMakeFiles/CMakeScratch/TryCompile-tkcxl7
I saw some advice using vcvarsall.bat file but I failed to resolve. Maybe I misunderstand usage of it.
When I set Visual Studio as generater instead of ninja, jenkins works perfectly.
If you need more information to answer, please tell me. I am not sure what is needed to determine.

Related

Why is LLC.exe missing in LLVM windows?

I've been trying to use emscripten to build C into WASM and Javascript. Emscripten requires clang so I installed it but then it says "emcc: error: llc executable not found at C:\Program Files\LLVM\bin\llc.exe" when running emcc and em++. Is there a reason that LLC.exe is missing in the windows version? If so how do I get it.
llc is a developer tool. If you want it, build it from llvm-project source. This is/will not included in the release binary.

Error configuring OpenCV project with CMake on Windows

I used the prebuilt OpenCV 3.0.0 version. It works when I create a Visual Studio project directly, and when I add include and library directories.
Now I am making a CMakeList.txt file (so that I can run the same code on different systems). It will be used to create the Visual Studio project on Windows, and Makefile on Unixes, etc.
cmake_minimum_required(VERSION 2.8)
project( Facade )
find_package( OpenCV REQUIRED )
add_executable( Facade grammar.cpp )
target_link_libraries( Facade ${OpenCV_LIBS} )
When I generate the Visual Studio file on Windows, I got the following error:
CMake Warning at C:/opencv/build/OpenCVConfig.cmake:166 (message):
Found OpenCV Windows Pack but it has no binaries compatible with your
configuration.
You should manually point CMake variable OpenCV_DIR to your build of OpenCV
library.
Call Stack (most recent call first):
CMakeLists.txt:3 (find_package)
CMake Error at CMakeLists.txt:3 (find_package):
Found package configuration file:
C:/opencv/build/OpenCVConfig.cmake
but it set OpenCV_FOUND to FALSE so package "OpenCV" is considered to be
NOT FOUND.
Currently, OpenCV_DIR is C:\opencv\build, where it holds the CMake files. If I point OpenCV_DIR to C:\opencv\build\x64\vc12, it says, can't find CMake files.
How do I fix this?
What generator string did you use for the CMake configuration step? For VC12 x64, you need to use -G "Visual Studio 12 Win64" (if you were using CMake 3, you would use -G "Visual Studio 12 2013 Win64"). Note that you need to include Win64 at the end to get the x64 platform.
It is rather convenient that the OpenCV CMake config script is checking to make sure you are using the x64 binaries. You configured CMake to build 32-bit binaries, which would cause a runtime error if you were able to get an executable built.
Just in case anybody else has this problem, I got it from using old CMake config scripts. With VS2017 installed, I was getting this error- turns out that some auto-generated CMAKE configs have something like this:
elseif(MSVC_VERSION EQUAL 1910)
set(OpenCV_RUNTIME vc15)
I checked MSVC_VERSION and it was 1916, which is still VC15, but the files erroneously missed that. I changed to:
elseif((MSVC_VERSION EQUAL 1910) OR (MSVC_VERSION GREATER 1910))
set(OpenCV_RUNTIME vc15)
and it worked like a charm.

CMake error: BUILD_TBB option supports Windows on ARM only

I am trying to build libraries with CMake for a vision detection system to be built in OpenCV using Visual Studio 2012's C++ compiler. After a lot of fixing of configurations, installation of Qt 5 and also Openni, I am still getting the following errors from the CMake configuration step:
Checking for Windows (Phone) Platform SDK 8.0/8.1
Checking for Visual Studio 2012/2013
WARNING, OpenNI library directory (set by OPENNI_LIB_DIR variable) is not found or does not have OpenNI libraries.
WARNING, OpenNI include directory (set by OPENNI_INCLUDE_DIR variable) is not found or does not have OpenNI include files.
WARNING, PrimeSensor Module binaries directory (set by OPENNI_PRIME_SENSOR_MODULE_BIN_DIR variable) is not found or does not have PrimeSensor Module binaries.
Looking for Mfapi.h
Looking for Mfapi.h - found
Warning at cmake/OpenCVFindIntelPerCSDK.cmake:17 (message):
Intel Perceptual Computing SDK library directory (set by INTELPERC_LIB_DIR
variable) is not found or does not have Intel Perceptual Computing SDK
libraries.
Call Stack (most recent call first):
cmake/OpenCVFindLibsVideo.cmake:291 (include)
CMakeLists.txt:482 (include)
CMake Error at 3rdparty/tbb/CMakeLists.txt:5 (message):
BUILD_TBB option supports Windows on ARM only!
Use regular official TBB build instead of the BUILD_TBB option!
Configuring incomplete, errors occurred!
See also "C:/OpenCV/opencv/lib/CMakeFiles/CMakeOutput.log".
From cmake_gui, you can quickly disable BUILD_TBB variable. If you want TBB, you have to build it separately by yourself, and then you can use this guide to activate it in OpenCV.

clang on Windows - incorrect header file path

I built clang using VS2013 and then ran it from the command line with a -v option (clang -v testfile.c). Among the things it reported was:
#include <...> search starts here:
C:\Program Files (stand-alone)\LLVM\bin..\lib\clang\3.7.0\include
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include
I don't understand why it is even looking at the Microsoft headers in the first place. I do not have an environment variable named INCLUDE. I verified this by doing "set INCLUDE" from the command line getting a message saying there was no such environment variable. So, where and why is clang getting this information and how do I stop it? During the compile several warnings (not errors) occur regarding some of the things in Microsoft header files too.
The version it reports is:
clang -cc1 version 3.7.0 based upon LLVM 3.7.0svn default target i686-pc-windows-msvc
I understand the i686-pc-windows part, but why the msvc part? If that means it was built with msvc then that makes sense, but if it means that clang was built to run with msvc support, I don't understand why.

cmake command CXX compiler ABI info failed

I am trying to install opengl and run the cmake file, it gives these errors. Please help regarding what are the reasons and how to correct this​
-- The CXX compiler identification is Clang 5.0.0
-- The C compiler identification is Clang 5.0.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
What is your operating system? Asking this because I had a similar problem recently: under Windows 10 I tried to compile several C++ projects using Cygwin and CMake in it and the detection of C and C++ compiler ABI information failed all the time.
Managed to solve the problem in the following way: in Cygwin's root directory, you can find CMake's installed files probably under the path usr/share/cmake-3.6.2. (Note that CMake's version number may differ in your system since you asked your question years before.) This path should be accurate (or at least default) under Linux, as well.
Inside the Modules directory you can find the CMakeDetermineCompilerABI.cmake file which describes how CMake determines the compilers' ABI info. When I added several extra logging statements to this file I realized that CMake, besides not generating all the necessary files, used some binaries from Strawberry Perl (C:\Strawberry\bin\...) I installed on my system not so long ago and for completely different reasons.
Finding this odd I removed Strawberry (I didn't need it anymore) and CMake started to work properly. :) (It didn't seem okay to use something external in Cygwin anyway.) Another workaround could be to remove Strawberry from the PATH environment variable.

Resources