elsampsa / valkka-core

Valkka - Create video surveillance, management and analysis programs with PyQt
GNU Lesser General Public License v3.0
181 stars 35 forks source link

Ubuntu 22 packaging woes: undefined symbol: EVP_sha1, glew not found #35

Closed goigle closed 1 year ago

goigle commented 1 year ago

Bug report

This is on the latest version of Valkka on Ubuntu 22 installed via apt. I looked up the error and it appears to have something to do with libcrypto and OpenSSL. This happens if I try to import Valkka in Python:

Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main  
    return _run_code(code, main_globals, None,  
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code  
    exec(code, run_globals)  
  File "/home/james/property-monitor/monitor/mvp.py", line 1, in <module>  
    from valkka.api2 import LiveThread, OpenFilterchain  
  File "/usr/lib/python3/dist-packages/valkka/api2/__init__.py", line 9, in <module>  
    from valkka.core import get_numpy_version, numpy_version_ok  
  File "/usr/lib/python3/dist-packages/valkka/core/__init__.py", line 53, in <module>  
    from .valkka_core import * # import everything to valkka.core namespace  
  File "/usr/lib/python3/dist-packages/valkka/core/valkka_core.py", line 13, in <module>  
    from . import _valkka_core  
ImportError: /lib/libValkka.so.1: undefined symbol: EVP_sha1  

Specs

OS: Ubuntu 22.04.1
Python 3.10

Everything I can find about the error points to it being a linking issue of some sort at compile time, but I do not have experience compiling C++ code. I have seen a couple of other issues for other software on Ubuntu 22 where people have mentioned libssl / libcrypto had odd packaging in that release? Not sure if it is related.

Summary

Adding this section instead of creating a bunch of issues.

undefined symbol: EVP_sha1: works when compiled locally None of the required 'glew' found: Install freeglut3-dev. Readme needs updating to reflect that

goigle commented 1 year ago

Trying to debug this issue by building locally, but the build fails on an OpenGL package that is definitely installed. Ubuntu 22 seems to have really messed with packaging or something. I can't find anything that resolves this either, every issue I find from others online the person just didn't have libglew-dev installed but I do.

-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2")
-- The C compiler identification is GNU 11.2.0
-- The CXX compiler identification is GNU 11.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Checking for one of the modules 'x11'
-- Checking for one of the modules 'glew'
CMake Error at /usr/share/cmake-3.22/Modules/FindPkgConfig.cmake:890 (message):
  None of the required 'glew' found
Call Stack (most recent call first):
  CMakeLists.txt:142 (pkg_search_module)

-- Checking for one of the modules 'alsa'
-- Checking for one of the modules 'openssl'
PYTHON_LIBRARIES: ;python3.10;;crypt;;dl;;;m;;m
PYTHON_INCLUDE_DIRS: ;/usr/include/python3.10;;/usr/include/python3.10
*** PYTHON INTERFACE ***
PYTHON INSTALL DIR           : lib/python3/dist-packages
PYTHON NUMPY HEADER FILES IN : /usr/lib/python3/dist-packages/numpy/core/include

GENERATING valkka_core.i

/usr/include/X11/X.h:115: Warning 314: 'None' is a python keyword, renaming to '_None'
LIVE555 ROOT: /home/james/valkka-core/ext/live
FFMPEG  ROOT: /home/james/valkka-core/ext/ffmpeg
-- Configuring incomplete, errors occurred!
See also "/home/james/valkka-core/build_dir/CMakeFiles/CMakeOutput.log".
make: *** [debian/rules:32: build] Error 1
james@village:~/valkka-core$ sudo apt install libglew-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libglew-dev is already the newest version (2.2.0-4).
The following packages were automatically installed and are no longer required:
  libupsclient4 libv4l-0 libv4l2rds0 libv4lconvert0 v4l-utils
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 10 not upgraded.
goigle commented 1 year ago

Fixed the above by installing freeglut3-dev as it turns out OpenGL wasn't automatically installed when glew was installed

goigle commented 1 year ago

Compiling locally resolved the eva_SHA1 issue. Not sure if that means there's a problem with the repo package

elsampsa commented 1 year ago

Thanks James! Will investigate in the following days..

elsampsa commented 1 year ago

so.. In my latest CMakeLists.txt (which isn't online yet, but which I used to produce that package you can get with apt-get etc [yes, I know, very unprofessional]) I have this:

# [OpenGL dependencies]
## pkg_search_module(GLEW REQUIRED glew) # wont work at ubuntu 22 ..?

So it seems that "pkg_search_module" command in ubuntu 22's CMake distro has stopped working, so we have to do stunts like this:

exec_program(pkg-config ARGS --libs x11 glew OUTPUT_VARIABLE GLEW_LIBRARIES)
exec_program(pkg-config ARGS --cflags x11 glew OUTPUT_VARIABLE GLEW_INCLUDER_DIRS)

that's also the origin it not using the -lssl and -lcrypto flags

goigle commented 1 year ago

I'm not sure what the difference is between pkg_search_module and pkg_check_module, but this was the CMakeLists.txt I used to debug on Ubuntu 22:

cmake_minimum_required(VERSION 3.13)
find_package(PkgConfig)
pkg_check_modules(GLEW glew)
find_package(GLEW REQUIRED)

After adding the freeglut3-dev package everything in this file worked without error. I think the find_package call uses CMake's internal FindGLEW module which might be more reliable (since you would hope they update that with the distro lol)

goigle commented 1 year ago

Just tested this on my machine:

cmake_minimum_required(VERSION 3.13)
find_package(PkgConfig)
pkg_search_module(GLEW REQUIRED glew)

and it worked. When you were debugging that earlier you might have been missing that freeglut package too, which would have caused a nonsensical error about not finding glew (even though the real issue was OpenGL / GLU)

elsampsa commented 1 year ago