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

Configure fontconfig failed



  • Hello

    I am deploying Qt5.7 for an imx 6 board. The host machine I use is Ubuntu 16.04:

    uname -a
    Linux matinal-PC 4.15.0-96-generic #97~16.04.1-Ubuntu SMP Wed Apr 1 03:03:31 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
    
    

    and the toolchain I use is :

    arm-linux-gnueabihf-g++ -v
    Using built-in specs.
    COLLECT_GCC=arm-linux-gnueabihf-g++
    COLLECT_LTO_WRAPPER=/opt/toolchain/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/../libexec/gcc/arm-linux-gnueabihf/7.5.0/lto-wrapper
    Target: arm-linux-gnueabihf
    
    

    I configure Qt with script as below:

    
    #~/bin/bash
    ./configure \
            -v \
            -prefix /opt/Qt5.7\
            -xplatform linux-arm-gnueabihf-g++ \
            -opensource \
            -confirm-license \
            -debug \
            -release \
            -shared \
            -strip \
            -fontconfig \
            -qreal float \
            -make libs \
            -make tools \
            -pch \
            -qt-zlib \
            -widgets \
            -skip qt3d \
            -skip qtcanvas3d \
            -skip qtdeclarative \
            -nomake examples \
            -no-use-gold-linker \
    
    

    It configured success with a lot of test errors for plugins. At first I ignored them , make and deployed it for imx6. Then ran a test app writed as below:

    #include <QPushButton>
    #include <QApplication>
    
    
    int main(int argc, char *argv[])
    {
        QApplication app(argc, argv);
        QPushButton btn("hello world");
        btn.resize(200,100);
        btn.show();
        return app.exec();
    }
    
    

    It plotted a window but didn't show the words. Then I checked the configuration information and found that fontconfig compiled failed :

    fontconfig.cpp:40:10: fatal error: ft2build.h: No such file or directory
     #include <ft2build.h>
              ^~~~~~~~~~~~
    compilation terminated.
    Makefile:417: recipe for target 'fontconfig.o' failed
    make: *** [fontconfig.o] Error 1
    FontConfig disabled.
    
    

    But <ft2build.h> actually exits in /usr/include . Then I check Makefile in qtbase/config.tests/unix/fontconfig and found that include path sames incomplete:

    INCPATH       = -I. -I/usr/include/libpng16 -I../../../mkspecs/linux-arm-gnueabihf-g++
    
    

    Is there any solution to fix this problem ?


  • Lifetime Qt Champion

    @Hupe said in Configure fontconfig failed:

    But <ft2build.h> actually exits in /usr/include

    On your host machine? You need it in your sysroot for your device, since you're cross compileing.



  • Thanks, but is there any different for a head file either in x86 or arm ?


  • Lifetime Qt Champion

    @Hupe No, but the libs are not compatible. So, you need that lib for your target machine.



  • This post is deleted!


  • @jsulm
    Do I need to add -sysroot in configuration scripts, which is the rooyfs of my device ?
    But if I do so , the configuration return with error:

    checking for C++11... 
    arm-linux-gnueabihf-g++ -c -pipe --sysroot=/home/matinal/matinal/imx-ubuntu -O2 -std=gnu++11 -Wall -W -fPIC  -I. -I../../../mkspecs/linux-arm-gnueabihf-g++ -o c++11.o c++11.cpp
    arm-linux-gnueabihf-g++ -Wl,-O1 -o c++11 c++11.o   --sysroot=/home/matinal/matinal/imx-ubuntu 
    /opt/toolchain/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/7.5.0/../../../../arm-linux-gnueabihf/bin/ld: warning: libm.so.6, needed by /opt/toolchain/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/7.5.0/../../../../arm-linux-gnueabihf/lib/libstdc++.so, not found (try using -rpath or -rpath-link)
    /opt/toolchain/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/7.5.0/../../../../arm-linux-gnueabihf/lib/libstdc++.so: undefined reference to `acos@GLIBC_2.4'
    /opt/toolchain/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/7.5.0/../../../../arm-linux-gnueabihf/lib/libstdc++.so: undefined reference to `hypot@GLIBC_2.4'
    /opt/toolchain/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/7.5.0/../../../../arm-linux-gnueabihf/lib/libstdc++.so: undefined reference to `cos@GLIBC_2.4'
    /opt/toolchain/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/7.5.0/../../../../arm-linux-gnueabihf/lib/libstdc++.so: undefined reference to `fmod@GLIBC_2.4'
    /opt/toolchain/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/7.5.0/../../../../arm-linux-gnueabihf/lib/libstdc++.so: undefined reference to `tan@GLIBC_2.4'
    /opt/toolchain/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/7.5.0/../../../../arm-linux-gnueabihf/lib/libstdc++.so: undefined reference to `atan@GLIBC_2.4'
    /opt/toolchain/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/7.5.0/../../../../arm-linux-gnueabihf/lib/libstdc++.so: undefined reference to `asin@GLIBC_2.4'
    /opt/toolchain/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/7.5.0/../../../../arm-linux-gnueabihf/lib/libstdc++.so: undefined reference to `sqrt@GLIBC_2.4'
    /opt/toolchain/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/7.5.0/../../../../arm-linux-gnueabihf/lib/libstdc++.so: undefined reference to `ceil@GLIBC_2.4'
    /opt/toolchain/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/7.5.0/../../../../arm-linux-gnueabihf/lib/libstdc++.so: undefined reference to `atan2@GLIBC_2.4'
    /opt/toolchain/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/7.5.0/../../../../arm-linux-gnueabihf/lib/libstdc++.so: undefined reference to `sin@GLIBC_2.4'
    /opt/toolchain/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/7.5.0/../../../../arm-linux-gnueabihf/lib/libstdc++.so: undefined reference to `tanh@GLIBC_2.4'
    /opt/toolchain/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/7.5.0/../../../../arm-linux-gnueabihf/lib/libstdc++.so: undefined reference to `sinh@GLIBC_2.4'
    /opt/toolchain/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/7.5.0/../../../../arm-linux-gnueabihf/lib/libstdc++.so: undefined reference to `pow@GLIBC_2.4'
    /opt/toolchain/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/7.5.0/../../../../arm-linux-gnueabihf/lib/libstdc++.so: undefined reference to `log@GLIBC_2.4'
    /opt/toolchain/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/7.5.0/../../../../arm-linux-gnueabihf/lib/libstdc++.so: undefined reference to `floor@GLIBC_2.4'
    /opt/toolchain/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/7.5.0/../../../../arm-linux-gnueabihf/lib/libstdc++.so: undefined reference to `log10@GLIBC_2.4'
    /opt/toolchain/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/7.5.0/../../../../arm-linux-gnueabihf/lib/libstdc++.so: undefined reference to `exp@GLIBC_2.4'
    /opt/toolchain/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/7.5.0/../../../../arm-linux-gnueabihf/lib/libstdc++.so: undefined reference to `cosh@GLIBC_2.4'
    collect2: error: ld returned 1 exit status
    Makefile:87: recipe for target 'c++11' failed
    make: *** [c++11] Error 1
    C++11 disabled.
    ERROR: Qt requires a C++11 compiler and yours does not seem to be that.
    Please upgrade.
    
    

    I have checked toolchain in my sysroot and it is same with the toolchain in my host machine.


  • Lifetime Qt Champion

    @Hupe How does the content of your sysroot look like? It should look like the root file system of your device and contain all the header files and libs (like usr/include, usr/lib, ...).



  • @jsulm

    .
    ├── bin
    │   ├── bash
    │   ├── bunzip2
    │   ├── bzcat
    │   ├── bzcmp -> bzdiff
    │   ├── bzdiff
    │   ├── bzegrep -> bzgrep
    │   ├── bzexe
    │   ├── bzfgrep -> bzgrep
    │   ├── bzgrep
    │   ├── bzip2
    │   ├── bzip2recover
    │   ├── bzless -> bzmore
    │   ├── bzmore
    │   ├── cat
    │   ├── chgrp
    │   ├── chmod
    │   ├── chown
    │   ├── chvt
    │   ├── cp
    │   ├── cpio
    │   ├── dash
    │   ├── date
    │   ├── dd
    │   ├── df
    │   ├── dir
    │   ├── dmesg
    │   ├── dnsdomainname -> hostname
    │   ├── domainname -> hostname
    │   ├── dumpkeys
    │   ├── echo
    │   ├── egrep
    │   ├── false
    │   ├── fgconsole
    │   ├── fgrep
    │   ├── findmnt
    │   ├── grep
    │   ├── gunzip
    │   ├── gzexe
    │   ├── gzip
    │   ├── hostname
    │   ├── ip
    │   ├── journalctl
    │   ├── kbd_mode
    │   ├── kill
    │   ├── kmod
    │   ├── less
    │   ├── lessecho
    │   ├── lessfile -> lesspipe
    │   ├── lesskey
    │   ├── lesspipe
    │   ├── ln
    │   ├── loadkeys
    │   ├── login
    │   ├── loginctl
    │   ├── ls
    │   ├── lsblk
    │   ├── lsmod -> kmod
    │   ├── mkdir
    │   ├── mknod
    │   ├── mktemp
    │   ├── more
    │   ├── mount
    │   ├── mountpoint
    │   ├── mt -> /etc/alternatives/mt
    │   ├── mt-gnu
    │   ├── mv
    │   ├── nano
    │   ├── nc -> /etc/alternatives/nc
    │   ├── nc.openbsd
    │   ├── netcat -> /etc/alternatives/netcat
    │   ├── netstat
    │   ├── networkctl
    │   ├── nisdomainname -> hostname
    │   ├── open -> openvt
    │   ├── openvt
    │   ├── pidof -> /sbin/killall5
    │   ├── ping
    │   ├── ping4 -> ping
    │   ├── ping6 -> ping
    │   ├── ps
    │   ├── pwd
    │   ├── rbash -> bash
    │   ├── readlink
    │   ├── rm
    │   ├── rmdir
    │   ├── rnano -> nano
    │   ├── run-parts
    │   ├── sed
    │   ├── setfont
    │   ├── setupcon
    │   ├── sh -> dash
    │   ├── sh.distrib -> dash
    │   ├── sleep
    │   ├── ss
    │   ├── stty
    │   ├── su
    │   ├── sync
    │   ├── systemctl
    │   ├── systemd -> /lib/systemd/systemd
    │   ├── systemd-ask-password
    │   ├── systemd-escape
    │   ├── systemd-hwdb
    │   ├── systemd-inhibit
    │   ├── systemd-machine-id-setup
    │   ├── systemd-notify
    │   ├── systemd-sysusers
    │   ├── systemd-tmpfiles
    │   ├── systemd-tty-ask-password-agent
    │   ├── tar
    │   ├── tempfile
    │   ├── touch
    │   ├── true
    │   ├── udevadm
    │   ├── umount
    │   ├── uname
    │   ├── uncompress
    │   ├── unicode_start
    │   ├── vdir
    │   ├── wdctl
    │   ├── which
    │   ├── whiptail
    │   ├── ypdomainname -> hostname
    │   ├── zcat
    │   ├── zcmp
    │   ├── zdiff
    │   ├── zegrep
    │   ├── zfgrep
    │   ├── zforce
    │   ├── zgrep
    │   ├── zless
    │   ├── zmore
    │   └── znew
    ├── boot
    ├── debootstrap
    │   └── debootstrap.log
    ├── dev
    │   ├── fd -> /proc/self/fd
    │   ├── full
    │   ├── null
    │   ├── ptmx -> pts/ptmx
    │   ├── pts
    │   ├── random
    │   ├── shm
    │   ├── stderr -> /proc/self/fd/2
    │   ├── stdin -> /proc/self/fd/0
    │   ├── stdout -> /proc/self/fd/1
    │   ├── tty
    │   ├── urandom
    │   └── zero
    ├── etc
    │   ├── adduser.conf
    │   ├── alternatives
    │   ├── apm
    │   ├── apparmor
    │   ├── apparmor.d
    │   ├── apt
    │   ├── bash.bashrc
    │   ├── bindresvport.blacklist
    │   ├── binfmt.d
    │   ├── ca-certificates
    │   ├── ca-certificates.conf
    │   ├── console-setup
    │   ├── cron.d
    │   ├── cron.daily
    │   ├── cron.hourly
    │   ├── cron.monthly
    │   ├── crontab
    │   ├── cron.weekly
    │   ├── dbus-1
    │   ├── debconf.conf
    │   ├── debian_version
    │   ├── default
    │   ├── deluser.conf
    │   ├── depmod.d
    │   ├── dhcp
    │   ├── dpkg
    │   ├── environment
    │   ├── fstab
    │   ├── gai.conf
    │   ├── group
    │   ├── group-
    │   ├── gshadow
    │   ├── gshadow-
    │   ├── gss
    │   ├── host.conf
    │   ├── hostname
    │   ├── hosts
    │   ├── hosts.allow
    │   ├── hosts.deny
    │   ├── init.d
    │   ├── initramfs-tools
    │   ├── inputrc
    │   ├── iproute2
    │   ├── issue
    │   ├── issue.net
    │   ├── kernel
    │   ├── ld.so.cache
    │   ├── ld.so.conf
    │   ├── ld.so.conf.d
    │   ├── legal
    │   ├── libaudit.conf
    │   ├── locale.alias
    │   ├── locale.gen -> /usr/share/i18n/SUPPORTED
    │   ├── localtime -> /usr/share/zoneinfo/Etc/UTC
    │   ├── logcheck
    │   ├── login.defs
    │   ├── logrotate.conf
    │   ├── logrotate.d
    │   ├── lsb-release
    │   ├── machine-id
    │   ├── magic
    │   ├── magic.mime
    │   ├── mailcap
    │   ├── mailcap.order
    │   ├── mime.types
    │   ├── mke2fs.conf
    │   ├── modprobe.d
    │   ├── modules
    │   ├── modules-load.d
    │   ├── nanorc
    │   ├── netplan
    │   ├── network
    │   ├── networks
    │   ├── newt
    │   ├── nsswitch.conf
    │   ├── opt
    │   ├── os-release -> ../usr/lib/os-release
    │   ├── pam.conf
    │   ├── pam.d
    │   ├── passwd
    │   ├── passwd-
    │   ├── profile
    │   ├── profile.d
    │   ├── protocols
    │   ├── python3
    │   ├── python3.6
    │   ├── rc0.d
    │   ├── rc1.d
    │   ├── rc2.d
    │   ├── rc3.d
    │   ├── rc4.d
    │   ├── rc5.d
    │   ├── rc6.d
    │   ├── rcS.d
    │   ├── resolv.conf -> ../run/systemd/resolve/stub-resolv.conf
    │   ├── rmt
    │   ├── rpc
    │   ├── rsyslog.conf
    │   ├── rsyslog.d
    │   ├── securetty
    │   ├── security
    │   ├── selinux
    │   ├── services
    │   ├── shadow
    │   ├── shadow-
    │   ├── shells
    │   ├── skel
    │   ├── ssh
    │   ├── ssl
    │   ├── subgid
    │   ├── subuid
    │   ├── sudoers
    │   ├── sudoers.d
    │   ├── sysctl.conf
    │   ├── sysctl.d
    │   ├── systemd
    │   ├── terminfo
    │   ├── timezone
    │   ├── tmpfiles.d
    │   ├── ucf.conf
    │   ├── udev
    │   ├── ufw
    │   ├── update-motd.d
    │   ├── vim
    │   ├── vtrgb -> /etc/alternatives/vtrgb
    │   ├── wgetrc
    │   ├── X11
    │   └── xdg
    ├── home
    ├── lib
    │   ├── arm-linux-gnueabihf
    │   ├── console-setup
    │   ├── cpp -> /etc/alternatives/cpp
    │   ├── ifupdown
    │   ├── init
    │   ├── klibc-dBxVNDqjuA4DCzJrDge81gB-saQ.so
    │   ├── ld-linux-armhf.so.3 -> arm-linux-gnueabihf/ld-2.27.so
    │   ├── linux-sound-base
    │   ├── lsb
    │   ├── modprobe.d
    │   ├── netplan
    │   ├── systemd
    │   ├── terminfo
    │   └── udev
    ├── media
    ├── mnt
    ├── opt
    │   ├── qt-everywhere-opensource-src-5.7.0
    │   ├── qt-everywhere-opensource-src-5.7.0.tar.xz
    │   └── toolchains
    ├── proc
    ├── root [error opening dir]
    ├── run
    │   ├── lock
    │   ├── mount
    │   ├── systemd
    │   └── utmp
    ├── sbin
    │   ├── agetty
    │   ├── alsa
    │   ├── badblocks
    │   ├── blkdeactivate
    │   ├── blkdiscard
    │   ├── blkid
    │   ├── blockdev
    │   ├── bridge
    │   ├── capsh
    │   ├── cfdisk
    │   ├── chcpu
    │   ├── ctrlaltdel
    │   ├── debugfs
    │   ├── depmod -> /bin/kmod
    │   ├── devlink
    │   ├── dhclient
    │   ├── dhclient-script
    │   ├── dmsetup
    │   ├── dmstats -> dmsetup
    │   ├── dumpe2fs
    │   ├── e2fsck
    │   ├── e2image
    │   ├── e2label -> tune2fs
    │   ├── e2undo
    │   ├── ethtool
    │   ├── fdisk
    │   ├── findfs
    │   ├── fsck
    │   ├── fsck.cramfs
    │   ├── fsck.ext2 -> e2fsck
    │   ├── fsck.ext3 -> e2fsck
    │   ├── fsck.ext4 -> e2fsck
    │   ├── fsck.minix
    │   ├── fsfreeze
    │   ├── fstab-decode
    │   ├── fstrim
    │   ├── getcap
    │   ├── getpcaps
    │   ├── getty -> agetty
    │   ├── halt -> /bin/systemctl
    │   ├── hwclock
    │   ├── ifconfig
    │   ├── ifdown -> ifup
    │   ├── ifquery -> ifup
    │   ├── ifup
    │   ├── init -> /lib/systemd/systemd
    │   ├── insmod -> /bin/kmod
    │   ├── installkernel
    │   ├── ip -> /bin/ip
    │   ├── ipmaddr
    │   ├── iptunnel
    │   ├── isosize
    │   ├── kbdrate
    │   ├── killall5
    │   ├── ldconfig
    │   ├── ldconfig.real
    │   ├── logsave
    │   ├── losetup
    │   ├── lsmod -> /bin/kmod
    │   ├── mii-tool
    │   ├── mke2fs
    │   ├── mkfs
    │   ├── mkfs.bfs
    │   ├── mkfs.cramfs
    │   ├── mkfs.ext2 -> mke2fs
    │   ├── mkfs.ext3 -> mke2fs
    │   ├── mkfs.ext4 -> mke2fs
    │   ├── mkfs.minix
    │   ├── mkhomedir_helper
    │   ├── mkswap
    │   ├── modinfo -> /bin/kmod
    │   ├── modprobe -> /bin/kmod
    │   ├── nameif
    │   ├── pam_extrausers_chkpwd
    │   ├── pam_extrausers_update
    │   ├── pam_tally
    │   ├── pam_tally2
    │   ├── pivot_root
    │   ├── plipconfig
    │   ├── poweroff -> /bin/systemctl
    │   ├── rarp
    │   ├── raw
    │   ├── reboot -> /bin/systemctl
    │   ├── resize2fs
    │   ├── rmmod -> /bin/kmod
    │   ├── route
    │   ├── rtacct
    │   ├── rtmon
    │   ├── runlevel -> /bin/systemctl
    │   ├── runuser
    │   ├── setcap
    │   ├── setvtrgb
    │   ├── sfdisk
    │   ├── shadowconfig
    │   ├── shutdown -> /bin/systemctl
    │   ├── slattach
    │   ├── start-stop-daemon
    │   ├── sulogin
    │   ├── swaplabel
    │   ├── swapoff
    │   ├── swapon
    │   ├── switch_root
    │   ├── sysctl
    │   ├── tc
    │   ├── telinit -> /bin/systemctl
    │   ├── tipc
    │   ├── tune2fs
    │   ├── udevadm -> /bin/udevadm
    │   ├── unix_chkpwd
    │   ├── unix_update
    │   ├── wipefs
    │   └── zramctl
    ├── srv
    ├── sys
    ├── tmp
    │   └── apt-tmp-index.M5XEq8
    ├── usr
    │   ├── bin
    │   ├── games
    │   ├── include
    │   ├── lib
    │   ├── local
    │   ├── sbin
    │   ├── share
    │   └── src
    └── var
        ├── backups
        ├── cache
        ├── lib
        ├── local
        ├── lock -> /run/lock
        ├── log
        ├── mail
        ├── opt
        ├── run -> /run
        ├── spool
        └── tmp
    
    

    this is the sysroot of my device



  • @Hupe
    I solved this problem by adding -no-gcc-sysroot ...


Log in to reply