mysql connector c++ install on raspberryPi - c++

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

Related

how to install xhtml2pdf in python 3.11

i was using xhtml2pdf in django python 3.10 which was working well. now i upgraded my python version to 3.11. i tried to install pip intall xhtml2pdf, i get error
*********************************************************************************
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
*********************************************************************************
I already updated pip, setuptools and installed pillow, wheel.i already installed microsoft visal c++ 2015. i am unable to install libxml2. I do not know where to find a currect file and how to install. i am using windows 11 pro 64 Bit.
Please help me.
to install xhtml2pdf in python 3.11
If go to github and look at about libxml2
https://github.com/GNOME/libxml2
you can find manual how to build it.
CMake (mainly for Windows)
Another option for compiling libxml is using CMake:
cmake -E tar xf libxml2-xxx.tar.gz
cmake -S libxml2-xxx -B libxml2-xxx-build [possible options]
cmake --build libxml2-xxx-build
cmake --install libxml2-xxx-build
https://github.com/xhtml2pdf/xhtml2pdf/blob/master/requirements.txt
Y'll see what other libs you need.
arabic-reshaper>=2.1.0
coverage>=5.3
html5lib>=1.1
Pillow>=8.1.1
PyPDF3>=1.0.5
python-bidi>=0.4.2
reportlab>=3.5.53
svglib>=1.2.1
pyHanko>=0.12.1
pyhanko-certvalidator>=0.19.5
then use
pip list
and inspect output.

How to integrate vcpkg package manager with CMake project on Linux?

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

Cannot install llvm-9 or clang-9 on Ubuntu 16.04

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

Qt 5.6 install issue

I am really new to programming and Linux and I want to install PCL.
Now I want to install VTK and Qt 5.6. So I followed the steps on this site:
http://www.vtk.org/Wiki/VTK/Building/Linux
When I want to configure VTK I get this error:
CMake Error at /usr/lib/x86_64-linux-gnu/cmake/Qt5/Qt5Config.cmake:26 (find_package):
Could not find a package configuration file provided by "Qt5UiPlugin" with
any of the following names:
Qt5UiPluginConfig.cmake
qt5uiplugin-config.cmake
Add the installation prefix of "Qt5UiPlugin" to CMAKE_PREFIX_PATH or set
"Qt5UiPlugin_DIR" to a directory containing one of the above files. If
"Qt5UiPlugin" provides a separate development package or SDK, be sure it
has been installed.
Call Stack (most recent call first):
GUISupport/Qt/CMakeLists.txt:142 (find_package)
I searched the internet and got this:
http://www.qtcentre.org/threads/65284-vtk-integration-with-Qt-5-5
How can I recompile a programm? Can somebody help? I am really frustrated...
Thanks!!
What distro are you using? If you're on ubuntu you should try this:
sudo apt-get install qttools5-dev
sudo apt-get update
Hope that helps.

Boost C++ library Version Issue

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.