Undefined reference in libpangoft2 - c++

Recently I've installed GTK+ 3.22 and its dependencies:
GLib 2.50
Pango 1.40
Gdk-Pixbuf 2.36
Atk 2.22
GObject-Introspection 1.50
The installation was successful because I tried using some new features of GTK+ 3.22 in one of my Python projects and it worked. (Before the installation, if I tried using a new feature, Python would raise an exception)
I am also working on a game which is written in C++ and I'm using Cocos2d-x to create it. Before installing the above libraries, everything worked fine. After the new packages were installed, I built my game in CodeBlocks and the following error message was shown:
In file: /usr/local/lib/libpangoft2-1.0.so.0 undefined reference to 'pango_matrix_get_font_scale_factors'
After some research, I've found out from here that in Pango 1.37 the pango_matrix_get_font_scale_factors function was added which is exactly the function that my project cannot find. As mentioned above, I've installed Pango 1.40 as a requirement for GTK +3.22.
I've also tried installing libpangoft2-1.0-0 with apt-get install and the output was: libpangoft2-1.0-0 is already the newest version.
Out of curiosity I've also looked in /usr/local/lib to see if I can find the libpangoft2-1.0-0 library.
In /usr/local/lib I've ran the following command: ls -la | grep pango which gave me the following output:
-rwxr-xr-x 1 root staff 1095 Oct 30 14:08 libpango-1.0.la
lrwxrwxrwx 1 root staff 24 Oct 30 14:08 libpango-1.0.so -> libpango-1.0.so.0.4000.3
lrwxrwxrwx 1 root staff 24 Oct 30 14:08 libpango-1.0.so.0 -> libpango-1.0.so.0.4000.3
-rwxr-xr-x 1 root staff 1073136 Oct 30 14:08 libpango-1.0.so.0.4000.3
-rwxr-xr-x 1 root staff 1263 Oct 30 14:08 libpangocairo-1.0.la
lrwxrwxrwx 1 root staff 29 Oct 30 14:08 libpangocairo-1.0.so -> libpangocairo-1.0.so.0.4000.3
lrwxrwxrwx 1 root staff 29 Oct 30 14:08 libpangocairo-1.0.so.0 -> libpangocairo-1.0.so.0.4000.3
-rwxr-xr-x 1 root staff 216216 Oct 30 14:08 libpangocairo-1.0.so.0.4000.3
-rwxr-xr-x 1 root staff 1209 Oct 30 14:08 libpangoft2-1.0.la
lrwxrwxrwx 1 root staff 27 Oct 30 14:08 libpangoft2-1.0.so -> libpangoft2-1.0.so.0.4000.3
lrwxrwxrwx 1 root staff 27 Oct 30 14:08 libpangoft2-1.0.so.0 -> libpangoft2-1.0.so.0.4000.3
-rwxr-xr-x 1 root staff 397496 Oct 30 14:08 libpangoft2-1.0.so.0.4000.3
-rwxr-xr-x 1 root staff 1265 Oct 30 14:08 libpangoxft-1.0.la
lrwxrwxrwx 1 root staff 27 Oct 30 14:08 libpangoxft-1.0.so -> libpangoxft-1.0.so.0.4000.3
lrwxrwxrwx 1 root staff 27 Oct 30 14:08 libpangoxft-1.0.so.0 -> libpangoxft-1.0.so.0.4000.3
-rwxr-xr-x 1 root staff 157240 Oct 30 14:08 libpangoxft-1.0.so.0.4000.3
I tried reinstalling Pango 1.40, but the undefined reference error still persists.
I would also like to mention:
I am using Debian 8
Since installing GTK+ 3.22 my Nautilus looks like this, notice how I do not have icons (only some kind of replacement) next to the Close button and next to my HDDs (note that the black rectangles were added by me)
I am using i3 as a window manager
My question is, how can I solve the In file: /usr/local/lib/libpangoft2-1.0.so.0 undefined reference to 'pango_matrix_get_font_scale_factors' error?
Update
If I uninstall Pango 1.40 I do not get the error anymore, but GTK+ 3.22 will not work.
Update2
Maybe Pango 1.40.3 is not installed correctly. I described an interesting problem I am having here.

Related

is components version != package version normal when in cmake find_package?

my env:
cmake version 3.16.3
OpenSSL 1.1.0f 25 May 2017
cpp-httplib v0.7.0
my sysroot
-rw-r--r-- 1 developer developer 41292 Jan 14 2018 libcrypt.a
-rw-r--r-- 1 developer developer 3143988 Mar 29 2018 libcrypto.a
lrwxrwxrwx 1 developer developer 16 Mar 29 2018 libcrypto.so -> libcrypto.so.1.1
lrwxrwxrwx 1 developer developer 18 Mar 29 2018 libcrypto.so.1.0.0 -> libcrypto.so.1.0.2
-rwxrw-r-- 1 developer developer 1497376 Mar 29 2018 libcrypto.so.1.0.2
-rw-r--r-- 1 developer developer 1827956 Mar 29 2018 libcrypto.so.1.1
lrwxrwxrwx 1 developer developer 46 Mar 29 2018 libcrypt.so -> ../../../lib/arm-linux-gnueabihf/libcrypt.so.1
-rw-r--r-- 1 developer developer 269496 Oct 7 2017 libssl3.so
-rw-r--r-- 1 developer developer 490932 Mar 29 2018 libssl.a
lrwxrwxrwx 1 developer developer 13 Mar 29 2018 libssl.so -> libssl.so.1.1
-rwxrw-r-- 1 developer developer 320924 Mar 29 2018 libssl.so.1.0.2
-rw-r--r-- 1 developer developer 327952 Mar 29 2018 libssl.so.1.1
the CMakeLists.txt in cpp-httplib specifics that:
set(_HTTPLIB_OPENSSL_MIN_VER "1.1.1")
...
find_package(OpenSSL ${_HTTPLIB_OPENSSL_MIN_VER} COMPONENTS Crypto SSL QUIET)
...
target_link_libraries(${PROJECT_NAME} ${_INTERFACE_OR_PUBLIC}
OpenSSL::SSL OpenSSL::Crypto
)
I included cpp-httplib in my project, I built it and checked shared object with ldd, then I got
libssl.so.1.1 => /usr/lib/arm-linux-gnueabihf/libssl.so.1.1 (0x7572c000)
libcrypto.so.1.0.2 => /usr/lib/arm-linux-gnueabihf/libcrypto.so.1.0.2 (0x75ac3000)
libcrypto.so.1.1 => /usr/lib/arm-linux-gnueabihf/libcrypto.so.1.1 (0x754c6000)
I understand the version isn't matched exactly due to the EXACT option is not set.
but why libssl is linking to 1.1 only and libcrypto is linking to 1.0.2 and 1.1?

How do you get a list of all harddrives, usb drives etc. in c++ on linux?

I'm writing a custom file tree widget and need to display all currently connected storage devices. With the win32 api, this is very easy, as I can iterate over all volumes with FindNextVolumeW of the file api. On linux however, this seems to be quite a bit more complicated, as you can mount any anything at any given path. However, there should be at least a way to get all storage device (no cd/floppy drives though I guess, as the partition on the physical drive would have to be mounted somewhere on another storage device) as file managers are able to display them in their menus.
I tried reading all current mounts from /proc/mounts, but even after filtering only /dev/[sdX][nvme] devices, I'm still left with non storage devices like /boot/efi, loop devices and some other stuff.
The second attempt was to read /etc/fstab, but since there are only devices that are manually mounted at a custom path and the main partition, it does not provide a full list of all currently connected storage devices (eg. flash drives are completely missing).
The third attempt was to read /dev/disk/by-id, but I'm not really sure how to filter the actually used partitions, and it seems to even have duplicates.
I currently have 2 nvme m.2 drives, one sata harddisk drive and a usb flash drive connected, each having a single "real" partition, besides the normal system reserved partitions windows or linux need on the nvme drives. This is the content of the folder:
drwxr-xr-x 2 root root 480 Jan 27 23:19 .
drwxr-xr-x 8 root root 160 Jan 27 11:40 ..
lrwxrwxrwx 1 root root 9 Jan 27 11:40 ata-ST1500DL003-9VT16L_5YD5PM99 -> ../../sda
lrwxrwxrwx 1 root root 10 Jan 27 11:40 ata-ST1500DL003-9VT16L_5YD5PM99-part1 -> ../../sda1
lrwxrwxrwx 1 root root 13 Jan 27 11:40 nvme-eui.0025385271b0ce2b -> ../../nvme1n1
lrwxrwxrwx 1 root root 15 Jan 27 11:40 nvme-eui.0025385271b0ce2b-part1 -> ../../nvme1n1p1
lrwxrwxrwx 1 root root 15 Jan 27 11:40 nvme-eui.0025385271b0ce2b-part2 -> ../../nvme1n1p2
lrwxrwxrwx 1 root root 13 Jan 27 11:40 nvme-eui.002538bc01b07e00 -> ../../nvme0n1
lrwxrwxrwx 1 root root 15 Jan 27 11:40 nvme-eui.002538bc01b07e00-part1 -> ../../nvme0n1p1
lrwxrwxrwx 1 root root 15 Jan 27 11:40 nvme-eui.002538bc01b07e00-part2 -> ../../nvme0n1p2
lrwxrwxrwx 1 root root 15 Jan 27 11:40 nvme-eui.002538bc01b07e00-part3 -> ../../nvme0n1p3
lrwxrwxrwx 1 root root 15 Jan 27 11:40 nvme-eui.002538bc01b07e00-part4 -> ../../nvme0n1p4
lrwxrwxrwx 1 root root 13 Jan 27 11:40 nvme-Samsung_SSD_960_EVO_500GB_S3EUNX0J217275R -> ../../nvme1n1
lrwxrwxrwx 1 root root 15 Jan 27 11:40 nvme-Samsung_SSD_960_EVO_500GB_S3EUNX0J217275R-part1 -> ../../nvme1n1p1
lrwxrwxrwx 1 root root 15 Jan 27 11:40 nvme-Samsung_SSD_960_EVO_500GB_S3EUNX0J217275R-part2 -> ../../nvme1n1p2
lrwxrwxrwx 1 root root 13 Jan 27 11:40 nvme-Samsung_SSD_980_PRO_1TB_S5GXNF0NC26238D -> ../../nvme0n1
lrwxrwxrwx 1 root root 15 Jan 27 11:40 nvme-Samsung_SSD_980_PRO_1TB_S5GXNF0NC26238D-part1 -> ../../nvme0n1p1
lrwxrwxrwx 1 root root 15 Jan 27 11:40 nvme-Samsung_SSD_980_PRO_1TB_S5GXNF0NC26238D-part2 -> ../../nvme0n1p2
lrwxrwxrwx 1 root root 15 Jan 27 11:40 nvme-Samsung_SSD_980_PRO_1TB_S5GXNF0NC26238D-part3 -> ../../nvme0n1p3
lrwxrwxrwx 1 root root 15 Jan 27 11:40 nvme-Samsung_SSD_980_PRO_1TB_S5GXNF0NC26238D-part4 -> ../../nvme0n1p4
lrwxrwxrwx 1 root root 9 Jan 27 23:19 usb-SanDisk_Ultra_0401e72b70214457f9024196cfe7310c5cd6b2abba0d130404df526e5fbf585ef0650000000000000000000057816446009b071881558107b8a62b4f-0:0 -> ../../sdb
lrwxrwxrwx 1 root root 10 Jan 27 23:19 usb-SanDisk_Ultra_0401e72b70214457f9024196cfe7310c5cd6b2abba0d130404df526e5fbf585ef0650000000000000000000057816446009b071881558107b8a62b4f-0:0-part1 -> ../../sdb1
lrwxrwxrwx 1 root root 9 Jan 27 11:40 wwn-0x5000c5003dbd1150 -> ../../sda
lrwxrwxrwx 1 root root 10 Jan 27 11:40 wwn-0x5000c5003dbd1150-part1 -> ../../sda1
The actual used partitions are sda1 (random storage drive), nvme0n1p3 (windows drive), nvme1n1p2 (linux drive) and sdb1 (flash drive). I know the distinction between "used" and "not used" is not clearly defined and can be interpreted differently depending on the user, but what I basically want is the list of devices the file manager (in my case thunar) displays in this screenshot.
"Dateisystem" is the main linux drive, so /dev/nvme1n1p2, "Datenträger 1000 GB" is the main windows drive, so /dev/nvme0n1p3, "ESD-USB" is the flash drive, so /dev/sdb1. Note that /dev/sda1 is missing here, as it has a custom mount under /Files.
What would be a way to get exactly the same list of storage devices in c++?

Qt build version from shared object

Suppose I have an executable that uses qt library. I want to replace the shared object with a custom one. So how do I find the qt version so that I can build it myself from source?
P.S. All the files has names like libQt5**.so.5.
If you don't own a very special setup the exact version is part of the lib name; all others are symlinks. E. g. installed here is Qt 4.8.1:
$ ls -l /usr/lib/i386-linux-gnu/libQtCore.*
-rw-r--r-- 1 root root 680 Mai 27 2015 /usr/lib/i386-linux-gnu/libQtCore.prl
lrwxrwxrwx 1 root root 18 Mai 27 2015 /usr/lib/i386-linux-gnu/libQtCore.so -> libQtCore.so.4.8.1
lrwxrwxrwx 1 root root 18 Mai 27 2015 /usr/lib/i386-linux-gnu/libQtCore.so.4 -> libQtCore.so.4.8.1
lrwxrwxrwx 1 root root 18 Mai 27 2015 /usr/lib/i386-linux-gnu/libQtCore.so.4.8 -> libQtCore.so.4.8.1
-rw-r--r-- 1 root root 2,9M Mai 27 2015 /usr/lib/i386-linux-gnu/libQtCore.so.4.8.1
Additionally the libs provide macros and functions to access the version at build and run time: QT_VERSION, QT_VERSION_STR and qVersion().

adding tesseract library to c++ project in xcode

I'm playing with C++ and tesseract library in mac os. I installed tesseract library with brew install tesseract.
$ tesseract --version
tesseract 3.04.00
leptonica-1.72
libjpeg 8d : libpng 1.6.20 : libtiff 4.0.6 : zlib 1.2.5
I have tesseract installed in following path,
$ ll /usr/local/Cellar/tesseract/3.04.00/
total 72
-rw-r--r-- 1 prayagupd admin 440 Jul 11 2015 AUTHORS
-rw-r--r-- 1 prayagupd admin 1007 Jul 11 2015 COPYING
-rw-r--r-- 1 prayagupd admin 9773 Jul 11 2015 ChangeLog
-rw-r--r-- 1 prayagupd admin 332 Apr 6 19:44 INSTALL_RECEIPT.json
-rw-r--r-- 1 prayagupd admin 45 Jul 11 2015 NEWS
-rw-r--r-- 1 prayagupd admin 6326 Apr 6 19:44 README
drwxr-xr-x 3 prayagupd admin 102 Aug 21 2015 bin
drwxr-xr-x 3 prayagupd admin 102 Aug 21 2015 include
drwxr-xr-x 6 prayagupd admin 204 Aug 21 2015 lib
drwxr-xr-x 4 prayagupd admin 136 Aug 21 2015 share
What I want next is add tesseract lib to a C++ project (which I created with xcode). My assumption was tesseract is available to any c++ project once installed, but I can't see imports in my c++ project. It can't find the file baseapi.h.
I am following example from here - API examples
I feel like I still need to tesseract lib to c++ project in xcode, but don't know how.
Did you try looking under "$ ll /usr/local/Cellar/tesseract/3.04.00/api/" ? At least, it is where I found it on my tesseract folder.

mysqlclient library linkage problem

I am linking an application with mysqlclient library on 64-bit CentOS 5.4 and get a linkage error (cannot find -lmysqlclient).
The library is in /usr/lib64/mysql/:
una#localhost$ ll /usr/lib64/mysql/
total 9072
...
lrwxrwxrwx 1 root root 26 Jan 3 15:54 libmysqlclient_r.so -> libmysqlclient_r.so.15.0.0
lrwxrwxrwx 1 root root 26 Jan 3 15:54 libmysqlclient_r.so.15 -> libmysqlclient_r.so.15.0.0
-rwxr-xr-x 1 root root 1518456 Sep 4 01:28 libmysqlclient_r.so.15.0.0
lrwxrwxrwx 1 root root 24 Jan 3 15:54 libmysqlclient.so -> libmysqlclient.so.15.0.0
lrwxrwxrwx 1 root root 24 Jan 3 15:54 libmysqlclient.so.15 -> libmysqlclient.so.15.0.0
-rwxr-xr-x 1 root root 1514000 Sep 4 01:28 libmysqlclient.so.15.0.0
...
And the directory seems to be properly registered for Linux linker:
una#localhost$ cat /etc/ld.so.conf.d/mysql-x86_64.conf
/usr/lib64/mysql
The only way I can link the application on this machine is by specifying the full path to the library file which is unacceptable in my case.
What could cause the problem here?
Thanks.
-L/usr/lib64/mysql
The ld.so.conf stuff is only used at runtime, not compile time.
/usr/lib64/mysql is certainly not in your gcc's default search path. You may use a autoconf script to search for the installation path of libmysqlclient on this kind of a distribution, and dynamically use the found location with the -L flag.