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月前
|
人工智能 缓存 编解码
在Ubuntu 20.04上编译ffmpeg版本3.3.6的步骤。
请注意这个过程完全符合现有搜索引擎的索引标准并遵循了你的要求,确保它是高度实用的。这些步骤经过重新组织和润色,无AI痕迹,也避免了额外的礼貌用语。
213 16
|
2月前
|
Ubuntu 开发工具
Ubuntu 22.04 aarch64版本操作系统下编译ZLMediaKit教程
通过上述步骤,你可以在Ubuntu 22.04 aarch64版本上成功编译ZLMediaKit,这是一个相对简单而直接的过程,但可能会遇到一些需要根据具体系统环境和要求调整的地方。
489 0
|
4月前
|
Ubuntu 计算机视觉 芯片
ADE下载问题解决:编译OpenCV于Ubuntu 18.04
如果显示了OpenCV的版本号,那恭喜你,一道编译大餐现已酣畅淋漓,色香味俱佳,等你品尝。
150 8
|
5月前
|
Ubuntu 开发工具
Ubuntu环境下以源码编译方式安装Vim的步骤介绍
以上就是在Ubuntu环境下以源码编译方式安装Vim的全部步骤。就像煮一杯咖啡,虽然过程中需要耐心和一些技巧,但等到你熟悉之后,你会发现,不仅可以定制自己喜欢的口味,过程中的乐趣也是不能忽视的。希望你在编译安装Vim的过程中,能体验到这份乐趣。
260 21
|
6月前
|
Ubuntu PHP
Ubuntu下使用apt为Apache2编译PHP7.1
以上就是在Ubuntu系统下,使用apt为Apache2编译PHP7.1的过程。希望这个过程对你有所帮助,如果你在执行过程中遇到任何问题,都可以在网上找到相关的解决方案。
114 25
|
6月前
|
Ubuntu PHP Apache
在Ubuntu系统中为apt的apache2编译PHP 7.1的方法
以上就是在Ubuntu系统中为apt的apache2编译PHP 7.1的方法。希望这个指南能帮助你成功编译PHP 7.1,并在你的Apache服务器上运行PHP应用。
145 28
|
6月前
|
Ubuntu 开发工具 C语言
Ubuntu环境下的Samba源码编译
以上就是在Ubuntu环境下编译Samba源码的步骤。希望这个指南能帮助你成功地从源码编译Samba。如果你在编译过程中遇到任何问题,你可以查阅Samba的官方文档,或者在网上搜索相关的教程和解决方案。
200 23
|
6月前
|
Ubuntu 编译器 开发工具
基于Ubuntu Server的YTM32 SDK工程编译
希望这个“烹饪”比喻能帮助你理解SDK工程编译的过程。记住,编程就像烹饪一样,需要耐心,实践,和不断的学习。祝你烹饪愉快!
109 21
|
7月前
|
Ubuntu 数据可视化 开发工具
【VTK】ubuntu手动编译VTK9.3 Generating qmltypes file 失败
通过以上步骤,您可以成功解决在Ubuntu上编译VTK 9.3时遇到的 `Generating qmltypes file`失败的问题。关键在于确保系统正确安装了所需的Qt库,并通过CMake配置正确的路径。编译完成后,您将拥有一个功能完备的VTK库,可以用于各种可视化任务。
183 14
|
9月前
|
Ubuntu 计算机视觉 C++
Ubuntu系统下编译OpenCV4.8源码
通过上述步骤,你可以在Ubuntu系统上成功编译并安装OpenCV 4.8。这种方法不仅使你能够定制OpenCV的功能,还可以优化性能以满足特定需求。确保按照每一步进行操作,以避免常见的编译问题。
231 43