hyperion-project / hyperion.ng

The successor to Hyperion aka Hyperion Next Generation
https://hyperion-project.org/
MIT License
3.06k stars 377 forks source link

CEC headers/lib not found when building on Vero4K OSMC #1702

Closed hissingshark closed 2 months ago

hissingshark commented 7 months ago

Bug report

I have been asked to include the CEC support in my builds/installer. The includes and library are installed at /usr/osmc/include/ and /usr/osmc/lib respectively. This fails the CMake checks.

They seem to be expected at /usr/include and /usr/lib/ so I've specified them myself using the CMake methods. Then the CMake checks succeed, but the build fails as they aren't passed to the compiler. CFLAGS have to be used to get past the build. But then at runtime it fails to find libCEC, so I guess that information is being lost as well. Is there something wrong with the CMake unit?

Steps to reproduce

Add the paths in advance with export CMAKE_PREFIX_PATH=/usr/osmc/. Or alternatively the flags -DCEC_INCLUDE_DIRS=/usr/osmc/include and -DCEC_LIBRARIES=/usr/osmc/lib. Both seem to work as cmake reports:

-- Found CEC: /usr/osmc/include

What is expected?

My CEC headers and library are not in a default location, so I must specify that during build configuration. cmake finds the headers with my config help, so they should be found by the compiler for #include The same methods are used to point to libCEC, so it should be found at runtime.

What is actually happening?

The CMake checks are successful. But when building I get:

In file included from /home/osmc/hyperion.ng/build/libsrc/cec/cechandler_autogen/O2CIRRR27P/moc_CECHandler.cpp:10, from /home/osmc/hyperion.ng/build/libsrc/cec/cechandler_autogen/mocs_compilation.cpp:2: /home/osmc/hyperion.ng/build/libsrc/cec/cechandler_autogen/O2CIRRR27P/../../../../../include/cec/CECHandler.h:9:10: fatal error: libcec/cec.h: No such file or directory 9 | #include <libcec/cec.h> | ^~~~~~ compilation terminated.

To get a successful build I also need to add the paths to my CFLAGS: export CFLAGS="-I/opt/vero3/include -L/opt/vero3/lib -I/usr/osmc/include -L/usr/osmc/lib -O3 -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -ftree-vectorize -funsafe-math-optimizations"; export CPPFLAGS=$CFLAGS; export CXXFLAGS=$CFLAGS

But then libCEC isn't found at runtime...

The only true workaround is for me to symlink the headers and library on the user's system, but that shouldn't be necessary.

System

Hyperion Server:

Hyperion Server OS:

Paulchen-Panther commented 5 months ago

Unfortunately, no team member has a Vero4k box to recreate the whole thing. As I see it, you have already localized the problem. Apparently it helps to address a few CMake variables. Maybe you could create a PR?

Greetings Paulchen

hissingshark commented 4 months ago

Thank you for reviewing. I fully appreciate you not having access to the platform. I would gladly have submitted a PR as previously, but I don't have a fix as yet. This seemed to be a CMake issue. Even if i set the flags the libCEC runtime isn't found. Is there more I can do when configuring? Or are the flags not working fully because of a fault?

Lord-Grey commented 4 months ago

You could have a try to pass the lib name and location when loading the lib, as in

https://github.com/KewaiiGamer/hyperion.ng/blob/364b298e19b3b35c52c6dc4a3e2aeeee9369053e/libsrc/cec/CECHandler.cpp#L40

Lord-Grey commented 2 months ago

Closing as no further feedback