Article 4SSNR tricky compilation and run

tricky compilation and run

by
schmi85
from LinuxQuestions.org on (#4SSNR)
I have obtained an NFC reader. Together with this reader I obtained an SDK, which basically has this directory layout:

PHP Code:/home/pi/SDK/
+/Examples/One/main.cpp
+/Libraries/Linux/One/
+libThinLayer.so.1.0.1
+/include
+some .h files
+/bin
to compile the first example I used this command:

PHP Code:
$pwd
/home/pi/SDK/

$g++ \
-o ./bin/one \
-I ./Libraries/Linux/One/include \
-L/home/pi/SDK/Libraries/Linux/One \
-l:libThinLayer.so.1.0.1 \
./Examples/One/main.cpp
But that did not succeed since the compiler stopped with this message:

PHP Code:/usr/bin/ld: warning: libcrypto.so.1.0.0, needed by ./Libraries/Linux/One/libThinLayer.so.1.0.1, not found (try using -rpath or -rpath-link)
Going further down on this, I noticed that libcrypto.so.1.0.0 is part of the openssl package, which is actually installed on that system, but in a newer version.

PHP Code:ldconfig -p | grep -i libcrypto
libcrypto.so.1.1 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libcrypto.so.1.1
That led me here where somebody suggested to create a symlink like so:

PHP Code:$cd /home/pi/SDK/Libraries/Linux/One/
$ln -s /usr/lib/arm-linux-gnueabihf/libcrypto.so.1.1 libcrypto.so.1.0.0

$ls -la
libcrypto.so.1.0.0 -> /usr/lib/arm-linux-gnueabihf/libcrypto.so.1.1
So, than, I digged deeper and deeper and finally cam up with this:

PHP Code:$pwd
/home/pi/SDK/

export LIB=$(pwd)/Libraries/Linux/One

g++ \
Examples/One/main.cpp \
-o bin/thin \
-I$LIB/include \
-L$LIB \
-Wl,-rpath=$LIB \
-l:libThinLayer.so.1.0.1 \
-l:libcrypto.so.1.0.0
This way the compilation actually succeeded. But

PHP Code:bin/thin
bin/thin: error while loading shared libraries: libcrypto.so.1.0.0: cannot open shared object file: No such file or directory
So the library is missing at runtime.

Is there any way make the executable use the one I just created as symlink?latest?d=yIl2AUoC8zA latest?i=Uv7cm36tpjk:ul31qhNrKEE:F7zBnMy latest?i=Uv7cm36tpjk:ul31qhNrKEE:V_sGLiP latest?d=qj6IDK7rITs latest?i=Uv7cm36tpjk:ul31qhNrKEE:gIN9vFwUv7cm36tpjk
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments