MAC: missing: ZLIB_INCLUDE_DIR && OPENGL_INCLUDE_DIR - macos

Zlib is supposed to be installed on all mac's by default I'm pretty sure.. But when I run cmake for SFML I get the following errors:
The C compiler identification is Clang 4.1.0
The CXX compiler identification is Clang 4.1.0
Check for working C compiler using: Xcode
Check for working C compiler using: Xcode -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working CXX compiler using: Xcode
Check for working CXX compiler using: Xcode -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Found OpenGL: /System/Library/Frameworks/OpenGL.framework
Found Freetype: /usr/X11R6/lib/libfreetype.dylib (found version "2.4.4")
Found GLEW: /Users/falconmick/Documents/SFML2 src/extlibs/libs-osx/lib/libGLEW.a
Found JPEG: /Users/falconmick/Documents/SFML2 src/extlibs/libs-osx/lib/libjpeg.a
CMake Error at /Applications/CMake 2.8-10.app/Contents/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:97 (message):
Could NOT find ZLIB (missing: ZLIB_INCLUDE_DIR)
Call Stack (most recent call first):
/Applications/CMake 2.8-10.app/Contents/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:291 (_FPHSA_FAILURE_MESSAGE)
/Applications/CMake 2.8-10.app/Contents/share/cmake-2.8/Modules/FindZLIB.cmake:85 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
src/SFML/Graphics/CMakeLists.txt:85 (find_package)
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
OPENGL_INCLUDE_DIR (ADVANCED)
used as include directory in directory /Users/falconmick/Documents/SFML2 src/src/SFML/Window
Configuring incomplete, errors occurred!

Help CMake to locate it by setting ZLIB_INCLUDE_DIR variable. Either run this:
cmake -D ZLIB_INCLUDE_DIR=/path/to/zlib/include .
in your build directory, or set it via GUI.

Related

Impossible to link SDL2 library to my cmake compiler on Windows

I'm actualy trying to compile a project on windows with the CMakeList.txt that I used to compile the project on linux.
Unfortunatly when I try to compile with windows powershell, cmake is saying :
cmake . -G "MinGW Makefiles"
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/msys64/mingw64/bin/gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/msys64/mingw64/bin/g++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at C:/Program Files/CMake/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find SDL2_image (missing: SDL2_IMAGE_LIBRARIES)
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
cmake/FindSDL2_image.cmake:91 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:12 (find_package)
-- Configuring incomplete, errors occurred!
At the first time it didn't scared me cause I know that I have to download every library and link them to the cmake.
After I download every library like this : screenshot of the files
I tried to link them into my cmake,
firstly adding them to my Environment Variables :screenshot
but that didn't work, he always says "impossible to find SDL2_image when its perfectly working on linux with the cmakeFound...
W/E if someone knows how to compile or add a library to cmake on windows it could be insane for me.

How can I make homebrew's cmake to use system clang

OS: MacOS 12.4
Installed cmake with
brew install cmake
cmake version 3.23.3
Installed clang with
xcode-select --install
clang++ version is 13.1.6
Trying to build ccls:
git clone https://github.com/MaskRay/ccls.git
mkdir build && cd build
cmake ..
And getting following output
-- The CXX compiler identification is AppleClang 13.1.6.13160021
-- The C compiler identification is AppleClang 13.1.6.13160021
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Setting build type to 'Release' as none was specified.
CMake Error at CMakeLists.txt:72 (find_package):
By not providing "FindClang.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Clang", but
CMake did not find one.
Could not find a package configuration file provided by "Clang" with any of
the following names:
ClangConfig.cmake
clang-config.cmake
Add the installation prefix of "Clang" to CMAKE_PREFIX_PATH or set
"Clang_DIR" to a directory containing one of the above files. If "Clang"
provides a separate development package or SDK, be sure it has been
installed.
-- Configuring incomplete, errors occurred!
See also "/Users/umed/projects/MaskRay/ccls/build/CMakeFiles/CMakeOutput.log".
See also "/Users/umed/projects/MaskRay/ccls/build/CMakeFiles/CMakeError.log".
Is there anyway to make brew's cmake work with system clang?
The question is not correct. CMake uses the system clang successfully, but it can't find clang libraries required by the project.
The Build manual lists the requirements, one of them is
Clang+LLVM headers and libraries, version >= 7
You get errors because you have not provided that dependency.
brew install llvm#13

CMake issue when Avast is running

I have an issue when running CMake on Windows 10 when avast antivirus is running.
I wrote a small basic CMakeLists.txt :
cmake_minimum_required(VERSION 3.10)
# set the project name
project(RayTracing)
# add the executable
add_executable(rat_tracing main.cpp)
When I run cmake -G "MSYS Makefiles" CMakeLists.txt with Avast activated I get::
-- The C compiler identification is GNU 10.3.0
-- The CXX compiler identification is GNU 10.3.0
-- Detecting C compiler ABI info
CMake Error at C:/Program Files/CMake/share/cmake-3.23/Modules/CMakeDetermineCompilerABI.cmake:49 (try_compile):
Failed to open
C:/Users/pc/Documents/C++/MyRayTracing/CMakeFiles/CMakeTmp/CMakeLists.txt
Permission denied
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.23/Modules/CMakeTestCCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)
CMakeLists.txt:4 (project)
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/Program Files/msys64/mingw64/bin/gcc.exe
CMake Error at C:/Program Files/CMake/share/cmake-3.23/Modules/CMakeTestCCompiler.cmake:56 (try_compile):
Failed to open
C:/Users/pc/Documents/C++/MyRayTracing/CMakeFiles/CMakeTmp/CMakeLists.txt
Permission denied
Call Stack (most recent call first):
CMakeLists.txt:4 (project)
-- Check for working C compiler: C:/Program Files/msys64/mingw64/bin/gcc.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.23/Modules/CMakeTestCCompiler.cmake:69 (message):
The C compiler
"C:/Program Files/msys64/mingw64/bin/gcc.exe"
is not able to compile a simple test program.
It fails with the following output:
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:4 (project)
-- Configuring incomplete, errors occurred!
See also "C:/Users/pc/Documents/C++/MyRayTracing/CMakeFiles/CMakeOutput.log".
See also "C:/Users/pc/Documents/C++/MyRayTracing/CMakeFiles/CMakeError.log".
But when I disable Avast, everything works fine and I get :
-- The C compiler identification is GNU 10.3.0
-- The CXX compiler identification is GNU 10.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/msys64/mingw64/bin/gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/msys64/mingw64/bin/g++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/pc/Documents/C++/MyRayTracing
I've done some research, but no one seems to have had the same problem. The most similar cases are those where Avast thinks Cmake is a virus.
Thx.
While working on another small c++ project, I find a solution to this problem.
Create a small "Hello word !" program.
main.cpp
#include <iostream>
int main() {
std::cout << "Hello word ! " << std::endl;
return 0;
}
And a small CMakeLists.txt.
CMakeLists.txt
cmake_minimum_required(VERSION 3.10)
# set the project name
project(Tutorial)
# add the executable
add_executable(Tutorial main.cpp)
The use cmake or cmake-gui to configure and build the project.
At this point, a warning from Avast will appear. It will say that CMakeLists.txt is trying to modify a protected directory, in my case it was "C:/Users/pc/Documents/" and will ask if you allow it or not.
Authorize it and it will work on any other project.

Cmake error: Could NOT find Boost (missing: Boost_INCLUDE_DIR)

I am new to Cmake and Boost. I am now working on a program using cmake and need help.
System: windows 7
Cmake version: 3.16.0-rc1
Boost version: boost_1_71_0. And boost is installed through .exe file.
Gcc version: 4.8.1(rev5, Built by MinGW-W64 project)
Visual studio: vs 2015
When I run cmake .. in build dir, no error occurs. The output is:
The C compiler identification is MSVC 19.0.24215.1
The CXX compiler identification is MSVC 19.0.24215.1
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe -- 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: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
Found Boost: C:/local/boost_1_71_0 (found version "1.71.0")
Boost_Found Success!
Found OpenCV: C:/Users/gph/opencv/binaries (found version "3.4.5")
Found OpenCV: C:/Users/gph/opencv/binaries (found version "3.4.5") found components: core highgui imgproc videoio
Configuring done
But I want to use minGW to compile, so When I rum cmake -G "MinGW Makefiles", error occured saying "Could NOT find Boost (missing: Boost_INCLUDE_DIR)". The output is:
The C compiler identification is GNU 4.8.1
The CXX compiler identification is GNU 4.8.1
Check for working C compiler: C:/MinGW/bin/gcc.exe
Check for working C compiler: C:/MinGW/bin/gcc.exe -- 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: C:/MinGW/bin/g++.exe
Check for working CXX compiler: C:/MinGW/bin/g++.exe -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
CMake Error at C:/Users/gph/cmake/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
Could NOT find Boost (missing: Boost_INCLUDE_DIR)
Call Stack (most recent call first):
C:/Users/gph/cmake/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
C:/Users/gph/cmake/share/cmake-3.16/Modules/FindBoost.cmake:2162 (find_package_handle_standard_args)
CMakeLists.txt:34 (find_package)
Configuring incomplete, errors occurred!
See also "C:/Users/gph/Desktop/libvibe++/build/CMakeFiles/CMakeOutput.log".
How to solve the error when running cmake -G "MinGW Makefiles"? Thanks guys!
I solved this by adding sentence set(BOOST_ROOT C:/local/boost_1_71_0) before find_package(Boost REQUIRED) LOL...
But I still wonder why I need to add this.
You can also set variables BOOST_ROOT during the creation of the cmake project (or CMake options in CLion and other IDE). For example:
mkdir buildtest; cd buildtest
cmake -DBOOST_ROOT=/you_path_to_boost/boost ..
cmake --build . -- -j 4
I had a similar problem on Linux/Manjaro. Make sure you have boost installed, more specifically the boost development headers. I had the boost runtime libraries installed but not the headers. I installed those sudo pacman -S boost and it fixed the problem for me.
After I solved this problem, thanks to ToughMind here, these problems occurred to me: _Boost_COMPONENT_DEPENDENCIES and _Boost_MISSING_DEPENDENCIES. What helped me was to update to the newest cmake verison and I got the answer from here: CMake finds Boost but the imported targets not available for Boost version

PCL 1.8 on MAC OS errors in CMake generated Makefile

I'm trying to get PCL 1.8 (The point cloud library) working on Mac OS 10.9.5, I installed all the dependencies and pcl using brew. My brew list indicates:
$ brew list
autoconf libebml pcl
automake libmatroska pcre
boost libogg pkg-config
cmake libpng qhull
cminpack libtiff qt
eigen libtool readline
expat libusb scons
flann libvorbis sip
fontconfig makedepend sqlite
freetype mkvtoolnix subversion
gettext openni szip
glew openni2 vtk
hdf5 openni2-freenectdriver wxmac
jpeg openssl xz
My cpp and CMakeLists.txt are the same at. After executing the 'cmake ..' command I get several warnings indicating an inclomplete configuration
-- The C compiler identification is Clang 6.0.0
-- The CXX compiler identification is Clang 6.0.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
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- checking for module 'eigen3'
-- found eigen3, version 3.2.10
-- Found eigen: /usr/local/Cellar/eigen/3.2.10/include/eigen3
-- Boost version: 1.62.0
-- Found the following Boost libraries:
-- system
-- filesystem
-- thread
-- date_time
-- iostreams
-- serialization
-- checking for module 'libopenni'
-- found libopenni, version 1.5.7.10
-- Found openni: /usr/local/Cellar/openni/1.5.7.10/lib/libOpenNI.dylib
-- checking for module 'libopenni2'
-- package 'libopenni2' not found
-- Found OpenNI2: /usr/local/lib/ni2/libOpenNI2.dylib
-- Could NOT find ensenso (missing: ENSENSO_LIBRARY ENSENSO_INCLUDE_DIR)
** WARNING ** io features related to ensenso will be disabled
-- Could NOT find DAVIDSDK (missing: DAVIDSDK_LIBRARY DAVIDSDK_INCLUDE_DIR)
** WARNING ** io features related to davidSDK will be disabled
-- Could NOT find DSSDK (missing: _DSSDK_LIBRARIES)
** WARNING ** io features related to dssdk will be disabled
** WARNING ** io features related to pcap will be disabled
** WARNING ** io features related to png will be disabled
CMake Error at /usr/local/lib/cmake/vtk-7.0/VTKTargets.cmake:1361 (message):
This file relies on consumers using CMake 2.8.12 or greater.
Call Stack (most recent call first):
/usr/local/lib/cmake/vtk-7.0/VTKConfig.cmake:68 (include)
/Applications/CMake 2.8-11.app/Contents/share/cmake- 2.8/Modules/FindVTK.cmake:73 (find_package)
/usr/local/share/pcl-1.8/PCLConfig.cmake:501 (find_package)
/usr/local/share/pcl-1.8/PCLConfig.cmake:659 (find_VTK)
/usr/local/share/pcl-1.8/PCLConfig.cmake:849 (find_external_library)
CMakeLists.txt:3 (find_package)
-- Configuring incomplete, errors occurred!
Im probably doing something dumb, but I'm stumped. Ideas are welcome.
thanks in advance.

Resources