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


相关文章
|
4月前
|
Web App开发 存储 Linux
Linux(33)Rockchip RK3568 Ubuntu22.04上通过SSH运行Qt程序和关闭Chrome的密钥提示
Linux(33)Rockchip RK3568 Ubuntu22.04上通过SSH运行Qt程序和关闭Chrome的密钥提示
344 0
|
20天前
|
Ubuntu 编译器 C语言
Ubuntu 源码编译指定版本 make:神秘代码背后的激情冒险,等你来战!
【9月更文挑战第8天】在Ubuntu中,编译指定版本的源码`make`是一项挑战但也极具价值的任务。它允许我们根据特定需求定制软件,提升性能与功能适配。首先需安装必要工具包如GCC等;接着下载所需源码并阅读相关文档以了解编译要求。通过运行`./configure`、`make`及`sudo make install`命令完成编译安装流程。过程中可能遇到依赖项缺失或编译选项设置不当等问题,需根据错误提示逐一解决。对于大型项目,可利用多核编译加快速度。掌握这一技能有助于更好地探索开源世界。
25 2
|
1月前
|
Ubuntu Linux
ubuntu源码编译指定版本make
以上内容涵盖了在Ubuntu中编译安装指定版本软件的全过程,这是一个技术性很强的操作,不仅可以带来定制化的安装体验,同时也能增加对系统管理和软件构建流程的理解。遵循以上步骤,任何有一定基础的用户都能够按需编译和安装软件。
41 8
|
1月前
|
Ubuntu Linux Windows
如何在WSL中的ubuntu编译Linux内核并且安装使用ebpf?
请注意,在WSL1中可能会由于内核架构限制而无法成功进行以上过程,WSL2对于Linux内核的完整支持更为合适。此外,部分步骤可能因不同的Linux发行版或内核版本而异。
66 4
|
1月前
|
Ubuntu 编译器 C语言
Ubuntu 源码编译指定版本 make:神秘代码背后的激情冒险,等你来战!
【8月更文挑战第19天】在Ubuntu中编译指定版本的`make`工具是一项高级技巧,能让你针对特定需求定制软件。首先确保已安装`build-essential`等必要组件。下载所需版本源码后,遵循README指南配置与编译。使用`./configure`检测环境,`make`编译,最后`sudo make install`安装。面对问题如缺失依赖或编译选项不当,需耐心解决。对于大型项目,可利用多核加速编译,如`make -j 4`。这一过程虽具挑战,却能显著提升软件性能与功能适配。
28 2
|
27天前
|
Ubuntu
编译ubuntu内核
编译ubuntu内核
|
1月前
|
Ubuntu 开发工具 Android开发
Repo下载、编译AOSP源码:基于Ubuntu 21.04,android-12.1.0_r27
文章记录了作者在Ubuntu 21.04服务器上配置环境、下载并编译基于Android 12.1.0_r27版本的AOSP源码的过程,包括解决编译过程中遇到的问题和错误处理方法。
44 0
|
1月前
|
Ubuntu
Ubuntu22.04,AOSP编译报错: libncurses.so.5: cannot open shared object file: No such file
本文描述了在Ubuntu 22.04系统上编译AOSP时遇到的`libncurses.so.5`缺失错误,并提供了通过安装相应库解决该问题的步骤。
142 0
|
2月前
|
Ubuntu JavaScript 开发工具
Ubuntu上编译多个版本的frida
【7月更文挑战第16天】在Ubuntu上编译多个版本的Frida(如15.1.28和16.1.4),首先确保系统为Ubuntu 20(WSL)或其他版本,并安装`build-essential`, `git`, `lib32stdc++-9-dev`, `libc6-dev-i386`等依赖。还需安装Node.js(例如20.15.1版)。通过`git clone`获取Frida源码,并根据所需版本进入对应分支。设置环境变量以指向正确的NDK和Node.js路径,可通过脚本如`env15.sh`来避免污染全局环境。
|
2月前
|
Ubuntu 编译器 计算机视觉
Ubuntu系统下编译OpenCV4.8源码
在Ubuntu上源码安装OpenCV 4.8分为三步:1) 下载源码包,使用`wget`命令;2) 安装依赖,如`g++`, `cmake`, `make`等;3) 创建编译目录,运行`cmake`配置,接着`make`编译,最后`sudo make install`安装。安装完成后,通过编写和运行一个简单的OpenCV C++程序来验证环境配置正确性。
92 10