ubuntu 16.04 QT编译c++项目产生的二进制文件执行时出现下面提示: Segmentation Fault (“Core dumped”),
先确认下是否是权限不足造成的,使用root用户运行下编译后的二进制文件!!!
如果不行,再尝试下下面的方法:
分段错误是指您的系统尝试访问不存在的内存页面。核心转储意味着当一部分代码尝试在只读或空闲位置执行读写操作时。段错误通常与名为 core 的文件相关联,它通常发生在升级过程中。
在核心转储期间运行某些命令时,您可能会遇到“无法打开锁定文件”,这是因为系统正在尝试捕获不存在的位块,这是由于某些特定程序的二进制文件崩溃.
您可以通过回溯或调试来解决它,但解决方案是修复损坏的包,我们可以通过执行以下步骤来完成:
Step 1: Remove the lock files present at different locations.
sudo rm -rf /var/lib/apt/lists/lock /var/cache/apt/archives/lock /var/lib/dpkg/lock
Step 2: Remove repository cache.
sudo apt-get clean all
Step 3: Update and upgrade your repository cache.
sudo apt-get update && sudo apt-get upgrade
Step 4: Now upgrade your distribution, it will update your packages.
sudo apt-get dist-upgrade
Step 5: Find the broken packages and delete them forcefully.
sudo dpkg -l | grep ^..r | apt-get purge
我运行完上面的步骤就OK了,希望可以帮到需要的人!