jveitchmichaelis / deeplabel

A cross-platform desktop image annotation tool for machine learning
205 stars 39 forks source link

Unable to find shared libraries after installing DeepLabel #39

Closed absagargupta closed 1 year ago

absagargupta commented 1 year ago

Hi there After the build as soo as I tried running it from the terminal with ./DeepLabel.pro, I would get an error "/DeepLabel.pro: line 7: QT: command not found ./DeepLabel.pro: line 9: syntax error near unexpected token QT_MAJOR_VERSION,' ./DeepLabel.pro: line 9:greaterThan(QT_MAJOR_VERSION, 4): QT += widgets' " Also I have already installed QT and is working on Ubuntu20.04. Any help will be appreciated

jveitchmichaelis commented 1 year ago

That's just a configuration file. When you build the program you'll get a binary file. Did you compile deeplabel?

absagargupta commented 1 year ago

It says "Project MESSAGE: Linux"

jveitchmichaelis commented 1 year ago

Apologies I misunderstood, see above. To run deeplabel once you've compiled it, a new executable will be created. The Pro file is for configuration, it's not the program.

Do you see a folder called release anywhere?

absagargupta commented 1 year ago

Yes there is folder called release. As I try to run ./deeplabel in it, it shows me another error of "./deeplabel: error while loading shared libraries: libopencv_core.so.4.5: cannot open shared object file: No such file or directory" even though I had installed Opencv.

jveitchmichaelis commented 1 year ago

Can you paste the output from ldd deeplabel?

But that is indeed the file. You can also try to double check by opening the Pro file in Qt Creator and trying to run it through there.

It sounds like you need to set up your PATH to include the OpenCV libraries.

absagargupta commented 1 year ago

Here is the output of the same

linux-vdso.so.1 (0x00007ffd99cd3000) /usr/local/lib/AppProtection/libAppProtection.so (0x00007fd2b4d2f000) libprotobuf.so.17 => /lib/x86_64-linux-gnu/libprotobuf.so.17 (0x00007fd2b4a16000) libopencv_core.so.4.5 => not found libopencv_imgproc.so.4.5 => not found libopencv_imgcodecs.so.4.5 => not found libopencv_tracking.so.4.5 => not found libopencv_video.so.4.5 => not found libopencv_videoio.so.4.5 => not found libopencv_dnn.so.4.5 => not found libQt5Widgets.so.5 => /lib/x86_64-linux-gnu/libQt5Widgets.so.5 (0x00007fd2b4379000) libQt5Gui.so.5 => /lib/x86_64-linux-gnu/libQt5Gui.so.5 (0x00007fd2b3d8e000) libQt5Sql.so.5 => /lib/x86_64-linux-gnu/libQt5Sql.so.5 (0x00007fd2b3d3e000) libQt5Concurrent.so.5 => /lib/x86_64-linux-gnu/libQt5Concurrent.so.5 (0x00007fd2b3d35000) libQt5Xml.so.5 => /lib/x86_64-linux-gnu/libQt5Xml.so.5 (0x00007fd2b3cf3000) libQt5Core.so.5 => /lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007fd2b37aa000) libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fd2b35c8000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fd2b3479000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fd2b345c000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd2b326a000) /lib64/ld-linux-x86-64.so.2 (0x00007fd2b5087000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fd2b3247000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fd2b3241000) libX11.so.6 => /lib/x86_64-linux-gnu/libX11.so.6 (0x00007fd2b3104000) libxcb.so.1 => /lib/x86_64-linux-gnu/libxcb.so.1 (0x00007fd2b30da000) libXi.so.6 => /lib/x86_64-linux-gnu/libXi.so.6 (0x00007fd2b30c6000) libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fd2b30aa000) libGL.so.1 => /lib/x86_64-linux-gnu/libGL.so.1 (0x00007fd2b3022000) libpng16.so.16 => /lib/x86_64-linux-gnu/libpng16.so.16 (0x00007fd2b2fea000) libharfbuzz.so.0 => /lib/x86_64-linux-gnu/libharfbuzz.so.0 (0x00007fd2b2ee6000) libicui18n.so.66 => /lib/x86_64-linux-gnu/libicui18n.so.66 (0x00007fd2b2be5000) libicuuc.so.66 => /lib/x86_64-linux-gnu/libicuuc.so.66 (0x00007fd2b29ff000) libpcre2-16.so.0 => /lib/x86_64-linux-gnu/libpcre2-16.so.0 (0x00007fd2b297b000) libdouble-conversion.so.3 => /lib/x86_64-linux-gnu/libdouble-conversion.so.3 (0x00007fd2b2965000) libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fd2b283c000) libXau.so.6 => /lib/x86_64-linux-gnu/libXau.so.6 (0x00007fd2b2834000) libXdmcp.so.6 => /lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007fd2b282c000) libXext.so.6 => /lib/x86_64-linux-gnu/libXext.so.6 (0x00007fd2b2817000) libGLdispatch.so.0 => /lib/x86_64-linux-gnu/libGLdispatch.so.0 (0x00007fd2b275f000) libGLX.so.0 => /lib/x86_64-linux-gnu/libGLX.so.0 (0x00007fd2b272b000) libfreetype.so.6 => /lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007fd2b266c000) libgraphite2.so.3 => /lib/x86_64-linux-gnu/libgraphite2.so.3 (0x00007fd2b263d000) libicudata.so.66 => /lib/x86_64-linux-gnu/libicudata.so.66 (0x00007fd2b0b7c000) libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fd2b0b09000) libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007fd2b0aef000)

jveitchmichaelis commented 1 year ago

Ok, couple of follow ups:

  1. Where is OpenCV installed? Did you install it from source, or via a package manager?
  2. What does your PATH variable contain (the problem seems to be that OpenCV is not on your path)
absagargupta commented 1 year ago

Sure:

  1. I used the code given from the repo itself: `git clone https://github.com/opencv/opencv git clone https://github.com/opencv/opencv_contrib cd opencv && git checkout 4.5.3 && cd ../ cd opencv_contrib && git checkout 4.5.3 && cd ../

cd opencv mkdir build && cd build cmake .. -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules make -j8 sudo make install`

  1. I am unable to find the PATH variable. I had installed it inside the deeplabel.
jveitchmichaelis commented 1 year ago

PATH is a system variable - it doesn't have anything to do with deelabel. It's where Linux will look for libraries when a program runs. http://www.linfo.org/path_env_var.html

Can you confirm where the OpenCV library is installed to? (something like /usr/local) and what your PATH variable contains? (echo $PATH)

absagargupta commented 1 year ago

Ohh okay. My PATH variable does not contain any opencv related variable. Here is the output to echo $PATH "/home/sagar/.pyenv/plugins/pyenv-virtualenv/shims:/home/sagar/.pyenv/bin:/home/sagar/miniconda3/condabin:/home/sagar/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin "

While searching online I found a way: I search using sudo find / -name "libopencv_core.so.4.5*" It gave me back the response as "/media/auto-annotation/deeplabel/opencv/build/lib/libopencv_core.so.4.5.3"

jveitchmichaelis commented 1 year ago

Oops, I haven't had coffee yet. PATH is used for binaries on Linux, but you can also try setting LD_LIBRARY_PATH to the folder where your opencv libraries are installed to.

https://www.tecmint.com/understanding-shared-libraries-in-linux/

On Fri, 3 Mar 2023 at 11:43, absagargupta @.***> wrote:

Ohh okay. My PATH variable does not contain any opencv related variable. Here is the output to echo $PATH "/home/sagar/.pyenv/plugins/pyenv-virtualenv/shims:/home/sagar/.pyenv/bin:/home/sagar/miniconda3/condabin:/home/sagar/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin "

— Reply to this email directly, view it on GitHub https://github.com/jveitchmichaelis/deeplabel/issues/39#issuecomment-1453326428, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYDMJ7YKYSPNBE6GMJP5YTW2HDO5ANCNFSM6AAAAAAVOLTREE . You are receiving this because you commented.Message ID: @.***>

absagargupta commented 1 year ago

Thanks so much it got resolved. I set the path using the LD_LIBRARY_PATH. But Now I am getting another error of "./deeplabel: symbol lookup error: ./deeplabel: undefined symbol: _ZN2cv3dnn14dnn4_v202106083Net20setPreferableBackendEi" on running it. Should I open another issue or continue here ?

jveitchmichaelis commented 1 year ago

We can still continue here, that looks like we can't find some function in opencv (part of the DNN module). Can you run the build script for opencv and paste the output of cmake? It should list which modules were built.

It's possible that you're missing some dependency for opencv that caused it to skip some module. See here for the options that are used on GitHub actions:

https://github.com/jveitchmichaelis/deeplabel/blob/master/.github/workflows/build_ubuntu.yml

absagargupta commented 1 year ago

Sorry My bad. Actually I had earlier same version of openCV installed in another path and that was in my LD_LIBRARY. I unset the variables and gave the path of the openCV that you gave along with it. It started working after that. Thank you so much. You are a saviour. Coffee is on me if and when we meet.

jveitchmichaelis commented 1 year ago

Fantastic. Please feel free to post another issue if you run into trouble :)