1

I'm trying to run a Qt project with CMake in an ubuntu 18.04-based docker container. When I run the cmake and make commands for my project, I get the following errors.

/usr/local/Qt-5.12.0/lib/libQt5Core.a(qregularexpression.o): In function `QThreadStorage<QPcreJitStackPointer*>::deleteData(void*)':
qregularexpression.cpp:(.text._ZN14QThreadStorageIP20QPcreJitStackPointerE10deleteDataEPv[_ZN14QThreadStorageIP20QPcreJitStackPointerE10deleteDataEPv]+0x12): undefined reference to `pcre2_jit_stack_free_16'
/usr/local/Qt-5.12.0/lib/libQt5Core.a(qregularexpression.o): In function `safe_pcre2_match_16(pcre2_real_code_16 const*, unsigned short const*, int, int, int, pcre2_real_match_data_16*, pcre2_real_match_context_16*)':
qregularexpression.cpp:(.text._ZL19safe_pcre2_match_16PK18pcre2_real_code_16PKtiiiP24pcre2_real_match_data_16P27pcre2_real_match_context_16+0x32): undefined reference to `pcre2_match_16'

... these undefined references keep on going...

/usr/local/Qt-5.12.0/lib/libQt5Core.a(qlibrary_unix.o): In function `QLibraryPrivate::load_sys()':
qlibrary_unix.cpp:(.text._ZN15QLibraryPrivate8load_sysEv+0x628): undefined reference to `dlopen'
collect2: error: ld returned 1 exit status
CMakeFiles/db.dir/build.make:123: recipe for target 'db' failed
make[2]: *** [db] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/db.dir/all' failed
make[1]: *** [CMakeFiles/db.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

I tried changing my CMakeLists.txt file to see if it was causing the problem, adding directories and paths but it doesn't seem to be the cause. I'm trying to change LIBRARY_PATH but I have no results. Is there any other approach to fix this problem?

0

After a while trying to make it work, I decided to reconfigure and reinstall Qt with the same version for the docker.

I had the config options in the dockerfile

bash ./configure -opensource -confirm-license -static -no-accessibility -sql-sqlite -sqlite -no-qml-debug \
   -no-harfbuzz -openssl-linked -qt-pcre -no-dbus -nomake tools \
   -no-xkbcommon-evdev -no-xinput2 -no-xcb-xlib -no-glib -qt-xcb -no-compile-examples -nomake examples \
   -no-gif -qt-doubleconversion -no-gtk \

and changed them to this

bash ./configure -opensource -confirm-license -no-accessibility -sql-odbc -sql-sqlite -sqlite -gui -widgets -nomake tools -no-compile-examples -nomake examples -qt-doubleconversion\
    && make install

I added gui and widgets options and decided to install more tools. This approach fixed the undefined references for the different libraries CMake could not find while building the executable for the project. Although the problem was solved I ended with a docker image bigger (7 Gb more), so it's a quick solution but not the best.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.