How to uninstall older versions of libcrypro library - c++

I am trying to link the Unified Automation c++ OPCUA Stack to my project, but I am getting the warning :
libcrypto.so.1.1, needed by libuastackd.so, may conflict with libcrypto.so.1.0.0
Followed by the error:
:-1: error: libuapkicppd.a(uapkicertificate.cpp.o): undefined reference to symbol 'OPENSSL_sk_num##OPENSSL_1_1_0'
From the command prompt, ldconfig on the shared libraries returns:
craig#craig-B250-HD3P:~$ ldconfig -p | grep libssl
libssl3.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libssl3.so
libssl.so.1.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libssl.so.1.1
libssl.so.1.0.0 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libssl.so.1.0.0
libssl.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libssl.so
craig#craig-B250-HD3P:~$ ldconfig -p | grep libcrypto
libcrypto.so.1.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1
libcrypto.so.1.0.0 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
libcrypto.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libcrypto.so
libcrypto++.so.6 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libcrypto++.so.6
craig#craig-B250-HD3P:~$
Can I safely delete libssl.so.1.0.0 (libc6,x86-64) and libcrypto.so.1.0.0?

Related

How to solve linking problems with manually installed cuda?

I'm trying desperately to get the cuda toolkit running on my debian system, having cuda 11.7 and the nvidia drivers 515 installed via the .run file.
Unfortunately, I always get false when checking for cudart and curand libraries with my autoconf script. Skipping the checks, results in a missing cuda.h error while compiling (c++).
Runing nvcc --version:
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Wed_Jun__8_16:49:14_PDT_2022
Cuda compilation tools, release 11.7, V11.7.99
Build cuda_11.7.r11.7/compiler.31442593_0
In my ~/.bashrc i added:
export PATH=${PATH}:/usr/local/cuda-11.7/bin
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/cuda-11.7/lib64
I also tried to add /usr/local/cuda-11.7/lib64 to ld.so.conf. Runing sudo ldconfig -v | grep cuda gives:
ldconfig: Can't stat /usr/local/cuda-11/targets/x86_64-linux/lib: No such file or directory
ldconfig: Path `/usr/local/cuda-11.7/targets/x86_64-linux/lib' given more than once
ldconfig: Can't stat /usr/local/cuda-11.4/targets/x86_64-linux/lib: No such file or directory
ldconfig: Can't stat /usr/local/lib/x86_64-linux-gnu: No such file or directory
ldconfig: Path `/usr/lib/x86_64-linux-gnu' given more than once
ldconfig: Path `/usr/lib32' given more than once
ldconfig: Path `/usr/local/cuda-11.7/lib64' given more than once
ldconfig: Path `/lib/x86_64-linux-gnu' given more than once
ldconfig: Path `/usr/lib/x86_64-linux-gnu' given more than once
ldconfig: Path `/usr/lib' given more than once
ldconfig: /lib/x86_64-linux-gnu/ld-2.31.so is the dynamic linker, ignoring
/usr/local/cuda/targets/x86_64-linux/lib:
libcudart.so.11.0 -> libcudart.so.11.7.99
libicudata.so.67 -> libicudata.so.67.1
libcuda.so.1 -> libcuda.so.515.65.01
ldconfig: /lib32/ld-2.31.so is the dynamic linker, ignoring
libcuda.so.1 -> libcuda.so.515.65.01
Running sudo ldconfig -p | grep cuda gives the following output:
libnvrtc.so.11.2 (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libnvrtc.so.11.2
libnvrtc.so (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libnvrtc.so
libnvrtc-builtins.so.11.7 (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libnvrtc-builtins.so.11.7
libnvrtc-builtins.so (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libnvrtc-builtins.so
libnvjpeg.so.11 (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libnvjpeg.so.11
libnvjpeg.so (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libnvjpeg.so
libnvblas.so.11 (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libnvblas.so.11
libnvblas.so (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libnvblas.so
libnvToolsExt.so.1 (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libnvToolsExt.so.1
libnvToolsExt.so (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libnvToolsExt.so
libnpps.so.11 (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libnpps.so.11
libnpps.so (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libnpps.so
libnppitc.so.11 (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libnppitc.so.11
libnppitc.so (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libnppitc.so
libnppisu.so.11 (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libnppisu.so.11
libnppisu.so (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libnppisu.so
libnppist.so.11 (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libnppist.so.11
libnppist.so (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libnppist.so
libnppim.so.11 (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libnppim.so.11
libnppim.so (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libnppim.so
libnppig.so.11 (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libnppig.so.11
libnppig.so (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libnppig.so
libnppif.so.11 (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libnppif.so.11
libnppif.so (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libnppif.so
libnppidei.so.11 (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libnppidei.so.11
libnppidei.so (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libnppidei.so
libnppicc.so.11 (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libnppicc.so.11
libnppicc.so (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libnppicc.so
libnppial.so.11 (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libnppial.so.11
libnppial.so (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libnppial.so
libnppc.so.11 (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libnppc.so.11
libnppc.so (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libnppc.so
libicudata.so.67 (libc6,x86-64) => /lib/x86_64-linux-gnu/libicudata.so.67
libicudata.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libicudata.so
libcusparse.so.11 (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libcusparse.so.11
libcusparse.so (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libcusparse.so
libcusolverMg.so.11 (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libcusolverMg.so.11
libcusolverMg.so (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libcusolverMg.so
libcusolver.so.11 (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libcusolver.so.11
libcusolver.so (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libcusolver.so
libcurand.so.10 (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libcurand.so.10
libcurand.so (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libcurand.so
libcuinj64.so.11.7 (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libcuinj64.so.11.7
libcuinj64.so (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libcuinj64.so
libcufile_rdma.so.1 (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libcufile_rdma.so.1
libcufile_rdma.so (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libcufile_rdma.so
libcufile.so.0 (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libcufile.so.0
libcufile.so (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libcufile.so
libcufftw.so.10 (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libcufftw.so.10
libcufftw.so (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libcufftw.so
libcufft.so.10 (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libcufft.so.10
libcufft.so (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libcufft.so
libcudart.so.11.0 (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libcudart.so.11.0
libcudart.so (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libcudart.so
libcuda.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libcuda.so.1
libcuda.so.1 (libc6) => /lib32/libcuda.so.1
libcuda.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libcuda.so
libcuda.so (libc6) => /lib32/libcuda.so
libcublasLt.so.11 (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libcublasLt.so.11
libcublasLt.so (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libcublasLt.so
libcublas.so.11 (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libcublas.so.11
libcublas.so (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libcublas.so
libaccinj64.so.11.7 (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libaccinj64.so.11.7
libaccinj64.so (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libaccinj64.so
libOpenCL.so.1 (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libOpenCL.so.1
libOpenCL.so (libc6,x86-64) => /usr/local/cuda/targets/x86_64-linux/lib/libOpenCL.so
Compilation works fine, when cuda was installed with apt, but I need a newer version than available in apt.
I would be glad, if someone could give me a hint about this. I am relatively new to the Linux world and therefore have problems to fix things myself.
As Fareanor explained, part of the solution was to add cuda to LIBRARY_PATH.
I also had to add cuda to CPATH.
Now it works and .bashrc contains:
export PATH=${PATH}:/usr/local/cuda-11.7/bin
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/cuda-11.7/lib64
export LIBRARY_PATH=${LIBRARY_PATH}:/usr/local/cuda-11.7/lib64
export CPATH=$CPATH:/usr/local/cuda/include

Linker can't find mathgl library

I try to make mathgl work, but the linker can't find the library. I installed it through the user repository from arch linux.
I just copied the example program:
#include <mgl2/mgl.h>
int main()
{
mglGraph gr;
gr.FPlot("sin(pi*x)");
gr.WriteFrame("test.png");
}
The official website states you need to link lmgl, but I get this error:
$ g++ main.cpp -lmgl
/usr/bin/ld: cannot find -lmgl
collect2: error: ld returned 1 exit status
I couldn't figure out where to start looking for the library. How can I see where it was installed?
I was looking for libmgl with ldconfig -p getting these results:
$ ldconfig -p | grep libmgl
libmgl2.so.7.5.0 (libc6,x86-64) => /usr/lib/libmgl2.so.7.5.0
libmgl2.so (libc6,x86-64) => /usr/lib/libmgl2.so
libmgl2-qt5.so.7.5.0 (libc6,x86-64) => /usr/lib/libmgl2-qt5.so.7.5.0
libmgl2-qt5.so (libc6,x86-64) => /usr/lib/libmgl2-qt5.so
libmgl2-qt.so.7.5.0 (libc6,x86-64) => /usr/lib/libmgl2-qt.so.7.5.0
libmgl2-qt.so (libc6,x86-64) => /usr/lib/libmgl2-qt.so
libmgl2-glut.so.7.5.0 (libc6,x86-64) => /usr/lib/libmgl2-glut.so.7.5.0
libmgl2-glut.so (libc6,x86-64) => /usr/lib/libmgl2-glut.so
As Amadeus indicated, using
$ g++ main.cpp -lmgl2
should work.

How to resolve warning /usr/bin/ld: warning: libtiff.so.4, needed by /home/user/libs/opencv/lib/libopencv_highgui.so, may conflict with libtiff.so.5?

Some C++ project use TIFF library and OpenCV library at the same time.
The following warning is produced:
/usr/bin/ld: warning: libtiff.so.4, needed by /home/user/libs/opencv/lib/libopencv_highgui.so, may conflict with libtiff.so.5,
How can it be resolved?
If it matters I'm using Ubuntu and Eclipse.
/sbin/ldconfig -p > libs.txt show me
libtiffxx.so.0 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libtiffxx.so.0
libtiffxx.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libtiffxx.so
libtiff.so.4 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libtiff.so.4
libtiff.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libtiff.so
libopencv_highgui.so.2.4 (libc6,x86-64) => /usr/local/lib/libopencv_highgui.so.2.4
libopencv_highgui.so.2.3 (libc6,x86-64) => /usr/lib/libopencv_highgui.so.2.3
libopencv_highgui.so (libc6,x86-64) => /usr/lib/libopencv_highgui.so
But I don't know what it means, different versions of library?
I suggest you try the following:
find a newer version of libopencv_highgui.so compiled with libtiff.so.5
recompile libopencv_highgui.so with libtiff.so.5
delete libtiff.so.4 and make a symlink to libtiff.so.5 if you get a linker error

Compiling OpenGL Program (Linux) - Cannot find -lGL

I am attempting to compile a test opengl program on ubuntu. I have installed bumblebee, the nvidia 304 driver and libgl1-mesa-dev, using apt-get.
I can see the file /usr/lib/libGL.so.1 - and yet compiling with g++ and the flag -lGL returns the error: error: cannot find -lGL.
Any ideas on what I can do to fix this?
Output of dpkg -L libgl1-mesa-dev
/.
/usr
/usr/share
/usr/share/bug
/usr/share/bug/libgl1-mesa-dev
/usr/share/bug/libgl1-mesa-dev/script
/usr/share/bug/libgl1-mesa-dev/control
/usr/share/doc
/usr/share/doc/libgl1-mesa-dev
/usr/share/doc/libgl1-mesa-dev/copyright
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/mesa
/usr/lib/x86_64-linux-gnu/pkgconfig
/usr/lib/x86_64-linux-gnu/pkgconfig/gl.pc
/usr/share/doc/libgl1-mesa-dev/changelog.Debian.gz
/usr/lib/x86_64-linux-gnu/mesa/libGL.so
/usr/lib/x86_64-linux-gnu/libGL.so
/usr/lib/x86_64-linux-gnu/libglapi.so
Update
The command ldconfig -p | grep libGL.so gives the output:
libGL.so.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libGL.so.1
libGL.so.1 (libc6,x86-64) => /usr/lib/libGL.so.1
libGL.so.1 (libc6) => /usr/lib/i386-linux-gnu/libGL.so.1
libGL.so (libc6) => /usr/lib/i386-linux-gnu/libGL.so
I don't know if that's useful or correct?

Building shared library depending on libcurl

Hello I'm a newbie in compiling shared libraries.
My shared library depends on curl, ssl and crypto.
I've compiled the libcurl and the output libraries are:
libcurl.so.4 --> libcurl.so.4.3.0
libcurl.so.4.3.0
and I've compiled my shared library using the following command:
g++ -m32 -shared \
-o libtestshared.so.1 \
-fPIC ../build/*.o \
-lpthread \
../openssl/lib/libssl.so.1.0.0 \
../openssl/lib/libcrypto.so.1.0.0 \
../curl/lib/libcurl.so.4.3.0
But when I figure out what are the libraries my library depends on, I found:
ldd libtestshared.so.1
linux-gate.so.1 => (0x00e2a000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00aec000)
libssl.so.1.0.0 => /home/usr1/openssl/lib/libssl.so.1.0.0 (0x0034c000)
libcrypto.so.1.0.0 => /home/usr1/openssl/lib/libcrypto.so.1.0.0 (0x003a8000)
libcurl.so.4 => /home/usr1/curl/lib/libcurl.so.4 (0x001cf000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00229000)
libm.so.6 => /lib/libm.so.6 (0x006be000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00eaf000)
libc.so.6 => /lib/libc.so.6 (0x006e8000)
/lib/ld-linux.so.2 (0x0055e000)
libdl.so.2 => /lib/libdl.so.2 (0x001ba000)
librt.so.1 => /lib/librt.so.1 (0x00314000)
Why only libcurl is refereing to the symbolic link?