Attempting to compile with cmake - c++

I'm attempting to compile a program with dependencies in Cmake and Qt (on Mountain Lion). The code
cmake build
returns
CMake Error at /Applications/CMake 2.8-12.app/Contents/share/cmake-2.8/Modules/FindQt4.cmake:1386 (message):
Found unsuitable Qt version "" from NOTFOUND, this code requires Qt 4.x
Call Stack (most recent call first):
CMakeLists.txt:195 (FIND_PACKAGE)
-- Configuring incomplete, errors occurred!
The current Qt version is 5.1.1, which I have installed in ~/bin/ and I'm not sure how to get Cmake to find it.

The error is saying this code requires Qt 4.x then for what are you wandering? it is due to line FIND_PACKAGE(Qt4 REQUIRED) though Cmake version should support Qt5 but may be your CmakeList is not proper written for that.
Follow this document to correct your CmakeList.

Related

"TBB library cannot be found" CMake on MacOS

I'm trying to build PrusaSlicer from source on Mac. I don't have any experience with CMake. I'm following the instructions given here.
Every time I try to build dependencies. This command cmake ..gives me errors. Earlier it was saying "Boost cannot be found." I fixed that by installing boost with brew. Now it's stuck on TBB.
OS X SDK Path: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk
OS X Deployment Target: (default)
-- Boost::boost exists
CMake Error at /opt/local/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
TBB library cannot be found. Consider set TBBROOT environment variable.
(missing: TBB_LIBRARIES) (found version "2020.3")
Call Stack (most recent call first):
/opt/local/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
cmake/modules/FindTBB.cmake.in:286 (find_package_handle_standard_args)
cmake/modules/FindTBB.cmake:29 (include)
CMakeLists.txt:384 (find_package)
-- Configuring incomplete, errors occurred!
I have installed TBB. If you would notice even this error has the version listed.
Things I have tried:
Installing boost, cmake and tbb via brew.
Installing boost, cmake and tbb via macports.
Try the following
cmake .. -DTBB_LIBRARYDIR=/opt/intel/tbb/lib/intel64/gcc4.8 -DTBB_INCLUDEDIR=/opt/intel/tbb/include
Note the subtle differences in the CMake var names and the path to include, not include/tbb.Let me know how that goes

Cmake error: unsuitable Qt version

I'm trying to run cmake via cmd (Windows) on a project I downloaded from GitHub, using cmake.
However, I'm getting the following error:
-- Found unsuitable Qt version "5.6.2" from C:/Anaconda2/Library/bin/qmake.exe
CMake Error at 3rdParty/FindMatlab-rwp.cmake:50 (MESSAGE):
Generator not compatible: MinGW Makefiles
Call Stack (most recent call first):
CMakeLists.txt:427 (find_package)
Any ideas what might be wrong? I tried to find info about the Qt mentioned, but I came up with nothing.

qttorch Build Error Ubuntu 14.04

I'm trying to install qttorch package on Ubuntu 14.04,
but I get this error during installation:
CMake Warning at /usr/share/cmake-3.2/Modules/FindQt4.cmake:626 (message):
/usr/bin/qmake reported QT_INSTALL_LIBS as "/usr/lib/x86_64-linux-gnu" but
QtCore could not be found there. Qt is NOT installed correctly for the
target build environment.
Call Stack (most recent call first):
CMakeLists.txt:38 (FIND_PACKAGE)
CMake Error at /usr/share/cmake-3.2/Modules/FindQt4.cmake:634 (message):
Could NOT find QtCore. Check
/tmp/luarocks_qtlua-scm-1-2765/qtlua/build/CMakeFiles/CMakeError.log for
more details.
Call Stack (most recent call first):
CMakeLists.txt:38 (FIND_PACKAGE)
-- Configuring incomplete, errors occurred!
See also "/tmp/luarocks_qtlua-scm-1-2765/qtlua/build/CMakeFiles/CMakeOutput.log".
Error: Failed installing dependency: https://raw.githubusercontent.com/torch/rocks/master/qtlua-scm-1.rockspec - Build error: Failed building.
Is libqtcore4 the right package for QTCore? or is there another package that should be installed?
because it's already installed in "/usr/lib/x86_64-linux-gnu" as qmake reported!
I also tried reinstalling it, but still the same error!!
In most Linux distributions the packages are split between development and none-development parts. Usually the normal package only includes the shared library, data and executables while the dev package adds headers, static libraries and build tools like qmake. I assume this split is done to save space.
For ubuntu the dev packages usually has the -dev suffix. So try if a libqtcore4-dev package exists. Otherwise, libqt4-dev should include it.

Make Qt5 default for Cmake

I am trying to build amarok in my ubuntu 12. I have installed Qt5 and Qt4.8.1 both in my PC. When I am trying to build and I am getting the following error in Cmake.
CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:108 (message): Could NOT find Qt4: Found unsuitable version "4.8.2", but required is at least "4.8.3" (found /usr/bin/qmake) Call Stack (most recent call first): /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:313 (_FPHSA_FAILURE_MESSAGE) /usr/share/cmake-2.8/Modules/FindQt4.cmake:1393 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) CMakeLists.txt:83 (find_package)
You need to use the Qt5 specific CMake functions, as documented on the Qt5 CMake documentation page:
cmake_minimum_required(VERSION 2.8.11)
find_package(Qt5Core)
Then there isn't any Qt 4 involved. Anywhere.

Phonon on Cygwin complains about Qt compiled without support for -fvisibility=hidden

I am trying to use the Phonon library in a test program in Cygwin.
CMake is used for building:
find_package(Phonon REQUIRED)
But it generates the following error message:
$ make
-- Found Qt-Version 4.8.5 (using /usr/bin/qmake-qt4)
-- Found X11: /usr/lib/libX11.dll.a
-- Found Automoc4: /usr/bin/automoc4.exe
CMake Error at /usr/share/phonon/buildsystem/FindPhononInternal.cmake:296 (message):
Qt compiled without support for -fvisibility=hidden. This will break
plugins and linking of some applications. Please fix your Qt installation.
Call Stack (most recent call first):
/usr/lib/cmake/phonon/PhononConfig.cmake:30 (include)
CMakeLists.txt:8 (find_package)
My test program was already using Qt successfully, and I installed both Qt and Phonon with the cygwin setup program.
I tried to compile the test program that is used in Phonon's CMake script:
#include <QtCore/QtGlobal>
int main()
{
#ifndef QT_VISIBILITY_AVAILABLE
#error QT_VISIBILITY_AVAILABLE is not available
#endif
}
And this program does not compile, indeed:
main.cpp:24:3: error: #error QT_VISIBILITY_AVAILABLE is not available
#error QT_VISIBILITY_AVAILABLE is not available
^
So what is wrong here? I would think that if the Cygwin folks provide a package for Phonon, that they would have made sure that it is compatible with their Qt package. The problem only happens on Cygwin, I tried it on my Gentoo machine and it compiles without problems there.
On platforms which do not support ELF visibility attributes, such as Cygwin and Windows, KDE components need to be configured with -D__KDE_HAVE_GCC_VISIBILITY=NO in order to avoid this error. The Cygwin phonon package (as well as the Cygwin Ports KDE packages) are built with cygport, which handles this automatically in kde4_compile.