0

我使用 Buildroot 构建了一个小型 linux。我已经包含了用于嵌入式的 QT 和对帧缓冲设备的支持,但是我无法从中运行 Qt 示例。我想在没有 X 服务器的情况下运行 GUI。

运行/usr/share/qt/examples/qws/framebuffer/framebuffer -qws时出现以下错误:

Error: cannot open framebuffer device: No such file or directory.

的输出ls /dev/fb*是:

/dev/fb0 /dev/fb1 /dev/fb2 /dev/fb3

strace 输出:

execve("./framebuffer", ["./framebuffer", "-qws"], [/* 16 vars */]) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_UNINITIALIZED, -1, 0) = 0xb7701000
open("/lib/libstdc++.so.6", O_RDONLY)   = -1 ENOENT (No such file or directory)
open("/lib/libstdc++.so.6", O_RDONLY)   = -1 ENOENT (No such file or directory)
open("/usr/lib/libstdc++.so.6", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0755, st_size=751308, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_UNINITIALIZED, -1, 0) = 0xb7700000
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0004o\4\0004\0\0\0"..., 4096) = 4096
mmap2(NULL, 778240, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7642000
mmap2(0xb7642000, 729051, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0xb7642000
mmap2(0xb76f4000, 20864, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0xb2000) = 0xb76f4000
mmap2(0xb76fa000, 22428, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb76fa000
close(3)                                = 0
munmap(0xb7700000, 4096)                = 0
open("/lib/libm.so.0", O_RDONLY)        = 3
fstat(3, {st_mode=S_IFREG|0755, st_size=45864, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_UNINITIALIZED, -1, 0) = 0xb7700000
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0 \33\0\0004\0\0\0"..., 4096) = 4096
mmap2(NULL, 53248, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7635000
mmap2(0xb7635000, 43784, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0xb7635000
mmap2(0xb7640000, 4100, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0xa000) = 0xb7640000
close(3)                                = 0
munmap(0xb7700000, 4096)                = 0
open("/lib/libgcc_s.so.1", O_RDONLY)    = 3
fstat(3, {st_mode=S_IFREG|0755, st_size=86600, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_UNINITIALIZED, -1, 0) = 0xb7700000
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0t\36\0\0004\0\0\0"..., 4096) = 4096
mmap2(NULL, 90112, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb761f000
mmap2(0xb761f000, 85004, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0xb761f000
mmap2(0xb7634000, 3536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x14000) = 0xb7634000
close(3)                                = 0
munmap(0xb7700000, 4096)                = 0
open("/lib/libc.so.0", O_RDONLY)        = 3
fstat(3, {st_mode=S_IFREG|0755, st_size=392428, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_UNINITIALIZED, -1, 0) = 0xb7700000
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\0\256\0\0004\0\0\0"..., 4096) = 4096
mmap2(NULL, 413696, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb75ba000
mmap2(0xb75ba000, 385628, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0xb75ba000
mmap2(0xb7619000, 4868, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x5e000) = 0xb7619000
mmap2(0xb761b000, 15928, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb761b000
close(3)                                = 0
munmap(0xb7700000, 4096)                = 0
open("/lib/libm.so.0", O_RDONLY)        = 3
fstat(3, {st_mode=S_IFREG|0755, st_size=45864, ...}) = 0
close(3)                                = 0
open("/lib/libc.so.0", O_RDONLY)        = 3
fstat(3, {st_mode=S_IFREG|0755, st_size=392428, ...}) = 0
close(3)                                = 0
stat("/lib/ld-uClibc.so.0", {st_mode=S_IFREG|0755, st_size=25296, ...}) = 0
open("/lib/libgcc_s.so.1", O_RDONLY)    = 3
fstat(3, {st_mode=S_IFREG|0755, st_size=86600, ...}) = 0
close(3)                                = 0
open("/lib/libc.so.0", O_RDONLY)        = 3
fstat(3, {st_mode=S_IFREG|0755, st_size=392428, ...}) = 0
close(3)                                = 0
open("/lib/libc.so.0", O_RDONLY)        = 3
fstat(3, {st_mode=S_IFREG|0755, st_size=392428, ...}) = 0
close(3)                                = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_UNINITIALIZED, -1, 0) = 0xb7700000
set_thread_area({entry_number:-1 -> 6, base_addr:0xb77006b0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
mprotect(0xb76f4000, 16384, PROT_READ)  = 0
mprotect(0xb7640000, 4096, PROT_READ)   = 0
mprotect(0xb7619000, 4096, PROT_READ)   = 0
mprotect(0xb7708000, 4096, PROT_READ)   = 0
ioctl(0, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(1, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
brk(0)                                  = 0x9093000
brk(0x9094000)                          = 0x9094000
open("-qws", O_RDWR)                    = -1 ENOENT (No such file or directory)
write(2, "Error: cannot open framebuffer d"..., 37Error: cannot open framebuffer device) = 37
write(2, ": ", 2: )                       = 2
write(2, "No such file or directory", 25No such file or directory) = 25
write(2, "\n", 1
)                       = 1
exit_group(1)                           = ?
+++ exited with 1 +++

(不知道这是什么意思)

如果我运行计算器示例:

usr/share/qt/examples/widgets/calculator -qws

QLock::QLock: Cannot create semaphore /tmp/qtembedded-0/QtEmbedded-0 'd' (38, Function not implemented)
Cannot get display lock
Aborted
4

3 回答 3

2

看来我没有 在内核中包含System V IPC选项。我在这里找到了答案。

于 2013-11-12T13:27:46.220 回答
1

感谢 strace 的输出,我发现了问题:您错误地在 - 和 qws 之间放置了一个空格:

 - qws

应该

 -qws
于 2013-11-12T08:01:39.180 回答
1

strace 显示程序试图打开“-qws”帧缓冲设备,这显然是无效的:

open("-qws", O_RDWR)                    = -1 ENOENT (No such file or directory)
write(2, "Error: cannot open framebuffer d"..., 37Error: cannot open framebuffer device) = 37

你为什么要这样运行程序?你试过不带参数运行吗?简要查看源代码表明它应该像那样工作。该程序中的默认帧缓冲区是 /dev/fb0。

于 2013-11-12T10:20:17.677 回答