Qt raspberry pi cross compilation make issue



  • Hello,

    I'm following this tutorial to set a virtal machine with Ubuntu 18.04.3 LTS for raspberry pi 3 cross compilation. I follow every step of the tutorial with success except for make.

    This is my config (Qt version 5.12.3)

    ./configure -release -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf- -sysroot ~/raspi/sysroot -opensource -confirm-license -skip qtwayland -skip qtlocation -skip qtscript -make libs -prefix /usr/local/qt5pi -extprefix ~/raspi/qt5pi -hostprefix ~/raspi/qt5 -no-use-gold-linker -v -no-gbm
    

    This is make output:

    /home/edu/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libpthread.a(pthread_create.o): In function `__pthread_create_2_1':
    /build/glibc-FUvrFr/glibc-2.28/nptl/pthread_create.c:697: undefined reference to `_dl_stack_flags'
    /home/edu/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libpthread.a(unwind.o): In function `unwind_stop':
    /build/glibc-FUvrFr/glibc-2.28/nptl/unwind.c:72: undefined reference to `__pointer_chk_guard_local'
    /home/edu/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libpthread.a(nptl-init.o): In function `__pthread_initialize_minimal_internal':
    /build/glibc-FUvrFr/glibc-2.28/nptl/nptl-init.c:434: undefined reference to `_dl_pagesize'
    /build/glibc-FUvrFr/glibc-2.28/nptl/nptl-init.c:434: undefined reference to `_dl_init_static_tls'
    /build/glibc-FUvrFr/glibc-2.28/nptl/nptl-init.c:434: undefined reference to `_dl_wait_lookup_done'
    /home/edu/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libpthread.a(nptl-init.o): In function `__pthread_get_minstack':
    /build/glibc-FUvrFr/glibc-2.28/nptl/nptl-init.c:443: undefined reference to `_dl_pagesize'
    collect2: error: ld returned 1 exit status
    Makefile:1149: recipe for target '../../lib/libQt5Core.so.5.12.3' failed
    make[3]: *** [../../lib/libQt5Core.so.5.12.3] Error 1
    make[3]: Leaving directory '/home/edu/raspi/qt-everywhere-src-5.12.3/qtbase/src/corelib'
    Makefile:199: recipe for target 'sub-corelib-make_first' failed
    make[2]: *** [sub-corelib-make_first] Error 2
    make[2]: Leaving directory '/home/edu/raspi/qt-everywhere-src-5.12.3/qtbase/src'
    Makefile:50: recipe for target 'sub-src-make_first' failed
    make[1]: *** [sub-src-make_first] Error 2
    make[1]: Leaving directory '/home/edu/raspi/qt-everywhere-src-5.12.3/qtbase'
    Makefile:82: recipe for target 'module-qtbase-make_first' failed
    make: *** [module-qtbase-make_first] Error 2
    

    Same error with -device linux-rasp-pi3-g++ .

    What i'm doing wrong? Thanks!


  • Qt Champions 2018

    @drazz said in Qt raspberry pi cross compilation make issue:

    libpthread.a

    It looks like it tries to use static version of pthread lib.
    Can you show the compiler/linker call just before first error?



  • @jsulm said in Qt raspberry pi cross compilation make issue:

    Can you show the compiler/linker call just before first error?

    Sure!

    /home/edu/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++ -mfloat-abi=hard --sysroot=/home/edu/raspi/sysroot -Wl,--no-undefined -Wl,--version-script,QtCore.version -Wl,-O1 -Wl,--enable-new-dtags -Wl,-rpath-link,/home/edu/raspi/sysroot/opt/vc/lib -Wl,-rpath-link,/home/edu/raspi/sysroot/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,/home/edu/raspi/sysroot/lib/arm-linux-gnueabihf -shared -Wl,-soname,libQt5Core.so.5 -o libQt5Core.so.5.12.3 .obj/minimum-linux.o .obj/qstring_compat.o .obj/qabstractanimation.o .obj/qvariantanimation.o .obj/qpropertyanimation.o .obj/qanimationgroup.o .obj/qsequentialanimationgroup.o .obj/qparallelanimationgroup.o .obj/qpauseanimation.o .obj/qendian.o .obj/qglobal.o .obj/qlibraryinfo.o .obj/qmalloc.o .obj/qnumeric.o .obj/qfloat16.o .obj/qoperatingsystemversion.o .obj/qlogging.o .obj/qrandom.o .obj/qhooks.o .obj/qversiontagging.o .obj/qrunnable.o .obj/qthread.o .obj/qthread_unix.o .obj/qatomic.o .obj/qmutex.o .obj/qmutexpool.o .obj/qreadwritelock.o .obj/qsemaphore.o .obj/qthreadpool.o .obj/qthreadstorage.o .obj/qwaitcondition_unix.o .obj/qexception.o .obj/qfutureinterface.o .obj/qfuturewatcher.o .obj/qresultstore.o .obj/qarraydata.o .obj/qbitarray.o .obj/qbytearray.o .obj/qbytearraylist.o .obj/qbytearraymatcher.o .obj/qcollator.o .obj/qcryptographichash.o .obj/qdatetime.o .obj/qeasingcurve.o .obj/qfreelist.o .obj/qhash.o .obj/qline.o .obj/qlinkedlist.o .obj/qlist.o .obj/qlocale.o .obj/qlocale_tools.o .obj/qpoint.o .obj/qmap.o .obj/qmargins.o .obj/qmessageauthenticationcode.o .obj/qcontiguouscache.o .obj/qrect.o .obj/qregexp.o .obj/qrefcount.o .obj/qringbuffer.o .obj/qshareddata.o .obj/qsharedpointer.o .obj/qsimd.o .obj/qsize.o .obj/qstring.o .obj/qstringbuilder.o .obj/qstringlist.o .obj/qstringview.o .obj/qtextboundaryfinder.o .obj/qtimeline.o .obj/qunicodetools.o .obj/qvsnprintf.o .obj/qversionnumber.o .obj/qlocale_unix.o .obj/qcollator_posix.o .obj/qtimezone.o .obj/qtimezoneprivate.o .obj/qtimezoneprivate_tz.o .obj/qdatetimeparser.o .obj/qregularexpression.o .obj/qcommandlineoption.o .obj/qcommandlineparser.o .obj/harfbuzz-buffer.o .obj/harfbuzz-gdef.o .obj/harfbuzz-gsub.o .obj/harfbuzz-gpos.o .obj/harfbuzz-impl.o .obj/harfbuzz-open.o .obj/harfbuzz-stream.o .obj/harfbuzz-shaper-all.o .obj/qharfbuzz.o .obj/qabstractfileengine.o .obj/qbuffer.o .obj/qdataurl.o .obj/qtldurl.o .obj/qdebug.o .obj/qdir.o .obj/qdiriterator.o .obj/qfile.o .obj/qfiledevice.o .obj/qfileinfo.o .obj/qipaddress.o .obj/qiodevice.o .obj/qlockfile.o .obj/qnoncontiguousbytedevice.o .obj/qstorageinfo.o .obj/qtemporarydir.o .obj/qtemporaryfile.o .obj/qresource.o .obj/qresource_iterator.o .obj/qsavefile.o .obj/qstandardpaths.o .obj/qurl.o .obj/qurlidna.o .obj/qurlquery.o .obj/qurlrecode.o .obj/qfsfileengine.o .obj/qfsfileengine_iterator.o .obj/qfilesystementry.o .obj/qfilesystemengine.o .obj/qfileselector.o .obj/qloggingcategory.o .obj/qloggingregistry.o .obj/qfilesystemwatcher.o .obj/qfilesystemwatcher_polling.o .obj/qfilesystemwatcher_inotify.o .obj/qprocess.o .obj/qprocess_unix.o .obj/qsettings.o .obj/qfsfileengine_unix.o .obj/qfilesystemengine_unix.o .obj/qlockfile_unix.o .obj/qfilesystemiterator_unix.o .obj/forkfd_qt.o .obj/qstandardpaths_unix.o .obj/qstorageinfo_unix.o .obj/qabstractitemmodel.o .obj/qitemselectionmodel.o .obj/qabstractproxymodel.o .obj/qidentityproxymodel.o .obj/qsortfilterproxymodel.o .obj/qstringlistmodel.o .obj/qfactoryinterface.o .obj/qpluginloader.o .obj/qfactoryloader.o .obj/quuid.o .obj/qabstracteventdispatcher.o .obj/qabstractnativeeventfilter.o .obj/qbasictimer.o .obj/qdeadlinetimer.o .obj/qelapsedtimer.o .obj/qeventloop.o .obj/qcoreapplication.o .obj/qcoreevent.o .obj/qmetaobject.o .obj/qmetatype.o .obj/qmetaobjectbuilder.o .obj/qmimedata.o .obj/qobject.o .obj/qobjectcleanuphandler.o .obj/qsignalmapper.o .obj/qsocketnotifier.o .obj/qtimer.o .obj/qtranslator.o .obj/qvariant.o .obj/qcoreglobaldata.o .obj/qsharedmemory.o .obj/qsystemsemaphore.o .obj/qpointer.o .obj/qmath.o .obj/qsystemerror.o .obj/qtestsupport_core.o .obj/qcore_unix.o .obj/qeventdispatcher_unix.o .obj/qtimerinfo_unix.o .obj/qelapsedtimer_unix.o .obj/qeventdispatcher_glib.o .obj/qsharedmemory_posix.o .obj/qsharedmemory_systemv.o .obj/qsharedmemory_unix.o .obj/qsystemsemaphore_posix.o .obj/qsystemsemaphore_systemv.o .obj/qsystemsemaphore_unix.o .obj/qutfcodec.o .obj/qlatincodec.o .obj/qsimplecodec.o .obj/qtextcodec.o .obj/qisciicodec.o .obj/qtsciicodec.o .obj/qgb18030codec.o .obj/qjpunicode.o .obj/qeucjpcodec.o .obj/qjiscodec.o .obj/qsjiscodec.o .obj/qeuckrcodec.o .obj/qbig5codec.o .obj/qiconvcodec.o .obj/qcborstream.o .obj/qcbordiagnostic.o .obj/qcborvalue.o .obj/qdatastream.o .obj/qjson.o .obj/qjsoncbor.o .obj/qjsondocument.o .obj/qjsonobject.o .obj/qjsonarray.o .obj/qjsonvalue.o .obj/qjsonwriter.o .obj/qjsonparser.o .obj/qtextstream.o .obj/qxmlstream.o .obj/qxmlutils.o .obj/qstatemachine.o .obj/qabstractstate.o .obj/qstate.o .obj/qfinalstate.o .obj/qhistorystate.o .obj/qabstracttransition.o .obj/qsignaltransition.o .obj/qeventtransition.o .obj/qmimedatabase.o .obj/qmimetype.o .obj/qmimemagicrulematcher.o .obj/qmimetypeparser.o .obj/qmimemagicrule.o .obj/qmimeglobpattern.o .obj/qmimeprovider.o .obj/qfloat16tables.o .obj/qrc_mimetypes.o .obj/moc_qmimetype.o  -lpthread -lm /home/edu/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libz.a /home/edu/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libpcre2-16.so /home/edu/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libdouble-conversion.so /home/edu/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libgthread-2.0.so /home/edu/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libglib-2.0.so   
    /home/edu/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libpthread.a(pthread_create.o): In function `__pthread_create_2_1':
    /build/glibc-FUvrFr/glibc-2.28/nptl/pthread_create.c:697: undefined reference to `_dl_stack_flags'
    /home/edu/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libpthread.a(unwind.o): In function `unwind_stop':
    /build/glibc-FUvrFr/glibc-2.28/nptl/unwind.c:72: undefined reference to `__pointer_chk_guard_local'
    /home/edu/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libpthread.a(nptl-init.o): In function `__pthread_initialize_minimal_internal':
    /build/glibc-FUvrFr/glibc-2.28/nptl/nptl-init.c:434: undefined reference to `_dl_pagesize'
    /build/glibc-FUvrFr/glibc-2.28/nptl/nptl-init.c:434: undefined reference to `_dl_init_static_tls'
    /build/glibc-FUvrFr/glibc-2.28/nptl/nptl-init.c:434: undefined reference to `_dl_wait_lookup_done'
    /home/edu/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libpthread.a(nptl-init.o): In function `__pthread_get_minstack':
    /build/glibc-FUvrFr/glibc-2.28/nptl/nptl-init.c:443: undefined reference to `_dl_pagesize'
    collect2: error: ld returned 1 exit status
    Makefile:1158: recipe for target '../../lib/libQt5Core.so.5.12.3' failed
    make[3]: *** [../../lib/libQt5Core.so.5.12.3] Error 1
    make[3]: Leaving directory '/home/edu/raspi/qt-everywhere-src-5.12.3/qtbase/src/corelib'
    Makefile:198: recipe for target 'sub-corelib-make_first' failed
    make[2]: *** [sub-corelib-make_first] Error 2
    make[2]: Leaving directory '/home/edu/raspi/qt-everywhere-src-5.12.3/qtbase/src'
    Makefile:50: recipe for target 'sub-src-make_first' failed
    make[1]: *** [sub-src-make_first] Error 2
    make[1]: Leaving directory '/home/edu/raspi/qt-everywhere-src-5.12.3/qtbase'
    Makefile:82: recipe for target 'module-qtbase-make_first' failed
    make: *** [module-qtbase-make_first] Error 2
    
    

    All output can be found here


  • Qt Champions 2018

    @drazz "-lpthread" - looks fine, but for some reason static version is used by the linker.
    Maybe somebody else has an idea.



  • Check the symlink for libpthread.so in the sysroot under <sysroot>/usr/lib/arm-linux-gnueabihf.

    If it is a broken symlink, libpthread.a is picked instead which is not what you want. libpthread.so should point to <sysroot>/lib/arm-linux-gnueabihf/libpthread.so.0



  • I managed to build the environment some days after I posted this error following another tutorial. So I deleated the virtual machine that was getting this error.

    But after @agocs response, I set another clean VM and tried to reproduced the error. I used the same img of raspbian stretch that I had success (that means that I ran different commands for raspberry pi part). I could make and install with no errors.

    I'll try to reproduce the error this weekend and give it a go to @agocs solution and give some feedback.

    Thanks @jsulm and @agocs for help!


 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.