Ubuntu20.04 编译Buildroot(支持Qt编译)

简介: Ubuntu20.04 编译Buildroot(支持Qt编译)

平台


Ubuntu 20.04(x64)

Buildroot 2021.02

Qt 5.15.2


关于Buildroot


buildroot使用介绍

The Buildroot user manual

通过buildroot+qemu搭建ARM-Linux虚拟开发环境


目标


简单描述:


1.buildroot的下载编译过程

2.支持QT的配置说明及步骤


模拟环境


在开始编译之前, 查询了一些资料, 对模拟器的支持如下:

ubuntu下使用qemu-system-arm模拟arm环境

Buildroot and QEMU – the quickest receipe for your own Linux


$ sudo apt-get install qemu-system-arm
$ qemu-system-arm --version
QEMU emulator version 4.2.1 (Debian 1:4.2-3ubuntu6.14)
Copyright (c) 2003-2019 Fabrice Bellard and the QEMU Project developers


而在成功编译完成后, 生成了output/images/start-qemu.sh, 并且可以直接运行


上面的步骤是否可以省略?


Buildroot下载解压


Downloads


$ll buildroot-2021.02.tar.gz
-rw-rw-r--  1 anson anson 6797744 3月  15 11:37 buildroot-2021.02.tar.gz
#解压后(仅参考,其中已包含一些编译后的文件)
$ll
drwxrwxr-x   16 anson anson   4096 3月  16 15:14 ./
drwxrwxr-x    6 anson anson   4096 3月  15 11:37 ../
drwxrwxr-x    2 anson anson   4096 3月   7 05:16 arch/
drwxrwxr-x   69 anson anson   4096 3月   7 05:16 board/
drwxrwxr-x   22 anson anson   4096 3月   7 05:16 boot/
-rw-rw-r--    1 anson anson 416183 3月   7 05:16 CHANGES
-rw-r--r--    1 anson anson 108253 3月  16 15:13 .config
-rw-rw-r--    1 anson anson  28043 3月   7 05:16 Config.in
-rw-rw-r--    1 anson anson 126066 3月   7 05:16 Config.in.legacy
-rw-r--r--    1 anson anson 108095 3月  16 14:55 .config.old
drwxrwxr-x    2 anson anson  20480 3月   7 05:16 configs/
-rw-r--r--    1 anson anson  98729 3月  16 15:14 ..config.tmp
-rw-rw-r--    1 anson anson  18767 3月   7 05:16 COPYING
-rw-rw-r--    1 anson anson   1198 3月   7 05:16 .defconfig
-rw-rw-r--    1 anson anson  68473 3月   7 05:16 DEVELOPERS
drwxr-xr-x   56 anson anson   4096 3月  16 15:52 dl/
drwxr-xr-x    5 anson anson   4096 3月   7 05:24 docs/
-rw-rw-r--    1 anson anson     96 3月   7 05:16 .flake8
drwxrwxr-x   19 anson anson   4096 3月   7 05:16 fs/
-rw-rw-r--    1 anson anson    125 3月   7 05:16 .gitignore
-rw-rw-r--    1 anson anson    557 3月   7 05:16 .gitlab-ci.yml
drwxrwxr-x    2 anson anson   4096 3月   7 05:16 linux/
-rw-rw-r--    1 anson anson  45530 3月   7 05:16 Makefile
-rw-rw-r--    1 anson anson   2292 3月   7 05:16 Makefile.legacy
drwxrwxr-x    6 anson anson   4096 3月  16 16:45 output/
drwxrwxr-x 2495 anson anson  69632 3月   7 05:16 package/
-rw-rw-r--    1 anson anson   1079 3月   7 05:16 README
drwxrwxr-x   13 anson anson   4096 3月   7 05:16 support/
drwxrwxr-x    3 anson anson   4096 3月   7 05:16 system/
drwxrwxr-x    5 anson anson   4096 3月   7 05:16 toolchain/
drwxrwxr-x    3 anson anson   4096 3月   7 05:16 utils/


Buildroot配置编译


# 加载默认ARM模拟配置
$ make qemu_arm_vexpress_defconfig
#编译
$ make


# 编译完成的一些LOG
Filesystem UUID: 68f5438c-6ab0-4b9b-9dbf-ec8856ea50ed
Superblock backups stored on blocks: 
  8193, 24577, 40961, 57345
Allocating group tables: done                            
Writing inode tables: done                            
Copying files into the device: done
Writing superblocks and filesystem accounting information: done
ln -snf /home/anson/codes/buildroot-2021.02/output/host/arm-buildroot-linux-uclibcgnueabihf/sysroot /home/anson/codes/buildroot-2021.02/output/staging
>>>   Executing post-image script board/qemu/post-image.sh


运行模拟环境


$ output/images/start-qemu.sh 
VNC server running on ::1:5900
Booting Linux on physical CPU 0x0
Linux version 5.10.7 (anson@server4) (arm-buildroot-linux-uclibcgnueabihf-gcc.br_real (Buildroot 2021.02) 9.3.0, GNU ld (GNU Binutils) 2.35.2) #1 SMP Tue Mar 16 16:37:25 CST 2021
CPU: ARMv7 Processor [410fc090] revision 0 (ARMv7), cr=10c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
OF: fdt: Machine model: V2P-CA9
Memory policy: Data cache writeback
Reserved memory: created DMA memory pool at 0x4c000000, size 8 MiB
OF: reserved mem: initialized node vram@4c000000, compatible id shared-dma-pool
cma: Reserved 16 MiB at 0x6f000000
Zone ranges:
  Normal   [mem 0x0000000060000000-0x000000006fffffff]
Movable zone start for each node
Early memory node ranges
  node   0: [mem 0x0000000060000000-0x000000006fffffff]
Initmem setup node 0 [mem 0x0000000060000000-0x000000006fffffff]
CPU: All CPU(s) started in SVC mode.
percpu: Embedded 19 pages/cpu s46156 r8192 d23476 u77824
Built 1 zonelists, mobility grouping on.  Total pages: 65024
Kernel command line: console=ttyAMA0,115200 rootwait root=/dev/mmcblk0
printk: log_buf_len individual max cpu contribution: 4096 bytes
printk: log_buf_len total cpu_extra contributions: 12288 bytes
printk: log_buf_len min size: 16384 bytes
printk: log_buf_len: 32768 bytes
printk: early log buf free: 14792(90%)
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes, linear)
Inode-cache hash table entries: 16384 (order: 4, 65536 bytes, linear)
mem auto-init: stack:off, heap alloc:off, heap free:off
Memory: 231920K/262144K available (7168K kernel code, 583K rwdata, 1748K rodata, 1024K init, 181K bss, 13840K reserved, 16384K cma-reserved)
SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
rcu: Hierarchical RCU implementation.
rcu:  RCU event tracing is enabled.
rcu:  RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=4.
rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
GIC CPU mask not found - kernel will fail to boot.
GIC CPU mask not found - kernel will fail to boot.
L2C: platform modifies aux control register: 0x02020000 -> 0x02420000
L2C: DT/platform modifies aux control register: 0x02020000 -> 0x02420000
L2C-310 enabling early BRESP for Cortex-A9
L2C-310 full line of zeros enabled for Cortex-A9
L2C-310 dynamic clock gating disabled, standby mode disabled
L2C-310 cache controller enabled, 8 ways, 128 kB
L2C-310: CACHE_ID 0x410000c8, AUX_CTRL 0x46420001
random: get_random_bytes called from start_kernel+0x384/0x538 with crng_init=0
sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
clocksource: arm,sp804: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275 ns
Failed to initialize '/bus@4000000/motherboard/iofpga@7,00000000/timer@12000': -22
smp_twd: clock not found -2
Console: colour dummy device 80x30
Calibrating local timer... 99.83MHz.
Calibrating delay loop... 427.62 BogoMIPS (lpj=2138112)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
CPU: Testing write buffer coherency: ok
CPU0: Spectre v2: using BPIALL workaround
CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
Setting up static identity map for 0x60100000 - 0x60100060
rcu: Hierarchical SRCU implementation.
smp: Bringing up secondary CPUs ...
smp: Brought up 1 node, 1 CPU
SMP: Total of 1 processors activated (427.62 BogoMIPS).
CPU: All CPU(s) started in SVC mode.
devtmpfs: initialized
VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 0
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
cpuidle: using governor ladder
hw-breakpoint: debug architecture 0x4 unsupported.
Serial: AMBA PL011 UART driver
irq: type mismatch, failed to map hwirq-75 for interrupt-controller@1e001000!
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
Advanced Linux Sound Architecture Driver Initialized.
clocksource: Switched to clocksource arm,sp804
NET: Registered protocol family 2
tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes, linear)
TCP established hash table entries: 2048 (order: 1, 8192 bytes, linear)
TCP bind hash table entries: 2048 (order: 2, 16384 bytes, linear)
TCP: Hash tables configured (established 2048 bind 2048)
UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
hw perfevents: enabled with armv7_cortex_a9 PMU driver, 5 counters available
workingset: timestamp_bits=30 max_order=16 bucket_order=0
squashfs: version 4.0 (2009/01/31) Phillip Lougher
jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
9p: Installing v9fs 9p2000 file system support
io scheduler mq-deadline registered
io scheduler kyber registered
i2c i2c-0: Added multiplexed i2c bus 2
physmap-flash 40000000.flash: physmap platform flash device: [mem 0x40000000-0x43ffffff]
40000000.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000000 Chip ID 0x000000
Intel/Sharp Extended Query Table at 0x0031
Using buffer write method
physmap-flash 40000000.flash: physmap platform flash device: [mem 0x44000000-0x47ffffff]
40000000.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000000 Chip ID 0x000000
Intel/Sharp Extended Query Table at 0x0031
Using buffer write method
Concatenating MTD devices:
(0): "40000000.flash"
(1): "40000000.flash"
into device "40000000.flash"
physmap-flash 48000000.psram: physmap platform flash device: [mem 0x48000000-0x49ffffff]
libphy: Fixed MDIO Bus: probed
libphy: smsc911x-mdio: probed
smsc911x 4e000000.ethernet eth0: MAC Address: 52:54:00:12:34:56
isp1760 4f000000.usb: bus width: 32, oc: digital
isp1760 4f000000.usb: NXP ISP1760 USB Host Controller
isp1760 4f000000.usb: new USB bus registered, assigned bus number 1
isp1760 4f000000.usb: Scratch test failed.
isp1760 4f000000.usb: can't setup: -19
isp1760 4f000000.usb: USB bus 1 deregistered
usbcore: registered new interface driver usb-storage
ledtrig-cpu: registered to indicate activity on CPUs
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
NET: Registered protocol family 17
9pnet: Installing 9P2000 support
oprofile: using arm/armv7-ca9
Registering SWP/SWPB emulation handler
aaci-pl041 10004000.aaci: ARM AC'97 Interface PL041 rev0 at 0x10004000, irq 32
aaci-pl041 10004000.aaci: FIFO 512 entries
mmci-pl18x 10005000.mmci: Got CD GPIO
mmci-pl18x 10005000.mmci: Got WP GPIO
mmci-pl18x 10005000.mmci: mmc0: PL181 manf 41 rev0 at 0x10005000 irq 33,34 (pio)
10009000.uart: ttyAMA0 at MMIO 0x10009000 (irq = 37, base_baud = 0) is a PL011 rev1
printk: console [ttyAMA0] enabled
1000a000.uart: ttyAMA1 at MMIO 0x1000a000 (irq = 38, base_baud = 0) is a PL011 rev1
1000b000.uart: ttyAMA2 at MMIO 0x1000b000 (irq = 39, base_baud = 0) is a PL011 rev1
1000c000.uart: ttyAMA3 at MMIO 0x1000c000 (irq = 40, base_baud = 0) is a PL011 rev1
rtc-pl031 10017000.rtc: registered as rtc0
rtc-pl031 10017000.rtc: setting system clock to 2021-03-16T09:37:19 UTC (1615887439)
mmc0: new SD card at address 4567
drm-clcd-pl111 1001f000.clcd: assigned reserved memory node vram@4c000000
drm-clcd-pl111 1001f000.clcd: using device-specific reserved memory
drm-clcd-pl111 1001f000.clcd: core tile graphics present
drm-clcd-pl111 1001f000.clcd: this device will be deactivated
drm-clcd-pl111 1001f000.clcd: Versatile Express init failed - -19
mmcblk0: mmc0:4567 QEMU! 64.0 MiB 
drm-clcd-pl111 10020000.clcd: DVI muxed to daughterboard 1 (core tile) CLCD
input: AT Raw Set 2 keyboard as /devices/platform/bus@4000000/bus@4000000:motherboard/bus@4000000:motherboard:iofpga@7,00000000/10006000.kmi/serio0/input/input0
drm-clcd-pl111 10020000.clcd: initializing Versatile Express PL111
drm-clcd-pl111 10020000.clcd: found bridge on endpoint 0
drm-clcd-pl111 10020000.clcd: Using non-panel bridge
[drm] Initialized pl111 1.0.0 20170317 for 10020000.clcd on minor 0
Console: switching to colour frame buffer device 128x48
drm-clcd-pl111 10020000.clcd: [drm] fb0: pl111drmfb frame buffer device
ALSA device list:
  #0: ARM AC'97 Interface PL041 rev0 at 0x10004000, irq 32
input: ImExPS/2 Generic Explorer Mouse as /devices/platform/bus@4000000/bus@4000000:motherboard/bus@4000000:motherboard:iofpga@7,00000000/10007000.kmi/serio1/input/input2
random: fast init done
EXT4-fs (mmcblk0): mounted filesystem without journal. Opts: (null)
VFS: Mounted root (ext4 filesystem) readonly on device 179:0.
devtmpfs: mounted
Freeing unused kernel memory: 1024K
Run /sbin/init as init process
random: crng init done
EXT4-fs (mmcblk0): re-mounted. Opts: (null)
ext4 filesystem being remounted at / supports timestamps until 2038 (0x7fffffff)
Starting syslogd: OK
Starting klogd: OK
Running sysctl: OK
Saving random seed: OK
Starting network: Generic PHY 4e000000.ethernet-ffffffff:01: attached PHY driver [Generic PHY] (mii_bus:phy_addr=4e000000.ethernet-ffffffff:01, irq=POLL)
smsc911x 4e000000.ethernet eth0: SMSC911x/921x identified at 0x908b0000, IRQ: 30
udhcpc: started, v1.33.0
udhcpc: sending discover
udhcpc: sending select for 10.0.2.15
udhcpc: lease of 10.0.2.15 obtained, lease time 86400
deleting routers
adding dns 10.0.2.3
OK
Initializing postgresql data base...
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "C".
The default database encoding has accordingly been set to "SQL_ASCII".
The default text search configuration will be set to "english".
Data page checksums are disabled.
fixing permissions on existing directory /var/lib/pgsql ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... 
UTC
creating configuration files ... ok
running bootstrap script ... 2021-03-16 09:38:36.554 UTC [137] FATAL:  could not write to file "pg_wal/xlogtemp.137": No space left on device
child process exited with exit code 1
initdb: removing contents of data directory "/var/lib/pgsql"
pg_ctl: database system initialization failed
done
Starting postgresql: pg_ctl: directory "/var/lib/pgsql" is not a database cluster directory
OK
Welcome to Buildroot
buildroot login: root
# ls -la /
total 25
drwxr-xr-x   18 root     root          1024 Mar 16 08:45 .
drwxr-xr-x   18 root     root          1024 Mar 16 08:45 ..
drwxr-xr-x    2 root     root          2048 Mar 16 08:45 bin
drwxr-xr-x    7 root     root          2900 Mar 16 09:37 dev
drwxr-xr-x    6 root     root          1024 Mar 16 08:45 etc
drwxr-xr-x    3 root     root          1024 Mar 16 08:45 lib
lrwxrwxrwx    1 root     root             3 Mar 16 07:25 lib32 -> lib
lrwxrwxrwx    1 root     root            11 Mar 16 07:39 linuxrc -> bin/busybox
drwx------    2 root     root         12288 Mar 16 08:45 lost+found
drwxr-xr-x    2 root     root          1024 Mar  6 21:16 media
drwxr-xr-x    2 root     root          1024 Mar  6 21:16 mnt
drwxr-xr-x    2 root     root          1024 Mar  6 21:16 opt
dr-xr-xr-x  106 root     root             0 Mar 16 09:37 proc
drwx------    2 root     root          1024 Mar 16 09:40 root
drwxr-xr-x    3 root     root           160 Mar 16 09:37 run
drwxr-xr-x    2 root     root          1024 Mar 16 08:45 sbin
dr-xr-xr-x   12 root     root             0 Mar 16 09:37 sys
drwxrwxrwt    2 root     root            80 Mar 16 09:37 tmp
drwxr-xr-x    6 root     root          1024 Mar 16 08:45 usr
drwxr-xr-x    4 root     root          1024 Mar 16 08:45 var


一些问题:


尝试运行menuconfig报错:


$ make menuconfig
/usr/bin/gcc -I/usr/include/ncursesw -DCURSES_LOC="<curses.h>"  -DNCURSES_WIDECHAR=1 -DLOCALE  -I/home/anson/work/codes/buildroot-2021.02/output/build/buildroot-config -DCONFIG_=\"\"   /home/anson/work/codes/buildroot-2021.02/output/build/buildroot-config/mconf.o /home/anson/work/codes/buildroot-2021.02/output/build/buildroot-config/zconf.tab.o /home/anson/work/codes/buildroot-2021.02/output/build/buildroot-config/lxdialog/checklist.o /home/anson/work/codes/buildroot-2021.02/output/build/buildroot-config/lxdialog/util.o /home/anson/work/codes/buildroot-2021.02/output/build/buildroot-config/lxdialog/inputbox.o /home/anson/work/codes/buildroot-2021.02/output/build/buildroot-config/lxdialog/textbox.o /home/anson/work/codes/buildroot-2021.02/output/build/buildroot-config/lxdialog/yesno.o /home/anson/work/codes/buildroot-2021.02/output/build/buildroot-config/lxdialog/menubox.o  -o /home/anson/work/codes/buildroot-2021.02/output/build/buildroot-config/mconf
/usr/bin/ld: /home/anson/work/codes/buildroot-2021.02/output/build/buildroot-config/mconf.o: in function `show_help':
mconf.c:(.text+0x1862): undefined reference to `stdscr'
/usr/bin/ld: mconf.c:(.text+0x186e): undefined reference to `stdscr'
/usr/bin/ld: /home/anson/work/codes/buildroot-2021.02/output/build/buildroot-config/lxdialog/checklist.o: in function `print_item':
checklist.c:(.text+0x8a): undefined reference to `wattrset'
/usr/bin/ld: checklist.c:(.text+0xa0): undefined reference to `wmove'
....省略....
/usr/bin/ld: /home/anson/work/codes/buildroot-2021.02/output/build/buildroot-config/lxdialog/menubox.o:menubox.c:(.text+0x1300): more undefined references to `delwin' follow
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile.br:28: mconf] Error 1
rm /home/anson/work/codes/buildroot-2021.02/output/build/buildroot-config/zconf.tab.c
make[1]: *** [Makefile:969: /home/anson/work/codes/buildroot-2021.02/output/build/buildroot-config/mconf] Error 2
make: *** [Makefile:84: _all] Error 2


解决 Solution for “make menuconfig” Error in Linux PC


# 无效
#$ sudo apt-get install build-essentials
$ sudo apt-get install libncurses5  libncurses5-dev


以下为PC内存的问题, 此问题忽略


$ make
cc: internal compiler error: Segmentation fault signal terminated program as
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-9/README.Bugs> for instructions.
make[4]: *** [Makefile:488: lucnum2_ui.lo] Error 1
make[4]: *** Waiting for unfinished jobs....
libtool: compile:  /usr/bin/gcc -DHAVE_CONFIG_H -I. -I.. -D__GMP_WITHIN_GMP -I.. -I/home/anson/work/codes/buildroot-2021.02/output/host/include -O2 -I/home/anson/work/codes/buildroot-2021.02/output/host/include -c mul_si.c  -fPIC -DPIC -o .libs/mul_si.o
libtool: compile:  /usr/bin/gcc -DHAVE_CONFIG_H -I. -I.. -D__GMP_WITHIN_GMP -I.. -I/home/anson/work/codes/buildroot-2021.02/output/host/include -O2 -I/home/anson/work/codes/buildroot-2021.02/output/host/include -c n_pow_ui.c  -fPIC -DPIC -o .libs/n_pow_ui.o
libtool: compile:  /usr/bin/gcc -DHAVE_CONFIG_H -I. -I.. -D__GMP_WITHIN_GMP -I.. -I/home/anson/work/codes/buildroot-2021.02/output/host/include -O2 -I/home/anson/work/codes/buildroot-2021.02/output/host/include -c mul_ui.c  -fPIC -DPIC -o .libs/mul_ui.o
make[3]: *** [Makefile:997: all-recursive] Error 1
make[2]: *** [Makefile:787: all] Error 2
make[1]: *** [package/pkg-generic.mk:250: /home/anson/work/codes/buildroot-2021.02/output/build/host-gmp-6.2.1/.stamp_built] Error 2
make: *** [Makefile:84: _all] Error 2


make[2]: /home/rohit/workplace/rp/buildroot/output/host/usr/bin/arm-buildroot-linux-uclibcgnueabihf-gcc


Getting arm-buildroot-linux-uclibcgnueabihf-gcc: Command not found


如何支持 Qt


前面编译出来的系统, 并没有对QT的支持, 仅仅用于验证开发环境的一些尝试


make menuconfig


image.pngimage.pngimage.png


默认的模拟配置并不支持勾选QT选项


*** Qt5 needs host g++ >= 5.0, and a toolchain w/ gcc >= 5.0, wchar, NPTL, C++, dynam ***


估计是问题有些太低级, 所以, 不管GOOGLE还是BAIDU,

没有文章可以给出很好的答案来说明, 如何让QT选项可以勾选.


解决:

修改Toolchain后, 终于可以用QT的选项了:


image.pngimage.pngimage.png


重新编译


# 清除, 不清除编译会有报错
$ make clean
# 重新编译
$ make


编译完成后, 可以找到qmake


$ output/build/qt5base-5.15.2/bin/qmake -v
QMake version 3.1
Using Qt version 5.15.2 in /home/anson/codes/buildroot-2021.02/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib


也可以找到相应的examples, 如 analogclock


output/build/qt5base-5.15.2/examples/widgets/widgets$ ll
total 116
drwxr-xr-x 27 anson anson 4096 11月 13 01:24 ./
drwxr-xr-x 25 anson anson 4096 11月 13 01:24 ../
drwxr-xr-x  2 anson anson 4096 11月 13 01:24 analogclock/
drwxr-xr-x  2 anson anson 4096 11月 13 01:24 calculator/
drwxr-xr-x  2 anson anson 4096 11月 13 01:24 calendarwidget/
drwxr-xr-x  2 anson anson 4096 11月 13 01:24 charactermap/
drwxr-xr-x  2 anson anson 4096 11月 13 01:24 codeeditor/
drwxr-xr-x  2 anson anson 4096 11月 13 01:24 digitalclock/
drwxr-xr-x  2 anson anson 4096 11月 13 01:24 elidedlabel/
drwxr-xr-x  2 anson anson 4096 11月 13 01:24 groupbox/
drwxr-xr-x  3 anson anson 4096 11月 13 01:24 icons/
drwxr-xr-x  2 anson anson 4096 11月 13 01:24 imageviewer/
drwxr-xr-x  2 anson anson 4096 11月 13 01:24 lineedits/
drwxr-xr-x  2 anson anson 4096 11月 13 01:24 mousebuttons/
drwxr-xr-x  2 anson anson 4096 11月 13 01:24 movie/
-rw-r--r--  1 anson anson  477 10月 27 16:02 README
drwxr-xr-x  2 anson anson 4096 11月 13 01:24 scribble/
drwxr-xr-x  2 anson anson 4096 11月 13 01:24 shapedclock/
drwxr-xr-x  2 anson anson 4096 11月 13 01:24 sliders/
drwxr-xr-x  2 anson anson 4096 11月 13 01:24 spinboxes/
drwxr-xr-x  3 anson anson 4096 11月 13 01:24 styles/
drwxr-xr-x  5 anson anson 4096 11月 13 01:24 stylesheet/
drwxr-xr-x  3 anson anson 4096 11月 13 01:24 tablet/
drwxr-xr-x  2 anson anson 4096 11月 13 01:24 tetrix/
drwxr-xr-x  3 anson anson 4096 11月 13 01:24 tooltips/
drwxr-xr-x  2 anson anson 4096 11月 13 01:24 validators/
-rw-r--r--  1 anson anson  725 10月 27 16:02 widgets.pro
drwxr-xr-x  2 anson anson 4096 11月 13 01:24 wiggly/
drwxr-xr-x  2 anson anson 4096 11月 13 01:24 windowflags/


如何在Buildroot中编译Qt请参考:

[哇酷网 whycan.cn]Buildroot成功后如何编译Qt应用程序


尝试执行qmake生成Makefile文件时报错:


失败的尝试 1


buildroot-2021.02$ output/build/qt5base-5.15.2/bin/qmake output/build/qt5base-5.15.2/examples/widgets/widgets/analogclock/analogclock.pro
Info: creating stash file /.qmake.stash
/home/anson/codes/buildroot-2021.02/output/build/qt5base-5.15.2/mkspecs/features/toolchain.prf:73: Cannot write cache file /.qmake.stash: Permission denied
Info: creating stash file /.qmake.stash
/home/anson/codes/buildroot-2021.02/output/build/qt5base-5.15.2/mkspecs/features/toolchain.prf:73: Cannot write cache file /.qmake.stash: Permission denied
Info: creating stash file /.qmake.stash
/home/anson/codes/buildroot-2021.02/output/build/qt5base-5.15.2/mkspecs/features/toolchain.prf:73: Cannot write cache file /.qmake.stash: Permission denied
Info: creating stash file /.qmake.stash
/home/anson/codes/buildroot-2021.02/output/build/qt5base-5.15.2/mkspecs/features/toolchain.prf:73: Cannot write cache file /.qmake.stash: Permission denied
Info: creating stash file /.qmake.stash
/home/anson/codes/buildroot-2021.02/output/build/qt5base-5.15.2/mkspecs/features/toolchain.prf:76: Cannot write cache file /.qmake.stash: Permission denied
Info: creating stash file /.qmake.stash
/home/anson/codes/buildroot-2021.02/output/build/qt5base-5.15.2/mkspecs/features/toolchain.prf:409: Cannot write cache file /.qmake.stash: Permission denied
Info: creating stash file /.qmake.stash
/home/anson/codes/buildroot-2021.02/output/build/qt5base-5.15.2/mkspecs/features/toolchain.prf:411: Cannot write cache file /.qmake.stash: Permission denied
Project ERROR: Unknown module(s) in QT: gui widgets


失败的尝试 2


output/build/qt5base-5.15.2/examples/widgets/widgets/analogclock$ /home/anson/codes/buildroot-2021.02/output/build/qt5base-5.15.2/bin/qmake analogclock.pro
Project ERROR: Unknown module(s) in QT: gui widgets


解决: 打开QT中gui->widgets配置

image.png

重新编译


# 清除, 不清除编译会有报错
$ make clean
# 重新编译
$ make


编译完成后, analogclock已经编译好了


output/build/qt5base-5.15.2/examples/widgets/widgets/analogclock$ ll
total 132
drwxr-xr-x  5 anson anson  4096 3月  16 16:51 ./
drwxr-xr-x 27 anson anson  4096 3月  16 16:33 ../
-rwxrwxr-x  1 anson anson 27180 3月  16 16:51 analogclock*
-rw-r--r--  1 anson anson  4675 10月 27 16:02 analogclock.cpp
-rw-r--r--  1 anson anson  2712 10月 27 16:02 analogclock.h
-rw-r--r--  1 anson anson   242 10月 27 16:02 analogclock.pro
-rw-r--r--  1 anson anson  2641 10月 27 16:02 main.cpp
-rw-rw-r--  1 anson anson 61743 3月  16 16:51 Makefile
drwxrwxr-x  2 anson anson  4096 3月  16 16:51 .moc/
drwxrwxr-x  2 anson anson  4096 3月  16 16:51 .obj/
drwxrwxr-x  2 anson anson  4096 3月  16 16:51 .pch/


尝试删除 analogclock Makefile .moc .obj .pch, 再执行qmake, 可以正常生成Makefile

执行make, 生成analogclock


—完结—


参考


Buildroot笔记

buildroot使用介绍

The Buildroot user manual

通过buildroot+qemu搭建ARM-Linux虚拟开发环境

ubuntu下使用qemu-system-arm模拟arm环境

Buildroot and QEMU – the quickest receipe for your own Linux

Getting arm-buildroot-linux-uclibcgnueabihf-gcc: Command not found

Solution for “make menuconfig” Error in Linux PC

[哇酷网 whycan.cn]Buildroot成功后如何编译Qt应用程序

通过buildroot解决需要移植QT库的问题!!!!步骤详细,需要的拿走

GCC_ARM_LINUX Downloads


相关文章
|
3月前
|
C++
VS2019编译VTK-9.1.0+Qt5.15.2
本文介绍了在VS2019和Qt 5.15.2环境下编译VTK 9.1.0的过程,包括成功编译无警告和错误的截图、修改的pro文件内容,以及在QML中加入VTK的失败尝试和参考链接。
141 4
|
2天前
|
JSON Ubuntu 开发者
ubuntu 22安装lua环境&&编译lua cjson模块
通过上述步骤,可以在 Ubuntu 22.04 系统上成功安装 Lua 环境,并使用 LuaRocks 或手动编译的方式安装 lua-cjson 模块。本文详细介绍了每一步的命令和操作,确保每一步都能顺利完成,适合需要在 Ubuntu 系统上配置 Lua 开发环境的开发者参考和使用。
28 13
|
2月前
|
Ubuntu 应用服务中间件 nginx
Ubuntu安装笔记(三):ffmpeg(3.2.16)源码编译opencv(3.4.0)
本文是关于Ubuntu系统中使用ffmpeg 3.2.16源码编译OpenCV 3.4.0的安装笔记,包括安装ffmpeg、编译OpenCV、卸载OpenCV以及常见报错处理。
224 2
Ubuntu安装笔记(三):ffmpeg(3.2.16)源码编译opencv(3.4.0)
|
2月前
|
Ubuntu 编译器 计算机视觉
Ubuntu系统编译OpenCV4.8源码
【10月更文挑战第17天】只要三步即可搞定,第一步是下载指定版本的源码包;第二步是安装OpenCV4.8编译需要的编译器与第三方库支持;第三步就是编译OpenCV源码包生成安装文件并安装。
|
3月前
|
C语言 Android开发 C++
基于MTuner软件进行qt的mingw编译程序的内存泄漏检测
本文介绍了使用MTuner软件进行Qt MinGW编译程序的内存泄漏检测的方法,提供了MTuner的下载链接和测试代码示例,并通过将Debug程序拖入MTuner来定位内存泄漏问题。
基于MTuner软件进行qt的mingw编译程序的内存泄漏检测
|
3月前
|
C++
vtkdicom0.8_vtk9.2_dcmtk3.6.7_qt6.2编译OK
本文介绍了如何编译整合VTK 9.2、DICOM 0.8、DCMTK 3.6.7和Qt 6.2的步骤,包括安装Qt、CMake配置以及确认相关路径和版本设置。
vtkdicom0.8_vtk9.2_dcmtk3.6.7_qt6.2编译OK
|
3月前
|
Unix 网络虚拟化 C++
VS2022+Qt5.14.2成功编译MITK2022.10
使用VS2022和Qt5.14.2成功编译MITK2022.10的过程,包括编译结果的截图、遇到的编译问题的解决方法、两个重要的注意事项(patch文件格式的修改和ITK-gitclone-lastrun文件的存在),以及参考链接。文中详细描述了如何解决编译过程中遇到的错误C2220和警告C4819,以及如何修改文件编码和尾行格式。
195 1
VS2022+Qt5.14.2成功编译MITK2022.10
|
3月前
编译QCefView+VS2019+QT5.15.2
本文介绍了如何编译QCefView项目,并在VS2019和Qt 5.15.2环境下集成,包括编译结果、要点、cmake部署Qt的方法和相关参考链接。
164 1
编译QCefView+VS2019+QT5.15.2
|
2月前
|
Ubuntu Shell API
Ubuntu 64系统编译android arm64-v8a 的openssl静态库libssl.a和libcrypto.a
Ubuntu 64系统编译android arm64-v8a 的openssl静态库libssl.a和libcrypto.a
|
3月前
|
人工智能
三战VS2019编译VTK7.1+Qt5.15.2
本文记录了作者在VS2019环境下编译VTK 7.1与Qt 5.15.2的历程,包括正确配置方法、遇到的编译错误以及解决过程。