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

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?

Related

Building open source project(Mumble) in Qt via CMake on Windows

I'm attempting to build Mumble on my Windows 10 PC in Qt, and I'm running into some issues (I think I'm just a bit lost on some of the Qt, CMake, and build lingo). I've installed all of the required Qt packages through VCPKG, and I've built the program with almost no issues through the "x64 Native Tools Command Prompt for VS 2019"...
Here is the build documentation that Mumble provides.
I believe what's got me particularly confused is the CMake process. After getting the necessary packages installed, the Mumble instructions have you run the following cmake -G command.
cmake -G "NMake Makefiles" "-DVCPKG_TARGET_TRIPLET=x64-windows-static-md" "-Dstatic=ON" "-DCMAKE_TOOLCHAIN_FILE=D:\Users\Skewb\Documents\repos\vcpkg\scripts\buildsystems\vcpkg.cmake" "-DIce_HOME=D:\Users\Skewb\Documents\repos\vcpkg\installed\x64-windows-static-md" "-DCMAKE_BUILD_TYPE=Release" ..
Followed by the actual "build" command:
cmake --build .
From what I can tell, there's no place for me to input the cmake -G command in the "Build Settings" page. Here's where I've attempted to input it. I've been through the errors below, but I think my lack of understanding of cmake --build and cmake -G has made looking at these files unnecessary.
If I've somehow gotten that correct (I haven't), here's the error I'm getting. It's unable to find the "Ice" directory, but I've specified it in that command.
-- Qt5 component found: Widgets | Version: 5.15.2
CMake Error at cmake/pkg-utils.cmake:87 (message):
Ice component not found: Ice
Call Stack (most recent call first):
src/murmur/CMakeLists.txt:267 (find_pkg)
-- Configuring incomplete, errors occurred!
See also "C:/Users/skewb/AppData/Local/Temp/QtCreator-CfECuA/qtc-cmake-Kjqhpyja/CMakeFiles/CMakeOutput.log".
See also "C:/Users/skewb/AppData/Local/Temp/QtCreator-CfECuA/qtc-cmake-Kjqhpyja/CMakeFiles/CMakeError.log".
CMake process exited with exit code 1.
Elapsed time: 00:55.
I've also gone through these instructions and found the "CMake generator" option in the "Kits" settings, but I don't see anywhere to change the options you feed it:
I think I'm conflating a bunch of terms and their uses in the Mumble documentation vs. Qt including, but not limited to:
Build
Make
Run
Clean
Any help understanding this issue would be greatly appreciated.

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

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.

Building Qt project with cmake

Just installed QT and trying to build a QT project from inside the QTcreator using Cmake instead of Qmake.
I get the following error:
Starting to parse CMake project, using: "DCMAKE_BUILD_TYPE:STRING=Debug",
"-DCMAKE_CXX_COMPILER:STRING=",
"-DCMAKE_C_COMPILER:STRING=",
"DCMAKE_PREFIX_PATH:STRING=C:/Qt/5.13.1/msvc2015_64",
"DQT_QMAKE_EXECUTABLE:STRING=C:/Qt/5.13.1/msvc2015_64/bin/qmake.exe".
The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:3 (project):
The CMAKE_CXX_COMPILER:
cl
is not a full path and was not found in the PATH.
To use the JOM generator with Visual C++, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
unable to invoke the cl compiler. To fix this problem, run cmake from the
Visual Studio Command Prompt (vcvarsall.bat).
Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.
Configuring incomplete, errors occurred!
See also "C:/Users/tany/AppData/Local/Temp/QtCreator-pKrFgC/qtc-cmake-DqmsxZqd/CMakeFiles/CMakeOutput.log".
See also "C:/Users/tany/AppData/Local/Temp/QtCreator-pKrFgC/qtc-cmake-DqmsxZqd/CMakeFiles/CMakeError.log".
CMake Deprecation Warning:
The 'cmake-server(7)' is deprecated. Please port clients to use the
'cmake-file-api(7)' instead.
CMake Project parsing failed.
Now if I use the Cmake-GUI instead, I can configure and generate the project files successfully, after supplying the environment variable CMAKE_PREFIX_PATH.
But I can't get this to work from inside the QTcreator.
Anyone has any experience with using Cmake with QTcreator then please help.
Thank you!
The error message says that your C++ compiler Visual Studio 2015 (64 bits) could not be located. Maybe when you run cmake-gui it finds another C++ compiler like mingw?
In Qtcreator's settings dialog you have a tab showing the detected compilers, and another one with the available kits.
It seems that QtCreator is using a deprecated version of cmake. Update QtCreator to a new (unreleased, as writing this comment, version 4.10.0 is broken) or downgrade cmake to choco.exe install cmake --version 3.11 --force (a newer version might work).
Please also make sure to install jom (as this is the default for QtCreator/CMake on windows).
choco.exe install jom (how can I tell it to use make?)
The deprecation warning is harmless. CMake deprecated the cmake-server and provides a new API for the same purpose now. Qt Creator will support that from 4.11.
The error tells you, that CMake is unable find the cl compiler. cl.exe comes with Visual Studio. Make sure you mark C++ there during the installation process. It is not installed by default anymore.
Alternatively install the MinGW tool chain from the Qt installer. In Qt context it is easier to use than the Visual Studio tool chain.

Qt cannot find the standard header

The compilation is failing due to standard Qt include files/ library missing, why?
I have custom toolchain for devices. My compilation fails with messages:
In file included from /opt/STM/STLinux-2.3/devkit/sh4/target/usr/include/QtCore/QString:1:0,
from ./menuitems/Item.h:5,
from ./appmessages/AppMessageAgeLimit.h:4,
from appmessages/AMessageDispatcher.cpp:2:
/opt/STM/STLinux-2.3/devkit/sh4/target/usr/include/QtCore/qstring.h:60:22: fatal error: string: No such file or directory
It guess that this toolchain has been configured wrong but I don't know how to fix it. Below is output from "/opt/STM/STLinux-2.3/devkit/sh4/bin/sh4-linux-g++ -v" command - may be it will be useful:
Using built-in specs.
COLLECT_GCC=/opt/STM/STLinux-2.3/devkit/sh4/bin/sh4-linux-g++
COLLECT_LTO_WRAPPER=/opt/STM/STLinux-2.3/devkit/sh4/libexec/gcc/sh4-linux/4.8.2/lto-wrapper
Target: sh4-linux
Configured with: /home/viatcheslavvgavrilov/qt/gcc-4.8.2/configure --target=sh4-linux --prefix=/opt/STM/STLinux-2.3/devkit/sh4 --exec-prefix=/opt/STM/STLinux-2.3/devkit/sh4 --bindir=/opt/STM/STLinux-2.3/devkit/sh4/bin --sbindir=/opt/STM/STLinux-2.3/devkit/sh4/sbin --sysconfdir=/opt/STM/STLinux-2.3/devkit/sh4/etc --datadir=/opt/STM/STLinux-2.3/devkit/sh4/share --includedir=/opt/STM/STLinux-2.3/devkit/sh4/include --libdir=/opt/STM/STLinux-2.3/devkit/sh4/lib --libexecdir=/opt/STM/STLinux-2.3/devkit/sh4/libexec --localstatedir=/opt/STM/STLinux-2.3/devkit/sh4/var --sharedstatedir=/opt/STM/STLinux-2.3/devkit/sh4/share --mandir=/opt/STM/STLinux-2.3/devkit/sh4/man --infodir=/opt/STM/STLinux-2.3/devkit/sh4/info --enable-checking=assert --program-prefix=sh4-linux- --with-local-prefix=/opt/STM/STLinux-2.3/devkit/sh4 --with-sysroot=/opt/STM/STLinux-2.3/devkit/sh4/target --enable-languages=c,c++ --enable-threads=posix --enable-nls --enable-c99 --enable-long-long --with-system-zlib --enable-shared --disable-libgomp --enable-multilib --with-multilib-list=m4,m4-nofpu --enable-symvers=gnu --with-gxx-include-dir=/target/usr/include/c++/4.2.4 --enable-__cxa_atexit
Thread model: posix
gcc version 4.8.2 20131016 (GCC)
The compilation is failing due to standard Qt include files/ library missing, why?
Checking on qt.conf file section Paths prefix usually helps:
[Paths]
Prefix=/some/path
With my several statically built Qt flavors it is usually set to one of:
[Paths]
Prefix=/specific_prebuilt_qt/src/qtbase
And the default prefix may point to one directory up which can be the valid case but then make sure the path to Qt tool-chain is correct. Or where's bin folder for the Qt you intend to use? The folder where qmake tool is.
[Paths]
Prefix=..
Make sure after the prefix path fixed qmake executed for your project before building again.

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