Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Crosscompiling Qt5.15.2 makes error due to undeclared ‘getentropy’



  • I use gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gn to cross-compile qt5.12.2,it returns error as below:

    cd corelib/ && ( test -e Makefile || /home/matinal/workstation/Qt/qt-everywhere-src-5.15.2/qtbase/bin/qmake -o Makefile /home/matinal/workstation/Qt/qt-everywhere-src-5.15.2/qtbase/src/corelib/corelib.pro ) && make -f Makefile 
    make[3]: Entering directory '/home/matinal/workstation/Qt/qt-everywhere-src-5.15.2/qtbase/src/corelib'
    /home/matinal/workstation/Qt/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-g++ -c -include .pch/Qt5Core -pipe -O3 -std=c++1y -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -Wvla -Wdate-time -Wshift-overflow=2 -Wduplicated-cond -D_REENTRANT -fPIC -DQT_NO_LINKED_LIST -DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO_USING_NAMESPACE -DQT_NO_FOREACH -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_BUILD_CORE_LIB -DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_DEPRECATED_WARNINGS_SINCE=0x060000 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DPCRE2_CODE_UNIT_WIDTH=16 -I. -I../3rdparty/zlib/src -Iglobal -I../3rdparty/md5 -I../3rdparty/md4 -I../3rdparty/sha3 -I../3rdparty -I../3rdparty/double-conversion/include -I../3rdparty/harfbuzz/src -I../3rdparty/forkfd -I../3rdparty/tinycbor/src -I.rcc -I../../include -I../../include/QtCore -I../../include/QtCore/5.15.2 -I../../include/QtCore/5.15.2/QtCore -I.moc -I.tracegen -I../3rdparty/pcre2/src -I../../mkspecs/linux-aarch64-gnu-g++ -o .obj/qrandom.o global/qrandom.cpp
    global/qrandom.cpp: In static member function ‘static qsizetype QRandomGenerator::SystemGenerator::fillBuffer(void*, qsizetype)’:
    global/qrandom.cpp:107:79: error: ‘getentropy’ was not declared in this scope
                 int ret = getentropy(reinterpret_cast<uchar *>(buffer) + read, 256);
                                                                                   ^
    global/qrandom.cpp:113:84: error: ‘getentropy’ was not declared in this scope
             int ret = getentropy(reinterpret_cast<uchar *>(buffer) + read, count - read);
                                                                                        ^
    make[3]: *** [Makefile:23286: .obj/qrandom.o] Error 1
    make[3]: Leaving directory '/home/matinal/workstation/Qt/qt-everywhere-src-5.15.2/qtbase/src/corelib'
    make[2]: *** [Makefile:226: sub-corelib-make_first] Error 2
    make[2]: Leaving directory '/home/matinal/workstation/Qt/qt-everywhere-src-5.15.2/qtbase/src'
    make[1]: *** [Makefile:51: sub-src-make_first] Error 2
    make[1]: Leaving directory '/home/matinal/workstation/Qt/qt-everywhere-src-5.15.2/qtbase'
    make: *** [Makefile:75: module-qtbase-make_first] Error 2
    
    

    I wonder is a mismatch of the toolchain. Is there any version of toolchains that could work well?


  • Lifetime Qt Champion

    Hi,

    Why not use the latest release of the cross toolchain ?



  • Because it's the toolchain in the board SDK, I have compiled Qt5.12.2 successfully with gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu.Thanks.
    Besides, it still makes another error if I use gcc-linaro-7.5.0 to compile Qt5.15.2 . I will check it later.


Log in to reply