Cross-compile Qt 5 on Pi 2 - undefined reference to `pcre_get_stringtable_entries'



  • Hi All,

    I am trying to compile Qt 5.4.1 on Pi 2 and I am following steps that are mentioned here.

    I have done below mentioned steps :

    1.) Setup environment
    	mkdir ~/raspberry
    	cd ~/raspberry
    
    	wget http://www.tequnique.com/dl/raspberry/setdevenv
    	mv setdevenv setdevenv.sh
    	wget www.tequnique.com/dl/raspberry/gcc-4.7-linaro-rpi-gnueabihf.tbz
    	tar xfj gcc-4.7-linaro-rpi-gnueabihf.tbz	
    
    2.) On Raspberry (e.g. using SSH)
    	ssh pi@"raspberry ip address"
    	sudo apt-get update
    	sudo apt-get upgrade
    
    	sudo apt-get install libfontconfig1-dev libsqlite3-dev libxslt1-dev libssl-dev
    
    	# For QMultimedia:
    	sudo apt-get install libasound2-dev \ libavcodec-dev \ libavformat-dev \ libswscale-dev \ libgstreamer0.10-dev \ libgstreamer-plugins-base0.10-dev \ gstreamer-tools \ gstreamer0.10-plugins-good \ gstreamer0.10-plugins-bad
    
    3.) Shutdown raspberry
    	sudo shutdown -h now
    
    4.) Remove SD card and insert into PC
    	# Copy SD card to PC image
    	cd ~/raspberry
    	sudo dd if=/dev/sdb of=raspberry-working-image.img
    
    5.) Mount image
    	sudo /sbin/losetup /dev/loop0 raspberry-working-image.img
    	sudo /sbin/fdisk -l /dev/loop0
    	sudo mkdir /mnt/raspberry-rootfs
    	sudo mount -o loop,offset=70254592 raspberry-working-image.img /mnt/raspberry-rootfs
    	
    6.) Cross compile tools
    	source setdevenv.sh
    
    7.) git clone https://git.milosolutions.com/other/cross-compile-tools/
    	cd cross-compile-tools
    	sudo ./fixQualifiedLibraryPaths $MOUNTPOINT ../gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-gcc
    
    8.) sudo ln -s \
    	$MOUNTPOINT/opt/vc/include/interface/vmcs_host/linux/vchost_config.h \
    	$MOUNTPOINT/opt/vc/include/interface/vmcs_host/vchost_config.h
    
    9.) wget download.qt.io/official_releases/qt/5.4/5.4.1/single/qt-everywhere-opensource-src-5.4.1.tar.xz
    	tar xfvz qt-everywhere-opensource-src-5.4.1.tar.gz
    	cd qt-everywhere-opensource-src-5.4.1
    
    10.) ./configure \
    	-release \
    	-opengl es2 \
    	-optimized-qmake \
    	-no-pch \
    	-make libs \
    	-make tools \
    	-reduce-exports \
    	-sysroot /mnt/raspberry-rootfs \
    	-device linux-rasp-pi-g++ \
    	-device-option CROSS_COMPILE=/home/myhome/temporary/raspberry/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf- \
    	-prefix /usr/local/Qt-5.4.1-raspberry \
    	-opensource -nomake examples -nomake tests \
    	-confirm-license
    
    11.) make -j4
    
    

    When I compile the code, I am getting these errors :

    /mnt/raspberry-rootfs/usr/lib/arm-linux-gnueabihf/libglib-2.0.a(libglib_2_0_la-gregex.o): In function `get_matched_substring_number':
    (.text+0x1e8): undefined reference to `pcre_get_stringtable_entries'
    /mnt/raspberry-rootfs/usr/lib/arm-linux-gnueabihf/libglib-2.0.a(libglib_2_0_la-gregex.o): In function `get_matched_substring_number':
    (.text+0x264): undefined reference to `pcre_get_stringnumber'
    /mnt/raspberry-rootfs/usr/lib/arm-linux-gnueabihf/libglib-2.0.a(libglib_2_0_la-gregex.o): In function `g_match_info_next':
    (.text+0xa48): undefined reference to `pcre_exec'
    /mnt/raspberry-rootfs/usr/lib/arm-linux-gnueabihf/libglib-2.0.a(libglib_2_0_la-gregex.o): In function `regex_compile':
    (.text+0x1518): undefined reference to `pcre_compile2'
    /mnt/raspberry-rootfs/usr/lib/arm-linux-gnueabihf/libglib-2.0.a(libglib_2_0_la-gregex.o): In function `regex_compile':
    (.text+0x1530): undefined reference to `pcre_fullinfo'
    /mnt/raspberry-rootfs/usr/lib/arm-linux-gnueabihf/libglib-2.0.a(libglib_2_0_la-gregex.o): In function `regex_compile':
    (.text+0x1590): undefined reference to `pcre_fullinfo'
    /mnt/raspberry-rootfs/usr/lib/arm-linux-gnueabihf/libglib-2.0.a(libglib_2_0_la-gregex.o): In function `match_info_new':
    (.text+0x1de4): undefined reference to `pcre_fullinfo'
    /mnt/raspberry-rootfs/usr/lib/arm-linux-gnueabihf/libglib-2.0.a(libglib_2_0_la-gregex.o): In function `g_regex_unref':
    (.text+0x1e9c): undefined reference to `pcre_free'
    /mnt/raspberry-rootfs/usr/lib/arm-linux-gnueabihf/libglib-2.0.a(libglib_2_0_la-gregex.o): In function `g_regex_new':
    (.text+0x2084): undefined reference to `pcre_study'
    /mnt/raspberry-rootfs/usr/lib/arm-linux-gnueabihf/libglib-2.0.a(libglib_2_0_la-gregex.o): In function `g_regex_new':
    (.text+0x2110): undefined reference to `pcre_config'
    /mnt/raspberry-rootfs/usr/lib/arm-linux-gnueabihf/libglib-2.0.a(libglib_2_0_la-gregex.o): In function `g_regex_new':
    (.text+0x2140): undefined reference to `pcre_config'
    /mnt/raspberry-rootfs/usr/lib/arm-linux-gnueabihf/libglib-2.0.a(libglib_2_0_la-gregex.o): In function `g_regex_get_max_backref':
    (.text+0x2250): undefined reference to `pcre_fullinfo'
    /mnt/raspberry-rootfs/usr/lib/arm-linux-gnueabihf/libglib-2.0.a(libglib_2_0_la-gregex.o): In function `g_regex_get_capture_count':
    (.text+0x22a0): undefined reference to `pcre_fullinfo'
    /mnt/raspberry-rootfs/usr/lib/arm-linux-gnueabihf/libglib-2.0.a(libglib_2_0_la-gregex.o): In function `g_regex_get_has_cr_or_lf':
    (.text+0x22f0): undefined reference to `pcre_fullinfo'
    /mnt/raspberry-rootfs/usr/lib/arm-linux-gnueabihf/libglib-2.0.a(libglib_2_0_la-gregex.o): In function `g_regex_get_max_lookbehind':
    (.text+0x2348): undefined reference to `pcre_fullinfo'
    /mnt/raspberry-rootfs/usr/lib/arm-linux-gnueabihf/libglib-2.0.a(libglib_2_0_la-gregex.o): In function `g_regex_match_all_full':
    (.text+0x26e0): undefined reference to `pcre_dfa_exec'
    /mnt/raspberry-rootfs/usr/lib/arm-linux-gnueabihf/libglib-2.0.a(libglib_2_0_la-gregex.o): In function `g_regex_match_all_full':
    (.text+0x283c): undefined reference to `pcre_free'
    /mnt/raspberry-rootfs/usr/lib/arm-linux-gnueabihf/libglib-2.0.a(libglib_2_0_la-gregex.o): In function `g_regex_get_string_number':
    (.text+0x288c): undefined reference to `pcre_get_stringnumber'
    collect2: error: ld returned 1 exit status
    Makefile:964: recipe for target '../../lib/libQt5Widgets.so.5.6.2' failed
    make[3]: *** [../../lib/libQt5Widgets.so.5.6.2] Error 1
    make[3]: Leaving directory '/home/myhome/Documents/qt-source-code/qt5/qtbase/src/widgets'
    Makefile:631: recipe for target 'sub-widgets-make_first' failed
    make[2]: *** [sub-widgets-make_first] Error 2
    make[2]: Leaving directory '/home/myhome/Documents/qt-source-code/qt5/qtbase/src'
    Makefile:46: recipe for target 'sub-src-make_first' failed
    make[1]: *** [sub-src-make_first] Error 2
    make[1]: Leaving directory '/home/myhome/Documents/qt-source-code/qt5/qtbase'
    Makefile:67: recipe for target 'module-qtbase-make_first' failed
    make: *** [module-qtbase-make_first] Error 2
    
    

    Below mentioned in the output of configure command :

    Running configuration tests (phase 2)...
    Note: PKG_CONFIG_LIBDIR automatically set to /mnt/raspberry-rootfs/usr/lib/pkgconfig:/mnt/raspberry-rootfs/usr/share/pkgconfig:/mnt/raspberry-rootfs/usr/lib/arm-linux-gnueabihf/pkgconfig
    Note: PKG_CONFIG_SYSROOT_DIR automatically set to /mnt/raspberry-rootfs
    checking for C++11...  yes.
    checking for C++14...  no.
    checking for default C++ standard edition...  yes.
    checking for 64-bit std::atomic...  yes.
    checking for sse2...  no.
    checking for ipc_sysv...  yes.
    checking for zlib...  yes.
    checking for mtdev...  yes.
    checking for libjpeg...  yes.
    checking for libpng...  no.
    checking for dlopen...  no.
    checking for libdl...  no.
    checking for DB2...  no.
    checking for InterBase...  no.
    checking for MySQL (thread-safe)...  no.
    checking for MySQL (thread-unsafe)...  no.
    checking for OCI...  no.
    checking for ODBC...  yes.
    checking for PostgreSQL...  no.
    checking for SQLite2...  yes.
    checking for TDS...  yes.
    checking for Cups...  yes.
    checking for POSIX iconv...  yes.
    checking for D-Bus...  no.
    checking for libproxy...  no.
    checking for Glib...  yes.
    checking for ICU...  no.
    checking for PulseAudio...  no.
    checking for OpenGL ES 2.0...  yes.
    checking for OpenGL ES 3.0...  yes.
    checking for OpenGL ES 3.1...  no.
    checking for FontConfig...  yes.
    checking for libudev...  no.
    checking for evdev...  yes.
    checking for tslib...  yes.
    checking for xkbcommon...  yes.
    checking for XLib...  yes.
    checking for Xrender...  yes.
    checking for XInput2...  yes.
    checking for xcb...  yes.
    checking for xcb-xkb...  yes.
    checking for xcb-syslibs...  yes.
    checking for xcb-render...  yes.
    checking for xcb-glx...  yes.
    checking for xcb-xlib...  yes.
    checking for GBM...  yes.
    checking for LinuxFB...  yes.
    checking for KMS...  yes.
    checking for Mir client...  no.
    checking for EGL...  yes.
    checking for EGL-X11...  no.
    checking for eglfs-brcm...  yes.
    checking for eglfs-egldevice...  no.
    checking for eglfs-mali...  no.
    checking for eglfs-mali-2...  no.
    checking for eglfs-viv...  no.
    checking for STL...  yes.
    checking for POSIX clock_gettime()...  yes.
    checking for POSIX Monotonic Clock...  yes.
    checking for posix_fallocate...  yes.
    checking for mremap...  yes.
    checking for getaddrinfo...  yes.
    checking for inotify...  yes.
    checking for eventfd...  yes.
    checking for IPv6 interface name...  yes.
    checking for getifaddrs...  yes.
    checking for cloexec...  yes.
    checking for OpenSSL...  yes.
    checking for PCRE...  no.
    checking for OpenVG...  yes.
    checking for ShivaVG...  no.
    checking for alsa...  yes.
    checking for GStreamer 1.0...  no.
    checking for GStreamer 0.10...  no.
    Done running configuration tests.
    
       Configure summary
    
    Building on:   linux-g++ (i386, CPU features: none detected)
    Building for:  devices/linux-rasp-pi-g++ (arm, CPU features: none detected)
    Platform notes:
    
                - Also available for Linux: linux-clang linux-kcc linux-icc linux-cxx
            
    Build options:
      Configuration .......... accessibility accessibility-atspi-bridge alsa audio-backend c++11 clock-gettime clock-monotonic compile_examples concurrent cross_compile cups dbus egl eglfs eglfs_brcm eglfs_gbm enable_new_dtags evdev eventfd fontconfig full-config gbm getaddrinfo getifaddrs glib gtk2 gtkstyle harfbuzz iconv inotify ipv6ifname kms large-config largefile linuxfb medium-config minimal-config mremap mtdev no-libdl opengl opengles2 openssl openvg pcre png posix_fallocate qpa qpa reduce_exports release release_tools rpath shared small-config system-freetype system-jpeg system-zlib threadsafe-cloexec tslib xcb xcb-glx xcb-plugin xcb-render xcb-sm xcb-xlib xinput2 xkbcommon-evdev xlib xrender 
      Build parts ............  libs tools
      Mode ................... release; optimized tools
      Using sanitizer(s)...... none
      Using C++ standard ..... c++11
      Using gold linker....... no
      Using new DTAGS ........ yes
      Using PCH .............. no
      Using LTCG ............. no
      Target compiler supports:
        Neon ................. no
    
    Qt modules and options:
      Qt D-Bus ............... yes (loading dbus-1 at runtime)
      Qt Concurrent .......... yes
      Qt GUI ................. yes
      Qt Widgets ............. yes
      Large File ............. yes
      QML debugging .......... yes
      Use system proxies ..... no
    
    Support enabled for:
      Accessibility .......... yes
      ALSA ................... yes
      CUPS ................... yes
      Evdev .................. yes
      FontConfig ............. yes
      FreeType ............... yes (system library)
      Glib ................... yes
      GStreamer .............. no
      GTK theme .............. yes
      HarfBuzz ............... yes (bundled copy)
      Iconv .................. yes
      ICU .................... no
      Image formats: 
        GIF .................. yes (plugin, using bundled copy)
        JPEG ................. yes (plugin, using system library)
        PNG .................. yes (in QtGui, using bundled copy)
      libinput................ no
      Logging backends: 
        journald ............... no
        syslog   ............... no
      mtdev .................. yes (system library)
      Networking: 
        getaddrinfo .......... yes
        getifaddrs ........... yes
        IPv6 ifname .......... yes
        libproxy.............. no
        OpenSSL .............. yes (loading libraries at run-time)
      OpenGL / OpenVG: 
        EGL .................. yes
        OpenGL ............... yes (OpenGL ES 2.0+)
        OpenVG ............... yes-auto
      PCRE ................... yes (bundled copy)
      pkg-config ............. yes 
      PulseAudio ............. no
      QPA backends: 
        DirectFB ............. no
        EGLFS ................ yes
          EGLFS i.MX6 ........ no
          EGLFS i.MX6 Wayland. no
          EGLFS EGLDevice .... no
          EGLFS GBM .......... yes
          EGLFS Mali ......... no
          EGLFS Raspberry Pi . yes
          EGLFS X11 .......... no
        LinuxFB .............. yes
        Mir client............ no
        XCB .................. yes (system library)
          EGL on X ........... no
          GLX ................ yes
          MIT-SHM ............ yes
          Xcb-Xlib ........... yes
          Xcursor ............ yes (loaded at runtime)
          Xfixes ............. yes (loaded at runtime)
          Xi ................. no
          Xi2 ................ yes
          Xinerama ........... yes (loaded at runtime)
          Xrandr ............. yes (loaded at runtime)
          Xrender ............ yes
          XKB ................ yes
          XShape ............. yes
          XSync .............. yes
          XVideo ............. yes
      Session management ..... yes
      SQL drivers: 
        DB2 .................. no
        InterBase ............ no
        MySQL ................ no
        OCI .................. no
        ODBC ................. yes (plugin)
        PostgreSQL ........... no
        SQLite 2 ............. yes (plugin)
        SQLite ............... yes (plugin, using bundled copy)
        TDS .................. yes (plugin)
      tslib .................. yes
      udev ................... no
      xkbcommon-x11........... yes (system library)
      xkbcommon-evdev......... yes
      zlib ................... yes (system library)
    
    
    NOTE: Qt is using double for qreal on this system. This is binary incompatible against Qt 5.1.
    Configure with '-qreal float' to create a build that is binary compatible with 5.1.
    
    NOTE: -optimized-tools is not useful in -release mode.
    
    
    Qt is now configured for building. Just run 'make'.
    Once everything is built, you must run 'make install'.
    Qt will be installed into /usr/local/Qt-5.4.1-raspberry
    
    Prior to reconfiguration, make sure you remove any leftovers from
    the previous build.
    

    Can anyone please help me fixing this error? Please let me know your suggestions/comments. Thanks in advance.



  • Hi ashwasimha,

    We created a tool named qtrpi to automate the Qt cross-compilation on a Raspberry Pi. Maybe these scripts could help you to have a running Qt on your Raspberry Pi.

    There are 2 possible use cases for qtrpi:

    • qtrpi-full, in which everything is built automatically on your host machine (sysroot, Qt)
    • qtrpi-minimal, in which you download a ready-to-use sysroot with pre-compiled Qt binaries

    Overall, you only have to export a couple of environment variables (to select your version of Raspberry Pi / version of Qt) and execute a bash script.

    When qtrpi (full or minimal) is ready on your host machine, we also provide a script that installs Qt on your Raspberry Pi.

    Today, we support the Raspberry Pi 1, 2 and 3 and provide Qt 5.6 / 5.7 for each Raspberry Pi. If you are interested, here are a few links:

    If you have any questions / remarks, we would gladly discuss them with you, we want to improve this tool and make Qt easy to use on embedded platforms.


Log in to reply
 

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