Cmake Error: could not load cache. Trouble-shooting advice? [duplicate] - r

System :
Linux anon-S 3.19.0-31-generic #36~14.04.1-Ubuntu SMP Thu Oct 8 10:21:08 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
CMake Version :
anon#anon-S:~/$ cmake --version
cmake version 3.2.2
Main CMakeLists.txt :
cmake_minimum_required(VERSION 3.0)
set(CMAKE_CXX_STANDARD 11)
add_subdirectory(${PROJECT_SOURCE_DIR}/src)
add_subdirectory(${PROJECT_SOURCE_DIR}/test)
But
anon#anon-S:/home/anon/project/build$ cmake ..
-- Configuring done
-- Generating done
-- Build files have been written to: /home/anon/project/
Build files have been written to: /home/anon/project/ instead /home/anon/project/build/
I haven't this problem on my Debian jessie with cmake 3.4.1 :
anon#anon-S:/home/anon/project/build$ cmake ..
-- The C compiler identification is GNU 5.2.1
-- The CXX compiler identification is GNU 5.2.1
-- 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
-- Detecting C compile features
-- Detecting C compile features - 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
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Doxygen: /usr/bin/doxygen (found version "1.8.11")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/anon/project/build/

To clarify what happened here:
When running cmake <directory> it does one of two things:
If <directory> is a source directory (ie. has a CMakeLists.txt in it), it will run CMake on that source and use the current working directory as the build directory.
If <directory> is a build directory (ie. has a CMakeCache.txt in it), it will run CMake on whatever source directory was used to create the build directory.
Note that the latter case takes precedence over the first one. That is, if you do the following:
cd <src_dir>
cmake .
*oops, wrong directory, i didn't mean that*
cd build
cmake ..
You might expect that this will run CMake with <src_dir> as the source and build as the build directory. But because of the first accidental CMake run, <src_dir> is now also a build directory for an in-source build! Hence the second run will ignore everything that is in build and instead use src_dir as both the source and build directory.
This is indeed a very nasty issue, but fortunately it can be solved very quickly once you realize what's happening: Simply remove the CMakeCache.txt from <src_dir>.
Note that in newer CMake versions (3.13 and up), you can use the -S and -B command line options to disambiguate the meaning of the directory argument:
-S <path-to-source>
Path to root directory of the CMake project to
build.
-B <path-to-build>
Path to directory which CMake will use as
the root of build directory.
If the directory doesn’t already exist CMake will make it.

Related

QT compilation error : QT for MCU Desktop

I have installed Visual stuido professional (16.9)
I am trying to compile QT for MCU Desktop app, getting this error :--
Is this CMAKE issue or compiler issue.
running C:\Qt\Tools\CMake_64\bin\cmake.exe -S C:/QT_projects_Dinesh/1/Hello_1 -B C:/QT_projects_Dinesh/1/build-Hello_1-Qt_for_MCUs_2_1_Desktop_32bpp-Debug in C:\QT_projects_Dinesh\1\build-Hello_1-Qt_for_MCUs_2_1_Desktop_32bpp-Debug.
-- The C compiler identification is MSVC 19.28.29924.0
-- The CXX compiler identification is MSVC 19.28.29924.0
-- The ASM compiler identification is MSVC
-- Found assembler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe
-- The ASM_MASM compiler identification is MSVC
-- Found assembler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/ml64.exe
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.28.29910/bin/HostX64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.28.29910/bin/HostX64/x64/cl.exe - broken
CMake Error at C:/Qt/Tools/CMake_64/share/cmake-3.21/Modules/CMakeTestCCompiler.cmake:69 (message):
The C compiler
"C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.28.29910/bin/HostX64/x64/cl.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/QT_projects_Dinesh/1/build-Hello_1-Qt_for_MCUs_2_1_Desktop_32bpp-Debug/CMakeFiles/CMakeTmp
Run Build Command(s):C:/Qt/Tools/Ninja/ninja.exe cmTC_daa73 && [1/2] Building C object CMakeFiles\cmTC_daa73.dir\testCCompiler.c.obj
[2/2] Linking C executable cmTC_daa73.exe
FAILED: cmTC_daa73.exe
cmd.exe /C "cd . && C:\Qt\Tools\CMake_64\bin\cmake.exe -E vs_link_exe --intdir=CMakeFiles\cmTC_daa73.dir --rc=rc --mt=CMAKE_MT-NOTFOUND --manifests -- C:\PROGRA~2\MICROS~2\2019\PROFES~1\VC\Tools\MSVC\1428~1.299\bin\Hostx64\x64\link.exe /nologo CMakeFiles\cmTC_daa73.dir\testCCompiler.c.obj /out:cmTC_daa73.exe /implib:cmTC_daa73.lib /pdb:cmTC_daa73.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
RC Pass 1: command "rc /fo CMakeFiles\cmTC_daa73.dir/manifest.res CMakeFiles\cmTC_daa73.dir/manifest.rc" failed (exit code 0) with the following output:
The system cannot find the file specified
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:3 (project)
-- Configuring incomplete, errors occurred!
See also "C:/QT_projects_Dinesh/1/build-Hello_1-Qt_for_MCUs_2_1_Desktop_32bpp-Debug/CMakeFiles/CMakeOutput.log".
See also "C:/QT_projects_Dinesh/1/build-Hello_1-Qt_for_MCUs_2_1_Desktop_32bpp-Debug/CMakeFiles/CMakeError.log".
CMake process exited with exit code 1.
Elapsed time: 00:04.

"Could NOT find OpenSSL" when opening GitAhead in Qt Creator

I can build GitAhead in a "x64 Native Tools Command Prompt for VS2017" just by following the README. All I have to do is:
Have CMake and ninja.exe in the PATH
Check out the project and submodules
In the VS Command prompt, change to the gitahead\build\release directory and run cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=C:\dev-tools\Qt\5.12.0\msvc2017_64 ../.. twice
It builds to completion and I get a GitAhead.exe.
Now I wondered if I can open the project in Qt Creator. According to this I just have to open CMakeLists.txt in Qt Creator.
At first that didn't work at all. By trial and error I came up with the following environment variables that I have to set in Options > Kits > Environment:
CC=cl
CXX=cl
LIB=C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\um\x64;C:\dev-tools\VisualStudioBuildTools\VC\Tools\MSVC\14.16.27023\lib\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x64
PATH=${PATH};C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x64;C:\dev-tools\VisualStudioBuildTools\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64
(This might not be the correct way, I don't know what I'm doing.)
But now I'm stuck. Now, when I click "Configure project" I get:
Running "C:\dev-tools\CMake\bin\cmake.exe -E server "--pipe=\\.\pipe\{7a503b92-9fbb-4075-960e-6a968505fe74}" --experimental" in C:\Users\andre\AppData\Local\Temp\QtCreator-lyJxiX\qtc-cmake-OgvZcaJK.
Starting to parse CMake project, using: "-DCMAKE_CXX_COMPILER:STRING=", "-DCMAKE_C_COMPILER:STRING=", "-DCMAKE_PREFIX_PATH:STRING=C:/dev-tools/Qt/5.12.0/msvc2017_64", "-DQT_QMAKE_EXECUTABLE:STRING=C:/dev-tools/Qt/5.12.0/msvc2017_64/bin/qmake.exe".
The C compiler identification is MSVC 19.16.27026.1
The CXX compiler identification is MSVC 19.16.27026.1
Check for working C compiler: C:/dev-tools/VisualStudioBuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe
Check for working C compiler: C:/dev-tools/VisualStudioBuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/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:/dev-tools/VisualStudioBuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe
Check for working CXX compiler: C:/dev-tools/VisualStudioBuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
Found Git: C:/dev-tools/Git/cmd/git.exe (found version "2.20.1.windows.1")
CMake Warning (dev) at dep/libssh2/libssh2/CMakeLists.txt:52 (option):
Policy CMP0077 is not set: option() honors normal variables. Run "cmake
--help-policy CMP0077" for policy details. Use the cmake_policy command to
set the policy and suppress this warning.
For compatibility with older versions of CMake, option is clearing the
normal variable 'BUILD_SHARED_LIBS'.
This warning is for project developers. Use -Wno-dev to suppress it.
Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY) (found version "1.1.1a")
Could NOT find Libgcrypt (missing: LIBGCRYPT_LIBRARY LIBGCRYPT_INCLUDE_DIR)
Looking for include files windows.h, bcrypt.h
Looking for include files windows.h, bcrypt.h - not found
CMake Error at dep/libssh2/libssh2/src/CMakeLists.txt:170 (message):
No suitable cryptography backend found.
Configuring incomplete, errors occurred!
See also "C:/Users/andre/AppData/Local/Temp/QtCreator-lyJxiX/qtc-cmake-OgvZcaJK/CMakeFiles/CMakeOutput.log".
See also "C:/Users/andre/AppData/Local/Temp/QtCreator-lyJxiX/qtc-cmake-OgvZcaJK/CMakeFiles/CMakeError.log".
CMake Project parsing failed.
I tried adding
OPENSSL_ROOT_DIR=C:\dev-projects\gitahead\dep\openssl\openssl
to the environment variables, but it makes no difference. I have no idea why CMake can find OpenSSL on the command line (in the VS Command Prompt) but not in Qt Creator. How can I debug this?

Building Supercollider from source, wrong version of qt.

I have Linux Mint 19, and i really want to install SuperCollider. I cant do it by apt-get, because there is old version which do not support SuperDirt. I need to build it from source. I use this guide:
https://github.com/supercollider/supercollider/wiki/Installing-SuperCollider-from-source-on-Ubuntu
Problem is with cmake:
cmake -qt=qt5.11 -DSC_EC=ON -DSC_EL=OFF -DSC_WII=OFF -DSC_IDE=ON ..
-- SuperCollider Version: 3.10.0-beta2
-- Building from branch develop, commit hash is f543f53
-- Build type defaulting to "RelWithDebInfo"
-- Compiling with Qt GUI
-- building boost libraries manually
-- using bundled libyaml-cpp
-- HIDAPI components:
-- linux hidraw
-- libudev stable: 1
-- Found UDev: /usr/lib/x86_64-linux-gnu/libudev.so
-- include: /usr/include
-- hidapi_parser
-- Building with HID support
-- Using fftw3f
-- Found jack: /usr/lib/x86_64-linux-gnu/libjack.so
-- Audio API: jack
-- Found GNU Readline version 6.3: /usr/lib/x86_64-linux-gnu/libreadline.so
CMake Error at QtCollider/CMakeLists.txt:3 (find_package):
Could not find a configuration file for package "Qt5" that is compatible
with requested version "5.7".
The following configuration files were considered but not accepted:
/usr/lib/x86_64-linux-gnu/cmake/Qt5/Qt5Config.cmake, version: 5.5.1
Call Stack (most recent call first):
lang/CMakeLists.txt:155 (include)
-- Configuring incomplete, errors occurred!
See also "/home/nedlo/programming/supcol/bsource/supercollider/build/CMakeFiles/CMakeOutput.log".
So i need at least qt5.7, but i have qt5.5.1 I dont know how to update qt. I installed Qt Creator 5.11, but how do i "show" cmake that i should use qt5.11, if it automatically checks path to /usr/lib/.../qt5 which has qt5.5.1? What am i supposed to do?
Set CMAKE_PREFIX_PATH to the directory in your Qt installation that contains bin, lib, include, etc. It typically looks something like this:
cmake -DCMAKE_PREFIX_PATH=/opt/Qt/5.11.2/gcc_64 ...

fatal error: ui_about.h: No such file or directory

I am trying to compile the following github package
https://github.com/openalpr/plate_tagger
Which makes use of qt. The output of cmake is as follows,
CMAKE o/p
-- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is GNU 4.8.4
-- 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
-- Configuring done
-- Generating done
-- Build files have been written to: /home/tonystark124/plate_tagger-master/build
When I try make, I am met with the following error :
MAKE o/p
Scanning dependencies of target openalpr_tagger_automoc
[ 1%] Automoc for target openalpr_tagger
Generating moc_about.cpp
Generating moc_directoryloader.cpp
Generating moc_dot.cpp
Generating moc_imageview.cpp
Generating moc_imageviewerbase.cpp
Generating moc_imageviewerobserver.cpp
Generating moc_imageviewerplateselector.cpp
Generating moc_mainwindow.cpp
Generating moc_options.cpp
Generating moc_plateselector.cpp
Generating moc_QProgressIndicator.cpp
Generating moc_squeezedlabel.cpp
Generating moc_threadedimageloader.cpp
[ 1%] Built target openalpr_tagger_automoc
Scanning dependencies of target openalpr_tagger
[ 3%] Building CXX object CMakeFiles/openalpr_tagger.dir/about.cpp.o
/home/tonystark124/plate_tagger-master/about.cpp:4:22: fatal error:
ui_about.h: No such file or directory
#include "ui_about.h"
^
compilation terminated.
make[2]: *** [CMakeFiles/openalpr_tagger.dir/about.cpp.o] Error 1
make[1]: *** [CMakeFiles/openalpr_tagger.dir/all] Error 2
make: *** [all] Error 2
Based on comments and suggestions, I tried to locate moc and uic associated with qt5, and I got the following output.
MOC
which moc
/usr/bin/moc
moc -v
moc 5.2.1
UIC
which uic
/usr/bin/uic
uic -v
uic 5.2.1
I raised an issue in the git, as no one else seems to have met this obstacle. Upon further search, I am inclined to conclude that am missing some installation/part of qt5. Link1 and Link2 suggest that this is to do with the qt5 and cmake too, but am not able to pinpoint the actual issue.
How do I solve this issue?
UPDATE
This is the output obtained by another person in their system. I have shown the o/p of their cmake and make, compared to mine.
CMAKE o/p
-- The C compiler identification is GNU 7.2.1
-- The CXX compiler identification is GNU 7.2.1
-- 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
-- Detecting C compile features
-- Detecting C compile features - 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
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: ~/plate_tagger-master/build
MAKE o/p
Scanning dependencies of target openalpr_tagger_autogen
[ 1%] Automatic MOC and UIC for target openalpr_tagger
Generating MOC source EWIEGA46WW/moc_about.cpp
Generating MOC source EWIEGA46WW/moc_directoryloader.cpp
Generating MOC source EWIEGA46WW/moc_dot.cpp
Generating MOC source EWIEGA46WW/moc_imageview.cpp
Generating MOC source EWIEGA46WW/moc_imageviewerbase.cpp
Generating MOC source EWIEGA46WW/moc_imageviewerobserver.cpp
Generating MOC source EWIEGA46WW/moc_imageviewerplateselector.cpp
Generating MOC source EWIEGA46WW/moc_mainwindow.cpp
Generating MOC source EWIEGA46WW/moc_options.cpp
Generating MOC source EWIEGA46WW/moc_plateselector.cpp
Generating MOC source 53XSUZAO35/moc_QProgressIndicator.cpp
Generating MOC source EWIEGA46WW/moc_squeezedlabel.cpp
Generating MOC source EWIEGA46WW/moc_threadedimageloader.cpp
Generating MOC compilation mocs_compilation.cpp
Generating UIC header include/ui_about.h
Generating UIC header include/ui_directoryloader.h
Generating UIC header include/ui_imageview.h
Generating UIC header include/ui_mainwindow.h
Generating UIC header include/ui_options.h
Generating UIC header include/ui_plateselector.h
[ 1%] Built target openalpr_tagger_autogen
Scanning dependencies of target openalpr_tagger
I do not understand why,but qmake did the trick, instead of cmake

compiling musescore for uCLinux with QT and cmake

I've try few things but I still have this error when trying to cmake for blackfin:
CMake Error at CMakeLists.txt:116 (message):
Fatal error: QT (version >= 4.5.0) required. Cmake tries to detect QT4 by
searching for 'qmake' in your PATH.If you have QT4 installed, make sure
qmake is found in your PATH. If you compiled QT4 yourself make sure your
new qmake ist found _first_ in your PATH.
I'm trying to compile the source of musescore 0.9.5 to keep it compatible with the existing version of QT in uClinux options
What I did is to compile the uClinux kernel with QT lib so I can have the suitable embedded QT.
then I modified the Makefile of musescore to build with uclinux compilers. I've try different things so I show here the latest trial:
bfin:
mkdir build;
mkdir install; \
cd build;
cmake -DCMAKE_TOOLCHAIN_FILE=bfin.cmake -DCMAKE_VERBOSE_MAKEFILE=TRUE -\
DQT_QMAKE_EXECUTABLE=/home/william/Development_new/Music_Recognition/code/uCLin\
ux/rev2011R1/uclinux-dist/lib/qt-embedded/build-qt-embedded-linux-opensource-sr\
c-4.5.1/bin -libdir=/home/william/Development_new/Music_Recognition/cod\
e/uCLinux/rev2011R1/uclinux-dist/lib/qt-embedded/build-qt-embedded-linux-openso\
urce-src-4.5.1/lib \
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
mscore;
in the CMakeLists.txt I did add:
link_directories(/home/william/Development_new/Music_Recognition/code/uCLinux/r\
ev2011R1/uclinux-dist/lib/qt-embedded/build-qt-embedded-linux-opensource-src-4.\
5.1/bin)
SET(CMAKE_MODULE_PATH /home/william/Development_new/Music_Recognition/code/uCLi\
nux/rev2011R1/uclinux-dist/lib/qt-embedded/build-qt-embedded-linux-opensource-s\
rc-4.5.1/bin)
SET(CMAKE_PREFIX_PATH /home/william/Development_new/Music_Recognition/code/uCLi\
nux/rev2011R1/uclinux-dist/lib/qt-embedded/build-qt-embedded-linux-opensource-s\
rc-4.5.1/bin)
SET(QT_QMAKE_EXECUTABLE /home/william/Development_new/Music_Recognition/code/uC\
Linux/rev2011R1/uclinux-dist/lib/qt-embedded/build-qt-embedded-linux-opensource\
-src-4.5.1/bin)
my bfin.cmake look like that:
# this one is important
SET(CMAKE_SYSTEM_NAME Linux)
#this one not so much
SET(CMAKE_SYSTEM_VERSION 1)
#
SET (BFIN "/opt/uClinux/bfin-uclinux")
# specify the cross compiler
SET(CMAKE_C_COMPILER ${BFIN}/bin/bfin-uclinux-gcc)
SET(CMAKE_CXX_COMPILER ${BFIN}/bin/bfin-uclinux-g++)
SET(CMAKE_LINKER ${BFIN}/bin/bfin-uclinux-ld)
#/opt/uClinux/bfin-uclinux/bfin-uclinux/runtime/usr/lib
LINK_DIRECTORIES("${BFIN}/usr/lib")
SET(CMAKE_FIND_ROOT_PATH
/opt/uClinux/bfin-uclinux/bfin-uclinux
/opt/uClinux/bfin-linux-uclibc
/opt/uClinux/bfin-linux-uclibc/bfin-linux-uclibc/runtime)
# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
Thanks in advance for the help,
William
You need to put qmake in your $PATH. If you prefer to use QT_QMAKE_EXECUTABLE it has to point to the actual qmake binary and not the directory.
That being said, MuseScore 0.9.5 is a very very old version of MuseScore, the current version is 1.1 and 1.2 is coming soon. Check http://musescore.org for more information about MuseScore and don't hesitate to contact the developers on #musescore on freenode.net or on the developer mailing list at http://musescore.org/mailing-list

Resources