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

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?

Related

Lein clean and re-download dependencies

I'm working on setting up some password protected dependency repositories. I'd like to clear all dependency packages and re-download to make sure the package restore is working correctly.
How should I clear the lein package cache?
If there are no edge cases by additional plugins rm -rf ~/.m2/repository is the brute force version -- this removes all
deps ever downloaded by Leiningen (and also Maven and maybe others).
If you want to be very specific for a certain project, you can get the
list of all actual files by lein cp (Warning: this also contains your
source files! So you usually want the ones in ~/.m2/repository. Of
course you use version control and have backups and therefor no problem
here...). From the list of lein cp you would at least want to remove
the dirname portion to kill the version, or go up two for the whole
artifact.
Adding to the previous answer, you can list the individual directories under ~/.m2. For example:
~/expr/demo > d ~/.m2/repository/cl[jo]*
drwxr-xr-x 3 alan alan 4096 Jan 5 2017 /home/alan/.m2/repository/clj-aws-s3/
drwxr-xr-x 5 alan alan 4096 Nov 4 21:26 /home/alan/.m2/repository/clj-commons/
drwxr-xr-x 3 alan alan 4096 Mar 30 2018 /home/alan/.m2/repository/cljfmt/
drwxr-xr-x 3 alan alan 4096 Nov 15 2017 /home/alan/.m2/repository/clj-http/
drwxr-xr-x 3 alan alan 4096 Nov 15 2017 /home/alan/.m2/repository/clj-http-lite/
drwxr-xr-x 3 alan alan 4096 Sep 17 2018 /home/alan/.m2/repository/clj-jdbcutil/
drwxr-xr-x 3 alan alan 4096 Nov 18 2017 /home/alan/.m2/repository/clj-jgit/
drwxr-xr-x 3 alan alan 4096 Sep 17 2018 /home/alan/.m2/repository/clj-liquibase/
drwxr-xr-x 3 alan alan 4096 Jun 19 2018 /home/alan/.m2/repository/clj-logging-config/
drwxr-xr-x 3 alan alan 4096 Sep 17 2018 /home/alan/.m2/repository/clj-miscutil/
drwxr-xr-x 3 alan alan 4096 Apr 25 2020 /home/alan/.m2/repository/clj-python/
drwxr-xr-x 3 alan alan 4096 Apr 1 2018 /home/alan/.m2/repository/cljs-ajax/
drwxr-xr-x 3 alan alan 4096 Mar 13 2018 /home/alan/.m2/repository/cljsbuild/
drwxr-xr-x 3 alan alan 4096 Apr 20 2019 /home/alan/.m2/repository/cljs-commons/
drwxr-xr-x 3 alan alan 4096 Sep 17 2018 /home/alan/.m2/repository/cljs-http/
drwxr-xr-x 17 alan alan 4096 Jan 28 10:25 /home/alan/.m2/repository/cljsjs/
drwxr-xr-x 3 alan alan 4096 Dec 18 2019 /home/alan/.m2/repository/cljs-log/
drwxr-xr-x 3 alan alan 4096 Jan 25 2017 /home/alan/.m2/repository/clj-stacktrace/
drwxr-xr-x 3 alan alan 4096 Mar 30 2018 /home/alan/.m2/repository/cljs-tooling/
drwxr-xr-x 4 alan alan 4096 Mar 25 2019 /home/alan/.m2/repository/clj-time/
drwxr-xr-x 3 alan alan 4096 Jan 5 2017 /home/alan/.m2/repository/clj-tuple/
drwxr-xr-x 3 alan alan 4096 Nov 18 2017 /home/alan/.m2/repository/clj-yaml/
drwxr-xr-x 4 alan alan 4096 Jul 19 2018 /home/alan/.m2/repository/clojure/
drwxr-xr-x 3 alan alan 4096 Jan 5 2017 /home/alan/.m2/repository/clojure-complete/
drwxr-xr-x 3 alan alan 4096 Jan 5 2017 /home/alan/.m2/repository/clojure-csv/
You can then use rm -rf on a specific subset that you wish to test (i.e. force re-download).

Undefined reference in libpangoft2

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.

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.

ldd not finding shared object (.so) for xerces

I am trying to run a sample executable provided with Xalan C++ library, which requires a the Xerces C library. But I am not able to properly link the Xerces shared object file.
mike#ubuntu:~/Xalan-C_1_9_0-redhat_80-gcc_32/bin$ ldd SimpleXPathAPI
linux-gate.so.1 => (0xf7765000)
libxalan-c.so.19 => /home/mike/Xalan-C_1_9_0-redhat_80-gcc_32/lib/libxalan-c.so.19 (0xf7409000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xf73ab000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xf738e000)
libxerces-c.so.26 => not found
libxalanMsg.so.19 => /home/mike/Xalan-C_1_9_0-redhat_80-gcc_32/lib/libxalanMsg.so.19 (0xf7386000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf71d8000)
/lib/ld-linux.so.2 (0xf7768000)
libstdc++.so.5 => not found
libxerces-c.so.26 => not found
I included the location containing the libxerces-c.so in my LD_LIBRARY_PATH but ldd will not find it.
mike#ubuntu:~/Xalan-C_1_9_0-redhat_80-gcc_32/bin$ echo $LD_LIBRARY_PATH
/home/mike/Xalan-C_1_9_0-redhat_80-gcc_32/lib:/usr/local/lib
I even added a soft link to ensure the .26 is included.
mike#ubuntu:/usr/local/lib$ ls -l
total 98308
-rwxr-xr-x 1 root root 25560971 Aug 28 13:39 libxerces-c-3.1.so
-rw-r--r-- 1 root root 75080734 Aug 28 13:39 libxerces-c.a
-rwxr-xr-x 1 root root 962 Aug 28 13:39 libxerces-c.la
lrwxrwxrwx 1 root root 18 Aug 28 13:39 libxerces-c.so -> libxerces-c-3.1.so
lrwxrwxrwx 1 root root 14 Oct 21 10:31 libxerces-c.so.26 -> libxerces-c.so
drwxr-xr-x 2 root root 4096 Aug 28 13:39 pkgconfig
drwxrwsr-x 4 root staff 4096 Feb 18 2015 python2.7
drwxrwsr-x 3 root staff 4096 Feb 18 2015 python3.4
drwxr-xr-x 3 root root 4096 Jul 6 15:42 site_ruby
The first time I had this => not found issue with libxalan-c.so.19 I solved it by adding the location of that file to my LD_LIBRARY_PATH. So I can't figure out why the same fix is not working for the libxerces-c.so.26. Does anyone know what I'm doing wrong?
What does this produce:
cd /usr/local/lib
file -L ./libxerces-c.so.26
Chances are, this will print something like ELF 64-bit LSB shared object ..., in which case you are trying to point 32-bit executable at 64-bit libraries, and that doesn't work.
You need to download a 32-bit build of libxerces.