“Terminate Server”; . setqt4env; ./helloQT4 -qws;

本文记录了在FriendlyARM设备上运行Qt4程序遇到的问题及解决办法。主要问题包括程序启动失败、触摸屏无响应等,并提供了通过设置环境变量来解决问题的具体步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

[root@FriendlyARM /sdcard]# ./helloQT4


QWSDisplay::Data::init: Invalid argument


Client can't attach to main ram memory.


Aborted


{退出Qtopia2.2.0 或者Qt4程序等一切Qt程序,退出Qtopia2.2.0的方法是:在Qtopia2.2.0中点“设置”中的“关机”可出现如下界面,点“Terminate Server”即可关闭Qtopia-2.2.0系统。}


[root@FriendlyARM /sdcard]# ./helloQT4


QWSSocket::connectToLocalFile could not connect:: No such file or directory


QWSSocket::connectToLocalFile could not connect:: No such file or directory


QWSSocket::connectToLocalFile could not connect:: No such file or directory


QWSSocket::connectToLocalFile could not connect:: No such file or directory


QWSSocket::connectToLocalFile could not connect:: No such file or directory


QWSSocket::connectToLocalFile could not connect:: No such file or directory


No Qt for Embedded Linux server appears to be running.


If you want to run this program as a server,


add the "-qws" command-line option.


[root@FriendlyARM /sdcard]#


[root@FriendlyARM /sdcard]#

[root@FriendlyARM /sdcard]# ./helloQT4 -qws

{可以显示界面,但是触摸屏没有反应}

[root@FriendlyARM /sdcard]# ls


BOOTEX.LOG      LOST.DIR        helloQT4        setqt4env


Bak             dream_true.mp3  images          your.mp3


DCIM            hello           qt4.7.tgz       ????


[root@FriendlyARM /sdcard]#


[root@FriendlyARM /sdcard]# . setqt4env


[root@FriendlyARM /sdcard]#


[root@FriendlyARM /sdcard]# ./helloQT4 -qws


{执行完. setqt4env后,再运行./helloQT4 -qws,触摸屏才有反应}

{

#!/bin/sh
if [ -e /etc/friendlyarm-ts-input.conf ] ; then
. /etc/friendlyarm-ts-input.conf
fi
true ${TSLIB_TSDEVICE:=/dev/touchscreen}
TSLIB_CONFFILE=/etc/ts.conf
export TSLIB_TSDEVICE
export TSLIB_CONFFILE
export TSLIB_PLUGINDIR=/usr/lib/ts
export TSLIB_CALIBFILE=/etc/pointercal
export QWS_DISPLAY=:1
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
export PATH=/bin:/sbin:/usr/bin/:/usr/sbin:/usr/local/bin
if [ -c /dev/touchscreen ]; then
export QWS_MOUSE_PROTO="Tslib MouseMan:/dev/input/mice"
if [ ! -s /etc/pointercal ] ; then
rm /etc/pointercal
/usr/bin/ts_calibrate
fi
else
export QWS_MOUSE_PROTO="MouseMan:/dev/input/mice"
fi
export QWS_KEYBOARD=TTY:/dev/tty1
export HOME=/root

}


error: Installed (but unpackaged) file(s) found: /usr/bin/scp /usr/bin/sftp /usr/bin/ssh-add /usr/bin/ssh-agent /usr/bin/ssh-keygen /usr/bin/ssh-keyscan /usr/libexec/sftp-server /usr/libexec/ssh-keysign /usr/libexec/ssh-pkcs11-helper /usr/libexec/ssh-sk-helper /usr/libexec/sshd-auth /usr/libexec/sshd-session /usr/share/man/man1/scp.1.gz /usr/share/man/man1/sftp.1.gz /usr/share/man/man1/ssh-add.1.gz /usr/share/man/man1/ssh-agent.1.gz /usr/share/man/man1/ssh-keygen.1.gz /usr/share/man/man1/ssh-keyscan.1.gz /usr/share/man/man1/ssh.1.gz /usr/share/man/man5/moduli.5.gz /usr/share/man/man5/ssh_config.5.gz /usr/share/man/man5/sshd_config.5.gz /usr/share/man/man8/sftp-server.8.gz /usr/share/man/man8/ssh-keysign.8.gz /usr/share/man/man8/ssh-pkcs11-helper.8.gz /usr/share/man/man8/ssh-sk-helper.8.gz /usr/share/man/man8/sshd.8.gz RPM build errors: Installed (but unpackaged) file(s) found: /usr/bin/scp /usr/bin/sftp /usr/bin/ssh-add /usr/bin/ssh-agent /usr/bin/ssh-keygen /usr/bin/ssh-keyscan /usr/libexec/sftp-server /usr/libexec/ssh-keysign /usr/libexec/ssh-pkcs11-helper /usr/libexec/ssh-sk-helper /usr/libexec/sshd-auth /usr/libexec/sshd-session /usr/share/man/man1/scp.1.gz /usr/share/man/man1/sftp.1.gz /usr/share/man/man1/ssh-add.1.gz /usr/share/man/man1/ssh-agent.1.gz /usr/share/man/man1/ssh-keygen.1.gz /usr/share/man/man1/ssh-keyscan.1.gz /usr/share/man/man1/ssh.1.gz /usr/share/man/man5/moduli.5.gz /usr/share/man/man5/ssh_config.5.gz /usr/share/man/man5/sshd_config.5.gz /usr/share/man/man8/sftp-server.8.gz /usr/share/man/man8/ssh-keysign.8.gz /usr/share/man/man8/ssh-pkcs11-helper.8.gz /usr/share/man/man8/ssh-sk-helper.8.gz /usr/share/man/man8/sshd.8.gz
最新发布
07-09
<think>我们正在解决RPM构建过程中出现的未打包文件错误,具体错误信息是: error: Installed (but unpackaged) file(s) found: /usr/libexec/openssh/ssh-sk-helper /usr/share/man/man8/ssh-sk-helper.8.gz 根据引用[1]中出现的错误信息,以及引用[2][3]中提到的类似错误(Checking for unpackaged file(s)),我们可以知道在构建RPM包时,有一些文件被安装到了构建根目录(buildroot)中,但是在spec文件的%files部分没有被列出,因此RPM构建过程会报错。 解决方案的核心是确保所有安装的文件都在spec文件的%files部分有对应的条目。 具体步骤: 1. **确定未打包的文件列表** 错误信息已经明确列出了未打包的文件: - /usr/libexec/openssh/ssh-sk-helper - /usr/share/man/man8/ssh-sk-helper.8.gz 2. **检查spec文件中的%files部分** 打开你的spec文件(例如openssh.spec),查看%files部分是否包含了这些文件。如果未包含,则需要添加。 3. **添加缺失的文件到%files部分** 在%files部分添加这些文件。注意,由于这些文件是手册页,通常手册页会使用通配符来包含,所以也可能是因为通配符没有覆盖到这些文件。 例如,在%files部分,你可能已经有一行来包含手册页: ``` %{_mandir}/man8/* ``` 但是,请注意,上述通配符可能不会包含在构建过程中新生成的手册页(例如ssh-sk-helper.8.gz),因为它在构建时可能还没有被生成,或者路径不对。 另外,对于`/usr/libexec/openssh/ssh-sk-helper`,这个文件应该被包含在程序文件中。通常,openssh的spec文件会有一个部分来包含`/usr/libexec/openssh/`下的文件。例如: ``` %{_libexecdir}/openssh/ssh-sk-helper ``` 4. **使用通配符的注意事项** 如果使用通配符,确保它能匹配到这些文件。例如,对于手册页,可以这样写: ``` %{_mandir}/man8/* ``` 对于`/usr/libexec/openssh/`目录下的文件,可以这样写: ``` %{_libexecdir}/openssh/* ``` 但是,使用通配符可能会包含多余的文件,所以最好在构建之前清理构建根目录,避免之前构建遗留的文件导致问题。 5. **重新构建并测试** 修改spec文件后,重新构建RPM包: ``` rpmbuild -ba openssh.spec ``` 观察是否还有未打包文件的错误。 6. **如果文件不应该被打包** 如果这些文件不应该包含在RPM包中(例如,它们是其他包的文件,或者是不需要的测试文件),那么需要在构建过程中删除它们。可以在%install阶段删除这些文件: ``` rm -f %{buildroot}/usr/libexec/openssh/ssh-sk-helper rm -f %{buildroot}%{_mandir}/man8/ssh-sk-helper.8.gz ``` 7. **使用自动生成文件列表的工具** 在spec文件的%install阶段,可以使用一个脚本记录安装的所有文件,然后在%files阶段使用这个列表。但是这种方法需要谨慎,因为可能会包含不需要的文件(例如临时文件)。 例如,在%install阶段开始记录: ``` find %{buildroot} -type f > %{buildroot}/.filelist ``` 然后在%files阶段使用: ``` %files -f %{buildroot}/.filelist ``` 但这种方法并不推荐,因为它会包含所有文件,包括那些应该由其他包提供的文件(如共享库)或不需要的文件。 8. **检查构建过程** 如果问题仍然存在,检查构建过程,确保在%install阶段没有安装额外的文件。可以查看构建日志,看这些文件是在哪个步骤安装的。 9. **参考已有解决方案** 根据引用[1]中,用户尝试下载x11-ssh-askpass的源码包,这可能是为了解决另一个问题(图形化SSH密码询问)。但是,当前错误与ssh-sk-helper相关,所以不需要处理这个包。 10. **其他可能的原因** 如果这些文件是由某个子包安装的(例如openssh-server或openssh-clients),那么可能需要在相应的子包spec文件的%files部分添加这些文件。 总结:主要方法是在spec文件的%files部分添加缺失的文件路径,或者使用通配符覆盖它们。如果这些文件不应该被打包,则在%install阶段删除它们。 下面是一个修改spec文件的示例片段(%files部分): 假设我们有一个子包叫做`openssh-server`,我们可以在该子包的%files部分添加: ``` %files ... (其他文件) %{_libexecdir}/openssh/ssh-sk-helper %{_mandir}/man8/ssh-sk-helper.8.gz ``` 或者,如果已经存在通配符,但依然没有包含,可能是因为通配符的路径不正确,或者文件在构建过程中没有被正确安装。需要检查%install阶段的安装步骤。 注意:在添加文件时,要确保文件路径是以构建根目录(%{buildroot})为基准的相对路径(在%files部分不需要写%{buildroot})。 重新构建RPM包,错误应该会消失。 相关问题: 1. 如何解决RPM构建中出现的未打包文件错误? 2. RPM spec文件中%files部分如何正确包含所有安装的文件? 3. 如何避免RPM构建过程中包含不需要的文件?</think>### 解决 RPM 构建中未打包文件错误的方法 当 RPM 构建过程中出现 `error: Installed (but unpackaged) file(s) found` 错误时,表明有文件被安装到构建根目录中,但未在 spec 文件的 `%files` 部分声明。以下是针对 SSH 相关文件(如 `/usr/bin/scp`, `/usr/bin/sftp`)的完整解决方案: #### 1. **定位未打包文件** ```bash # 检查构建日志获取完整文件列表 grep "Installed (but unpackaged)" ~/rpmbuild/BUILD/openssh-*/build.log # 示例输出: # /usr/libexec/openssh/ssh-sk-helper # /usr/share/man/man8/ssh-sk-helper.8.gz # /usr/bin/scp # /usr/bin/sftp ``` #### 2. **修改 spec 文件** 在 spec 文件的 `%files` 部分添加缺失文件(以 OpenSSH 为例): ```spec %files %{_bindir}/scp # 添加 scp %{_bindir}/sftp # 添加 sftp %{_libexecdir}/openssh/ssh-sk-helper %{_mandir}/man8/ssh-sk-helper.8.gz ``` #### 3. **使用通配符简化声明** 对于批量文件,可使用通配符: ```spec %files %{_bindir}/* # 包含 /usr/bin 下所有文件 %{_libexecdir}/openssh/* # 包含 openssh 所有辅助程序 %{_mandir}/man8/* # 包含所有 man8 手册页 ``` #### 4. **自动生成文件列表** 在 `%install` 阶段后添加自动扫描: ```spec %install make install DESTDIR=%{buildroot} # 扫描新安装的文件 find %{buildroot} -type f | sed "s|^%{buildroot}||" > INSTALLED_FILES ``` 在 `%files` 部分引用: ```spec %files -f INSTALLED_FILES ``` #### 5. **验证修复结果** ```bash # 重新构建 RPM rpmbuild -ba ~/rpmbuild/SPECS/openssh.spec # 检查新包内容 rpm -qlp ~/rpmbuild/RPMS/x86_64/openssh-*.rpm | grep -E 'scp|sftp|ssh-sk-helper' # 应显示添加的文件 ``` #### 常见原因与解决方案 | 错误原因 | 解决方案 | |---------|----------| | 新版本添加文件未更新 spec | 更新 `%files` 部分 | | `make install` 安装额外文件 | 在 `%install` 阶段删除多余文件 | | 子包文件归属错误 | 将文件移到正确的子包 `%files` 部分 | | 通配符路径不匹配 | 使用 RPM 宏如 `%{_bindir}` 替代硬编码路径 | #### 预防措施 1. **构建前清理**: ```bash rm -rf ~/rpmbuild/BUILDROOT/* ``` 2. **使用严格构建模式**: ```spec %define _unpackaged_files_terminate_build 1 ``` 3. **自动化验证**: ```bash # 在 spec 文件中添加检查脚本 %check ! grep "Installed (but unpackaged)" build.log ``` > **关键提示**:当添加新功能或更新版本时,RPM 构建的 `%files` 部分必须同步更新。参考上游 spec 文件可避免遗漏[^1]。 ---
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值