dslm4515 / BMLFS

Beyond Musl Linux From Scratch - Build Recipes for MLFS [Musl Linux From Source]
17 stars 4 forks source link

Qt5 fails to build: undefined reference to `backtrace' #22

Closed dslm4515 closed 2 years ago

dslm4515 commented 2 years ago

libQt5Core.so.5.15.2 fails to link against libexecinfo:

/usr/bin/ld: .obj/qlogging.o: in function `backtraceFramesForLogMessage(int)':
qlogging.cpp:(.text+0x1bf4): undefined reference to `backtrace'
/usr/bin/ld: qlogging.cpp:(.text+0x1cd7): undefined reference to `backtrace_symbols'
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:1256: ../../lib/libQt5Core.so.5.15.2] Error 1
make[3]: Leaving directory '/src/qt-everywhere-src-5.15.2/qtbase/src/corelib'
make[2]: *** [Makefile:171: sub-corelib-make_first] Error 2
make[2]: Leaving directory '/src/qt-everywhere-src-5.15.2/qtbase/src'
make[1]: *** [Makefile:51: sub-src-make_first] Error 2
make[1]: Leaving directory '/src/qt-everywhere-src-5.15.2/qtbase'
make: *** [Makefile:86: module-qtbase-make_first] Error 2

This still even happens when libexecinfo is added to CFLAGS, CXXFLAGS and LDFLAGS

dslm4515 commented 2 years ago

Adding -lexecinfo to qtbase/src/corelib/Makefile:

LFLAGS        = -Wl,-e,qt_core_boilerplate -Wl,--no-undefined -Wl,--version-script,QtCore.version -Wl,-O1 -Wl,--enable-new-dtags -shared -Wl,-soname,libQt5Core.so.5 -Wl,-lexecinfo

... allows build to continue.

dslm4515 commented 2 years ago

Next road block:

In file included from ssl/qsslcertificate.cpp:135:
ssl/qsslsocket_openssl_symbols_p.h:362:29: error: 'BIO_ADDR' has not been declared
  362 | int q_DTLSv1_listen(SSL *s, BIO_ADDR *client);
      |                             ^~~~~~~~
ssl/qsslsocket_openssl_symbols_p.h:363:1: error: 'BIO_ADDR' does not name a type
  363 | BIO_ADDR *q_BIO_ADDR_new();
      | ^~~~~~~~
ssl/qsslsocket_openssl_symbols_p.h:364:6: error: variable or field 'q_BIO_ADDR_free' declared void
  364 | void q_BIO_ADDR_free(BIO_ADDR *ap);
      |      ^~~~~~~~~~~~~~~
ssl/qsslsocket_openssl_symbols_p.h:364:22: error: 'BIO_ADDR' was not declared in this scope
  364 | void q_BIO_ADDR_free(BIO_ADDR *ap);
      |                      ^~~~~~~~
ssl/qsslsocket_openssl_symbols_p.h:364:32: error: 'ap' was not declared in this scope
  364 | void q_BIO_ADDR_free(BIO_ADDR *ap);
      |                                ^~
make[3]: *** [Makefile:25546: .obj/qsslcertificate.o] Error 1
make[3]: Leaving directory '/src/qt-everywhere-src-5.15.2/qtbase/src/network'
make[2]: *** [Makefile:221: sub-network-make_first] Error 2
make[2]: Leaving directory '/src/qt-everywhere-src-5.15.2/qtbase/src'
make[1]: *** [Makefile:51: sub-src-make_first] Error 2
make[1]: Leaving directory '/src/qt-everywhere-src-5.15.2/qtbase'
make: *** [Makefile:86: module-qtbase-make_first] Error 2

Building with openssl installed in /opt/openssl. BIO_ADDR is defined in /opt/openssl/include/openssl/bio.h

Modify qtbase/src/network/Makefile to add /opt/openssl/include to CFLAGS and CXXFLAGS:

CFLAGS        = -pipe -O2 -std=gnu11 -fvisibility=hidden -fno-exceptions -Wall -Wextra -D_REENTRANT -fPIC -I/opt/openssl/include $(DEFINES)
CXXFLAGS      = -pipe -DOPENSSL_API_COMPAT=0x10100000L -O2 -std=c++1z -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -Wextra -Wvla -Wdate-time -Wshift-overflow=2 -Wduplicated-cond -Wno-stringop-overflow -Wno-format-overflow -D_REENTRANT -fPIC -I/opt/openssl/include $(DEFINES)

...allows build to resume ...

dslm4515 commented 2 years ago

Next road block:

/usr/bin/ld: unixmake.o: in function `UnixMakefileGenerator::defaultInstall(QString const&)':
/src/qt-everywhere-src-5.15.2/qtbase/qmake/generators/unix/unixmake.cpp:757: undefined reference to `MakefileGenerator::installMetaFile(ProKey const&, QString const&, QString const&)'
/usr/bin/ld: winmakefile.o: in function `Win32MakefileGenerator::defaultInstall(QString const&)':
/src/qt-everywhere-src-5.15.2/qtbase/qmake/generators/win32/winmakefile.cpp:778: undefined reference to `MakefileGenerator::installMetaFile(ProKey const&, QString const&, QString const&)'
/usr/bin/ld: /src/qt-everywhere-src-5.15.2/qtbase/qmake/generators/win32/winmakefile.cpp:761: undefined reference to `MakefileGenerator::installMetaFile(ProKey const&, QString const&, QString const&)'
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:197: ../qmake/qmake] Error 1
make[3]: Leaving directory '/src/qt-everywhere-src-5.15.2/qtbase/qmake'
make[2]: *** [Makefile.qmake-aux:315: /src/qt-everywhere-src-5.15.2/qtbase/qmake/qmake] Error 2
make[2]: Leaving directory '/src/qt-everywhere-src-5.15.2/qtbase/qmake'
make[1]: *** [Makefile:126: sub-qmake-qmake-aux-pro-make_first] Error 2
make[1]: Leaving directory '/src/qt-everywhere-src-5.15.2/qtbase'
make: *** [Makefile:86: module-qtbase-make_first] Error 2

At this point, scrapping this Void method of building Qt5.15.2.

dslm4515 commented 2 years ago

Qt5 build fine using Alpine’s method.

commit b442e777241bb0dcda1028a02876e42eda466a21