cmake cannot find glib2 - macos

On OS X 10.8.2, I have macports and have installed:
glib2
pkg-config
among other things. The cmake I run tries to use pkg-config to find glib2. Running pkg-config --libs glib-2.0:
-L/opt/local/lib -lglib-2.0 -lintl
and --cflags:
-I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include
Yet, when I try to enter these in (individually, or all of them using ; or :), and all sorts of combinations, or when I tried downloading gtk and using the glib2 dirs of that: cmake complains it can't find the directories:
checking for module 'gstreamer-0.10'
found gstreamer-0.10, version 0.10.36
checking for module 'glib-2.0'
found glib-2.0, version 2.34.3
CMake Error at /Applications/CMake 2.8-10.app/Contents/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:97 (message):
Could NOT find GLib2 (missing: GLIB2_LIBDIR GLIB2_INCLUDE_DIRS)
Call Stack (most recent call first):
/Applications/CMake 2.8-10.app/Contents/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:291 (_FPHSA_FAILURE_MESSAGE)
cmake/Modules/FindGLib2.cmake:127 (find_package_handle_standard_args)
cmake/Modules/FindGStreamer.cmake:12 (find_package)
CMakeLists.txt:32 (find_package)
I saw this page about conflicting pkg-config's with MonoDevelop. I uninstalled Mono, don't have any other pkg-config binaries that I can find, and cleared the cmake cache without any luck. I've looked at the cmake specifics, and its looking for glib.h and glibconfig.h, which are in those directories. Why can't it just behave?

Try to use this file: http://svn.opensync.org/branches/3rd-party-cmake-modules/modules/FindGLIB2.cmake
In your main CMakeLists.txt file, enter the following line:
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/helper/")
This is assuming that the above FindGLIB2.cmake is stored in directory /helper off the src.
The contents of this file will help CMake to better find GLIB2.
This link will help you understand how these files work: http://www.cmake.org/Wiki/CMake:How_To_Find_Libraries#Writing_find_modules

I faced this problem while building wireshark-3.4.2 from source using cmake on Centos8.2/RHEL8.2. The error was
Could NOT find GLIB2 (missing: GLIB2_LIBRARY GLIB2_MAIN_INCLUDE_DIR GLIB2_INTERNAL_INCLUDE_DIR) Required is at least version "2.32.0")
while my system had preinstalled glib-2.56.4
Solution: Installed glib2-devel package. Then cmake found the glib-2.0 properly.
The cmake output looked like:
-- Checking for one of the modules 'glib-2.0'
-- Found GLIB2: /usr/lib64/libglib-2.0.so (found suitable version "2.56.4", minimum required is "2.32.0")

Related

CMake can not find LAPACK library on windows

I'm trying to build a C++ project using CMake which includes LAPACK library on a win32 system.
Following the documentary LAPACK for windows,
I installed MinGW 32 bits and added "C:\MinGW\bin" in the path,
then put downloaded pre-built libraries: libblas.lib, libblas.dll, liblapack.lib, liblapack.dll in the path
"\projectRoot\3rdparty\LAPACK"
The structure of folders is as below:
\projectRoot
\CMakeLists.txt
\3rdparty
\LAPACK
libblas.lib
...
in the CMakeLists file, I added
set(LAPACK_DIR "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/LAPACK")
find_package(LAPACK REQUIRED)
but got error:
CMake Error at C:/Program Files/CMake/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
Could NOT find BLAS (missing: BLAS_LIBRARIES)
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files/CMake/share/cmake-3.16/Modules/FindBLAS.cmake:810 (find_package_handle_standard_args)
C:/Program Files/CMake/share/cmake-3.16/Modules/FindLAPACK.cmake:197 (find_package)
CMakeLists.txt:17 (find_package)
and before the error, there's something that CMake couldn't find
Looking for sgemm_
Looking for sgemm_ - not found
Looking for pthread.h
Looking for pthread.h - not found
Found Threads: TRUE
I can't figure out what's the cause of the problem.
Thank you in advance if you could share your experience.
Answer my own question.
Finally what I did to find the package was:
Copy a built version from jlblancoc/suitesparse-metis-for-windows,
then use config mode of find_package by
set(LAPACK_DIR "dir/to/lapacklibs")
find_package(LAPACK CONFIG REQUIRED)

How to compile libgit2 on windows using cmake?

I am trying to compile libgit2 and followed the instruction on https://libgit2.github.com/docs/guides/build-and-link/ but lock so far.
Can someone tell me what to do?
Here is the result from my command line:
-- Building for: Visual Studio 12 2013
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
-- zlib was not found; using bundled 3rd-party sources.
-- LIBSSH2 not found. Set CMAKE_PREFIX_PATH if it is installed outside of the default search path.
CMake Error at d:/cmake/share/cmake-3.3/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE)
Call Stack (most recent call first):
d:/cmake/share/cmake-3.3/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
d:/cmake/share/cmake-3.3/Modules/FindPythonInterp.cmake:162 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:594 (FIND_PACKAGE)
-- Configuring incomplete, errors occurred!
See also "D:/temp/gitlib/libgit2-master/build/CMakeFiles/CMakeOutput.log".
See also "D:/temp/gitlib/libgit2-master/build/CMakeFiles/CMakeError.log".
Thanks,
libgit2 uses python (works both with versions 2 and 3 of the language) to build the tests. You can install python or ask CMake not to build the tests.
IIRC CMake will look in a few standard locations you don't necessarily need python in your path, though it doesn't hurt.
If you would rather not build the tests, you can pass -DBUILD_CLAR=OFF so it doesn't bother looking for python.
Download Python from Paython.org and install it (i.e. d:\python). Then Open your VS command line and type PATH D:\Python\Python35-32;d:\cmake\bin;%PATH%
That's all set now, go to your build folder run cmake .. and then cmake --build .

SDL CMake Error

When running cmake . in my project directory, I get the following error:
CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:108 (message):
Could NOT find SDL (missing: SDL_LIBRARY SDL_INCLUDE_DIR)
Call Stack (most recent call first):
/usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:315 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-2.8/Modules/FindSDL.cmake:176 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:4 (find_package)
My CMakeLists.txt is as follows:
cmake_minimum_required(VERSION 2.8)
project( MoakRaster )
add_executable( MoakRaster MoakRaster.c )
find_package (SDL REQUIRED)
include_directories(${SDL_INCLUDE_DIR})
target_link_libraries (MoakRaster ${SDL_LIBRARY})
I've installed and removed and reinstalled both libsdl2-2.0 and libsdl2-2.0dev a hundred times, and downloaded the source and installed all the dependencies the source had, just in case sudo apt-get install libsdl2-2.0 wasn't including all of the dependencies.
The only thing I haven't done yet is compile the binary from the source code, which I'd rather not do because I'd prefer to keep extraneous files out of my project for now. If this is a known issue with FindSDL.cmake however, I'll start looking into making my own binary :/
EDIT: Apparently I needed SDL1.2.
EDIT2: And apparently SDL1.2 is borked now, since most of the documentation out there is for SDL2.0. Plus, none of the SDL calls/types work. Back to where I started.
EDIT3: Forget it, switching back to gcc. cmake and SDL are borked. It works.

CMake with Carbon and Cocoa

I'm currently trying to build MyGUI and CMake is telling me that Cocoa and Carbon are missing
Configuring MYGUI 3.2.0
Looking for FREETYPE...
Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
CMAKE_PREFIX_PATH: ~/Documents/SDK/OgreDependencies/;/Users/david/Documents/SDK/MyGUI_3.2.0/bin/Dependencies;/Users/david/Documents/SDK/MyGUI_3.2.0/Dependencies;/Users/david/Documents/SDK/MyGUI_3.2.0/bin/../Dependencies;/Users/david/Documents/SDK/MyGUI_3.2.0/../Dependencies;/usr/local
Found FREETYPE: /usr/X11R6/lib/libfreetype.dylib
Found OpenGL: /System/Library/Frameworks/OpenGL.framework
Looking for OIS...
Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
Found OIS: /Users/david/Documents/SDK/OgreDependencies/lib/release/libOIS.a
Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
Looking for Carbon...
Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
Could not locate Carbon
Looking for Cocoa...
Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
Could not locate Cocoa
Looking for IOKit...
Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
Could not locate IOKit
CMake Error at CMake/Utils/MacroLogFeature.cmake:91 (MESSAGE):
-- The following REQUIRED packages could NOT be located on your system.
-- Please install them before continuing this software installation.
-- If you are in Windows, try passing -DMYGUI_DEPENDENCIES_DIR=
-- Also check that you buildind with RenderSystem that you need or set
another with -DMYGUI_RENDERSYSTEM=<1 2 or 3 for Direct3D_9 OGRE or OpenGL>
Carbon: Carbon http://www.apple.com
Cocoa: Cocoa http://www.apple.com
Call Stack (most recent call first):
CMake/Dependencies.cmake:108 (MACRO_DISPLAY_FEATURE_LOG)
CMakeLists.txt:232 (include)
Configuring incomplete, errors occurred!
Am I supposed to install them seperately from XCode?
First of all, Cocoa and Carbon are base frameworks in OSX, no need to install anything except Xcode.
Your real problem seems to be that you are missing pkg-config on your system. pkg-config is a open source program that makes it easier to find other packages. I suggest that you install it using homebrew.
When you have installed homebrew you just have to run
brew install pkg-config
After that you can re-run the CMake script and you should probably have more luck. Just remember to delete the CMakeCache.txt file before you rerun.

how to get qt4 for a cmake build

I'm trying to build the latest sources of keepassX on OS X which I have found here: http://gitorious.org/keepassx .
I'm getting this error message complaining about a missing Qt4 library:
ernst#cnap-b13-01 ~/Temp/keepassx/build
[264] : cmake [-DCMAKE_INSTALL_PREFIX=/usr/local] [-DCMAKE_VERBOSE_MAKEFILE=ON] [-DWITH_GUI_TESTS=ON] ..
CMake Error at /Applications/CMake 2.8-7.app/Contents/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:91 (MESSAGE):
Could NOT find Qt4 (missing: QT_QMAKE_EXECUTABLE QT_MOC_EXECUTABLE
QT_RCC_EXECUTABLE QT_INCLUDE_DIR QT_LIBRARY_DIR QT_QTCORE_INCLUDE_DIR
QT_QTCORE_LIBRARY QT_QTGUI_INCLUDE_DIR QT_QTGUI_LIBRARY
QT_QTTEST_INCLUDE_DIR QT_QTTEST_LIBRARY QT_UIC_EXECUTABLE) (Required is at
least version "4.6.0")
Call Stack (most recent call first):
/Applications/CMake 2.8-7.app/Contents/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:252 (_FPHSA_FAILURE_MESSAGE)
/Applications/CMake 2.8-7.app/Contents/share/cmake-2.8/Modules/FindQt4.cmake:1171 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:68 (find_package)
-- Configuring incomplete, errors occurred!
Any ideas on how to get this compiling?
I was able to solve this by installing the Qt SDK using the Mac OS X online installer and passing -DQT_QMAKE_EXECUTABLE=~/QtSDK/Desktop/Qt/4.8.1/gcc/bin/qmake to cmake.
Note that as the /Developer directory is no longer there with XCode 4.3 I also had to do sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer /Developer in order for keepassx to find some header files and compile successfully.
If Qt4 is installed in your system set QT_QMAKE_EXECUTABLE to the path for the qmake binary. You can do that in cmake-gui or ccmake. Or even with the -D parameter to cmake.
Use the option -no-framework when configuring qt:
./configure -no-framework -static -prefix ~/Libraries/qt-installed

Resources