strangeqargo
strangeqargo

Reputation: 1272

Finding library dependencies (make/cmake/linker)

I'm trying to build a cross-platform QT C++ application (Linux/Windows), using MXE and cmake. I googled very, very hard, you don't know how brilliant my google queries were. Such queries. But:

The problem: undefined references.

/home/user/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5Core.a(qregularexpression.o):qregularexpression.cpp:(.text+0x2b7): undefined reference to `pcre16_exec'

(and many others of this kind)

The solution:

cd ~/mxe && make pcre

then add to CMakeFiles.txt:

ADD_LIBRARY(pcre STATIC IMPORTED)
SET_TARGET_PROPERTIES(pcre PROPERTIES IMPORTED_LOCATION /home/user/mxe/usr/i686-w64-mingw32.static/lib/libpcre16.a)
TARGET_LINK_LIBRARIES(${CMAKE_PROJECT_NAME} pcre)

Final problem: Other Undefined References.

/home/user/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5Core.a(qbytearray.o):qbytearray.cpp:(.text+0x60a): undefined reference to `uncompress'
/home/user/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5Core.a(qbytearray.o):qbytearray.cpp:(.text+0x1a30): undefined reference to `compress2'
/home/user/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5Gui.a(qharfbuzzng.o):qharfbuzzng.cpp:(.text+0x143e): undefined reference to `hb_font_funcs_set_glyph_v_origin_func'

But I don't know from what library this compress or hb_font_funcs_set_glyph_v_origin_func comes. I could google them one by one, but it looks like a stone age practice. And in a long perspective I don't want to do this for every cross-compiled project.

The question(s):

How do I find names of needed libraries, without reading qt build files? Is there a way to output dependencies (dynamic libraries needed) using cmake or make?

Possible solutions:

UPD: discovered

Upvotes: 3

Views: 688

Answers (0)

Related Questions