I having trouble integrating vcpkg package manager with CMake project on Linux. I want to use the doctest library in my project but the same problem exists with other packages too. I performed the following steps.
$ vcpkg install doctest
Computing installation plan...
The following packages will be built and installed:
doctest[core]:x64-linux -> 2.4.9
Detecting compiler hash for triplet "x64-linux"...
Restored 1 packages from /home/bobeff/.cache/vcpkg/archives in 7.67 ms. Use --debug to see more details.
Installing 1/1 doctest:x64-linux...
Elapsed time to handle doctest:x64-linux: 2.183 ms
Total elapsed time: 390 ms
doctest provides CMake targets:
# this is heuristically generated, and may not be correct
find_package(doctest CONFIG REQUIRED)
target_link_libraries(main PRIVATE doctest::doctest)
$ vcpkg integrate install
Applied user-wide integration for this vcpkg root.
CMake projects should use: "-DCMAKE_TOOLCHAIN_FILE=/home/bobeff/projects/cpp/vcpkg/scripts/buildsystems/vcpkg.cmake"
I have a vcpkg.json file in the root directory of my project with the following content:
{
"name": "cpp-programming-language",
"version-string": "0.1.0",
"dependencies": [
"doctest"
]
}
$ cmake ../cpp_programming_language/ -DCMAKE_TOOLCHAIN_FILE=/home/bobeff/projects/cpp/vcpkg/scripts/buildsystems/vcpkg.cmake
The last command is giving me the following output:
CMake Error at CMakeLists.txt:7 (find_package):
Could not find a package configuration file provided by "doctest" with any
of the following names:
doctestConfig.cmake
doctest-config.cmake
Add the installation prefix of "doctest" to CMAKE_PREFIX_PATH or set
"doctest_DIR" to a directory containing one of the above files. If
"doctest" provides a separate development package or SDK, be sure it has
been installed.
-- Configuring incomplete, errors occurred!
See also "/home/bobeff/projects/cpp/temp/CMakeFiles/CMakeOutput.log".
When I perform the search for the not found files from the configure error message I have the following output:
$ locate doctestConfig.cmake
/home/bobeff/projects/cpp/vcpkg/buildtrees/doctest/x64-linux-dbg/generated/doctestConfig.cmake
/home/bobeff/projects/cpp/vcpkg/buildtrees/doctest/x64-linux-rel/generated/doctestConfig.cmake
/home/bobeff/projects/cpp/vcpkg/installed/x64-linux/share/doctest/doctestConfig.cmake
/home/bobeff/projects/cpp/vcpkg/packages/doctest_x64-linux/share/doctest/doctestConfig.cmake
Used versions of the programs are as follows:
CMake
$ cmake --version
cmake version 3.16.3
vcpkg
$ vcpkg --version
vcpkg package management program version 2022-06-17-9268e366206712e38102b28dbd1617697a99ff2e
Linux
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.4 LTS
Release: 20.04
Codename: focal
Related
I'm trying to build a C++ "Plug-in" that is part of "Orthanc" (Open Source Project). I've been doing that on both UBUNTU and OS X, but I'm having trouble using a version of Python other than the system installed version (High Sierra, Python 2.7) on OS X. I've tried installing Python 3.8 using the OS X package from the Python website and also using HomeBrew. I'm not real familiar with compiling stuff of OS X, but a little better on UNIX.
The CMakeLists.txt file is fairly long, but the relevant parts are probably:
if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
# The Python version cannot be controlled on OS X (yet)
set(PYTHON_VERSION "3.6" CACHE STRING "Version of Python to be used")
endif()
if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
find_package(PythonLibs)
if (NOT PYTHONLIBS_FOUND)
message(FATAL_ERROR "Cannot find the Python libraries")
endif()
message("Python library - Found version: ${PYTHONLIBS_VERSION_STRING}")
message("Python library - Path to include directory: ${PYTHON_INCLUDE_DIRS}")
message("Python library - Shared library: ${PYTHON_LIBRARIES}")
In the actual build there are a few lines of output about Python. The CLI for the build is:
cmake -DPYTHON_VERSION=3.8 -DSTATIC_BUILD=ON -DCMAKE_BUILD_TYPE=Release ../
although I've tried various things for the 3.8, but it always defaults back to 2.7.
-- Found PythonInterp: /usr/bin/python (found version "2.7.16")
-- Found PythonLibs: /usr/lib/libpython2.7.dylib (found version "2.7.16")
Python library - Found version: 2.7.16
Python library - Path to include directory: /usr/include/python2.7
Python library - Shared library: /usr/lib/libpython2.7.dylib
-- Configuring done
CMake Warning (dev):
Policy CMP0042 is not set: MACOSX_RPATH is enabled by default. Run "cmake
--help-policy CMP0042" for policy details. Use the cmake_policy command to
set the policy and suppress this warning.
MACOSX_RPATH is not specified for the following targets:
My .bash_profile is probably messed up, but this is the most recent version. I have installed both the 3.8 version using brew and the version from the .pkg on the Python website.
source ~/.profile
export NVM_DIR="/Users/sscotti/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
export PATH="/usr/local/bin:$PATH"
export PATH="/usr/local/sbin:$PATH"
# The version installed with HomeBrew
# export PATH="/usr/local/Cellar/python#3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/bin:/usr/local/Cellar/python#3.8/3.8.5/bin:$PATH"
# The version installed with OS X installer
# Setting PATH for Python 3.8
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.8/bin:${PATH}"
##
# Homebrew bash completion
##
if [ -f $(brew --prefix)/etc/bash_completion ]; then
source $(brew --prefix)/etc/bash_completion
fi
Seems that maybe:
find_package(PythonLibs)
is not finding my other version of Python ?
Any suggestions appreciated.
Just getting started with Python, and it is a little confusing about how to set up a couple of different version of Python for development purposes. I don't know if the brew or .pkg version of Python have the "dev packages" included.
Just a follow up to my question. I found that if I explicitly defined that paths for -DPYTHON_LIBRARY= and -DPYTHON_INCLUDE_DIR in the cmake, then it compiles fine and I can use various versions of Python on OS X if I want. I would imagine there is another more elegant way, but this works pretty well.
cmake -DPYTHON_LIBRARY=/usr/local/Cellar/python#3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/libpython3.8.dylib -DPYTHON_INCLUDE_DIR=/usr/local/Cellar/python#3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/include/python3.8/ -DPYTHON_VERSION=3.8 -DSTATIC_BUILD=ON -DCMAKE_BUILD_TYPE=Release ../
I have not been able to install either llvm version 9 or clang version 9 on Ubuntu. We have installed them on Windows.
I have tried a command and saw this response.
sudo apt-get install llvm-9
Reading package lists... Done
Building dependency tree
Reading state information...
Done E: Unable to locate package llvm-9
I have also tried and saw this response.
sudo apt-get install clang-9
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package clang-9
My /etc/apt/sources.list file contains
deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9.0 main
I found the website and saw that the folder was llvm-toolchain-xenial-9. Trying that version did not work either.
What else can I do?
I have looked at downloading the binaries but am not sure what installation steps I might be missing. I am not interested in compiling source code.
The Clang/LLVM project provides Nightly build packages for Ubuntu and Debian.
See the https://apt.llvm.org
The goal is to provide Debian and Ubuntu [Clang and LLVM] packages ready to be installed with minimal impact on the distribution.
Packages are available for amd64 and i386 (except for recent Ubuntu) and for both the stable, old-stable and development branches (currently 8, 9 and 10).
Packages are built using stage2 and extremely similar to the one shipping in Debian & Ubuntu.
To use:
Add the appropriate repositories to the /etc/apt/sources.list file; there are distinct repos for different Debian and Ubuntu versions.
Add the apt key (shown in the link).
Run an apt update to refresh the cache.
Add packages with apt install clang-9 (or other package as desired).
If something "did not work" using the vetted package system, diagnose that issue directly. Xenial has Clang/LLVM 9 packages, and I've recently installed the packages into Disco.
The described symptom ("Unable to locate package") sounds as though one neglected to run apt update, in which case the packages from the newly-added sources would not be visible to apt. This is a tool-usage issue, not a lack of available packages.
LLVM INSTALLATION STEPS
-----------------------
LLVM Compiler Prerequisites:
OPERATING SYSTEM : Ubuntu 16.04 LTS
RAM : Minimum 16GB to 32GB
SWAP MEMORY : Minimum 10GB to 20GB
MEMORY NEEDED : Minimum 70GB
Install CMake version 3.5.1:
$sudo apt install cmake
LLVM Compiler Installation Steps
Step1:
#download llvm from https://github.com/llvm/llvm-project/releases/download/llvmorg-8.0.1/llvm-8.0.1.src.tar.xz
#download clang from https://github.com/llvm/llvm-project/releases/download/llvmorg-8.0.1/cfe-8.0.1.src.tar.xz
#extract files into folders:
tar -xf cfe-8.0.1.src.tar.xz
tar -xf llvm-8.0.1.src.tar.xz
#change directory names to llvm8 and clang
mv cfe-8.0.1.src clang
mv llvm-8.0.1.src llvm8
Step2 : #change present working directory to llvm_source_directory here it is llvm8
$cd llvm8
##create build directory
$mkdir build
##change pwd to build directory
$cd build
#Build (PATH =/llvm8/build)
#execute following command in build directory:
$cmake -DLLVM_ENABLE_PROJECTS=clang -G "Unix Makefiles" ../
Step3: #execute make command in pwd:
/llvm8/build$ make
Step4 : #after 100% of linking process execute following command in build directory:
$sudo make install
$ sudo reboot
step5 : #after installation restart your system!
#for checking llvm installation type
$llvm-config --version #it shows 8.0.1
$clang --version #it shows 8.0.1
Here are the commands for LLVM 9:
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
sudo apt-get update
sudo apt-get install clang-9 libclang-9-dev llvm-9-dev
I'm trying to compile this wallet on Ubuntu 14.04 machine. I already compiled it for Linux using the docs:
mkdir build && cd build && cmake .. && make
But, unfortunately, I don't have a windows machine to compile it.
I tried installing mingw32 and compile using those toolchains, and then by using this answer but it didn't work and thrown an error:
CMake Error at CMakeLists.txt:19 (find_package):
By not providing "FindQt5Gui.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Qt5Gui", but
CMake did not find one.
Could not find a package configuration file provided by "Qt5Gui" with any
of the following names:
Qt5GuiConfig.cmake
qt5gui-config.cmake
Add the installation prefix of "Qt5Gui" to CMAKE_PREFIX_PATH or set
"Qt5Gui_DIR" to a directory containing one of the above files. If "Qt5Gui"
provides a separate development package or SDK, be sure it has been
installed.
PS: I already installed QT5 using apt-get install qt5-default.
I want to setup connector/c++ on my raspberry Pi to access a mysql db. At first I tried:
sudo apt-get install libmysqlcppconn-dev
which installed successfully, but the I got the error:
ERR: MySQL_Connection::setReadOnly() (MySQL error code: 0, SQLState: )
which comes with the version of cppconn I'm using, as its said here: MySQL Connector for C++ | MySQL_Connection::setReadOnly() exception on setSchema
And when I checked:
sudo apt-cache show libmysqlcppconn-dev
it said "version: 1.1.0-4"
So then I tried to install the latest package from source:
https://dev.mysql.com/downloads/connector/cpp/ which was under ->Source Code -> Generic Linux (Architecture Independent), Compressed TAR Archive
I downloaded it and did "tar xvzf mysql-...." and everything worked. But when I tried to build it with
cmake .
I got the error:
CMake Warning (dev) in CMakeLists.txt:
Syntax Warning in cmake code at
/home/pi/quadro/mysql-connector/CMakeLists.txt:114:24
Argument not separated from preceding token by whitespace.
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) in CMakeLists.txt:
Syntax Warning in cmake code at
/home/pi/quadro/mysql-connector/CMakeLists.txt:114:54
Argument not separated from preceding token by whitespace.
This warning is for project developers. Use -Wno-dev to suppress it.
-- mysql_config was found /etc/mysql
CMake Error at FindMySQL.cm:165 (MESSAGE):
mysql_config wasn't found, -DMYSQL_CONFIG_EXECUTABLE=...
Call Stack (most recent call first):
CMakeLists.txt:55 (INCLUDE)
CMake Error at FindMySQL.cm:167 (MESSAGE):
Cannot find MySQL. Include dir: MYSQL_INCLUDE_DIR-NOTFOUND library dir:
cxxflags:
Call Stack (most recent call first):
CMakeLists.txt:55 (INCLUDE)
-- Configuring incomplete, errors occurred!
See also "/home/pi/quadro/mysql-connector/CMakeFiles/CMakeOutput.log".
I know it means, it cant find the mysql_config, but neither do I know how to tell it where the file is, nor where the file actually is.
So please help me. I'm so sick of this.
Thanks alot.
EDIT:
I tried to install the latest packages manually, which I downloaded from:
https://packages.debian.org/jessie/armhf/libmysqlcppconn-dev/download
sudo dpkg -i libmysqlcppconn7_1.1.3-6_armhf.deb
sudo dpkg -i libmysqlcppconn-dev_1.1.3-6_armhf.deb
And now I get:
$ sudo apt-cache show libmysqlcppconn-dev
Package: libmysqlcppconn-dev
Status: install ok installed
Priority: optional
Section: libdevel
Installed-Size: 3213
Maintainer: Debian MySQL Maintainers <pkg-mysql- maint#lists.alioth.debian.org>
Architecture: armhf
Source: mysql-connector-c++
Version: 1.1.3-6
Depends: libboost-dev, libmysqlcppconn7 (= 1.1.3-6)
Description: MySQL Connector for C++ (development files)
MySQL Connector/C++ is a MySQL database connector for C++.
.
It mimics the JDBC 4.0 API.
.
This package contains the development files (headers, static library).
Package: libmysqlcppconn-dev
Source: mysql-connector-c++
Version: 1.1.0-4
Architecture: armhf
Maintainer: Debian MySQL Maintainers <pkg-mysql- maint#lists.alioth.debian.org>
Installed-Size: 3382
Depends: libboost-dev, libmysqlcppconn5 (= 1.1.0-4)
Homepage: http://forge.mysql.com/wiki/Connector_C++
Priority: optional
Section: libdevel
Filename: pool/main/m/mysql-connector-c++/libmysqlcppconn-dev_1.1.0- 4_armhf.deb
Size: 602550
SHA256: 286b6bf2ef3eb05dc8660a31780dd9af65c06f7d0d675257636281b2de056e15
SHA1: e53eeb1cf70c7522f557bbb6cbf0a753c6788fbb
MD5sum: 8770d029c21d086a48279c1f6e92f4a6
Description: MySQL Connector for C++ (development files)
MySQL Connector/C++ is a MySQL database connector for C++.
.
It mimics the JDBC 4.0 API.
.
This package contains the development files (headers, static library).
Is this good or bad?
You need to install the MySQL client library development files:
apt-get install libmysqlclient-dev
An easier way to try and ensure you have all dependencies installed, is to ask apt to install all build dependencies for it's packaged version:
apt-get build-dep libmysqlcppconn-dev
The libmysqlclient-dev package doesn't exist anymore. I guess it was renamed. So to install the c++ connector there is this new package:
sudo apt install libmysql++-dev
After downloading and untar the file "boost_1_56_0.tar.gz", I have installed Boost C++ library version "boost_1_56_0" in CentOS Linux.
I have run the following commands to install:
sudo ./bootstrap.sh --prefix=/usr/local
sudo ./b2 install.
I also added two paths to the PATH variable:
export PATH=$PATH:/usr/local/include/:/usr/local/lib/
It has been successfully installed. However when I checked the version it showed different version:
$ cat /usr/include/boost/version.hpp | grep "BOOST_LIB_VERSION"
#define BOOST_LIB_VERSION "1_33_1"
I have tried to install boost_1_55_0 as well in another folder but unfortunately still it shows version 1_33_1.
Can anyone here tell me how I can fix this issue?
Because of this issue, I am unable to configure Graph_tool; it shows following error:
checking for boostlib >= 1.53.0... configure: error: We could not detect the boost libraries (version 1.53 or higher). If you have a staged boost library (still not installed) please specify $BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in . See http://randspringer.de/boost for more documentation>
Your bootstrap path is /usr/local. Make sure your BOOST_ROOT points to your bootstrapped folder, not the installed 1.33 version.