Vlc-Qt Static Build
-
Hello,
I am trying to statically build a Qt program that uses Vlc-Qt. I statically compiled Vlc-Qt with the -DSTATIC=ON compiler flag, and it successfully builds with the following output:-- Building VLC-Qt 1.2.0 -- Git revision: 9b2f561 -- The C compiler identification is GNU 11.4.0 -- The CXX compiler identification is GNU 11.4.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 -- Build statically: ON -- Looking for pthread.h -- Looking for pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE -- Using Qt 5.15.14 -- Installing to system QML import path: OFF -- Found LibVLC include-dir path: /usr/include -- Found LibVLC library path:/usr/lib/x86_64-linux-gnu/libvlc.so -- Found LibVLCcore library path:/usr/lib/x86_64-linux-gnu/libvlccore.so -- Configuring done -- Generating done -- Build files have been written to: /home/exhibits/vlc-qt/build
Unfortunately, after I make and install Vlc-Qt, when I try to run the Qt project that uses it, I get the following errors:
Instance.cpp👎 error: undefined reference to libvlc_new' :-1: error: Instance.cpp:(.text+0x4e3): undefined reference to libvlc_log_set'
and a series of similar ones. Am I incorrectly linking libvlc to Vlc-qt?
I'm aware this is probably not the optimal place to ask Vlc-Qt questions but all original vlc-qt forums are pretty dead, so I'd appreciate any guidance.
Thanks -
Hi and welcome to devnet,
You forgot to link against VLC lib itself. The fact that VLC-Qt is static does not make its dependencies static as well.
-
Hi and welcome to devnet,
You forgot to link against VLC lib itself. The fact that VLC-Qt is static does not make its dependencies static as well.
-
@SGaist
Thanks for responding, your posts have helped me immensely over the past few months.
How would I go about statically linking with libvlc itself? Do I need to statically build vlc?Yes, if you want a library to be 100% static, then all its dependencies shall also be built statically.