分段错误:vfscanf.c没有这样的文件或目录

时间:2017-04-28 19:00:11

标签: c++ qt segmentation-fault gdb cloud

我将文件上传到远程云服务器,并在从云运行时遇到此错误。该程序在我的电脑上运行时没有错误。

    ./mythread
Segmentation fault
$ gdb ./mythread
GNU gdb (Debian 7.7.1+dfsg-5) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show     copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./mythread...done.
(gdb) run
Starting program: /home/anand/wm/dbug/mythread 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
warning: the debug information found in "/usr/lib/libgl2ps.so.0.0.0" does not match "/usr/lib/libgl2ps.so.0" (CRC mismatch).

warning: the debug information found in "/usr/lib/libxine.so.2.5.0" does not match "/usr/lib/libxine.so.2" (CRC mismatch).

warning: the debug information found in "/usr/lib/libgfortran.so.3.0.0" does not match "/usr/lib/libgfortran.so.3" (CRC mismatch).

warning: the debug information found in "/usr/lib/libspeex.so.1.5.0" does not match "/usr/lib/libspeex.so.1" (CRC mismatch).

warning: the debug information found in "/usr/lib/libopus.so.0.5.0" does not match "/usr/lib/libopus.so.0" (CRC mismatch).

warning: the debug information found in "/usr/lib/libgeos_c.so.1.8.2" does not match "/usr/lib/libgeos_c.so.1" (CRC mismatch).

warning: the debug information found in "/usr/lib/libnetcdf.so.7.1.1" does not match "/usr/lib/libnetcdf.so.7" (CRC mismatch).

warning: the debug information found in "/usr/lib/libogg.so.0.8.2" does not match "/usr/lib/libogg.so.0" (CRC mismatch).

warning: the debug information found in "/usr/lib/libarpack.so.2.0.0" does not match "/usr/lib/libarpack.so.2" (CRC mismatch).


Program received signal SIGSEGV, Segmentation fault.
0x00007fffe3dc2110 in _IO_vfscanf_internal (s=s@entry=0x7fffffffe9a0, format=format@entry=0x7fffe5ddc3d0 "%d%n", 
argptr=argptr@entry=0x7fffffffeac8, errp=errp@entry=0x0) at vfscanf.c:340
340 vfscanf.c: No such file or directory.

然后我想到运行其他更简单的程序来检查这是否特定于我的二进制文件并仍然得到相同的错误。

测试程序稍后运行:

    int main() {

    int i = 0;
    while(i<10)
    {
        i =i+1;
        std::cout << i << "\n";
    }
    return 0;
}

编辑:我使用QT版本5.3.2构建它,并使用gdb运行。

2 个答案:

答案 0 :(得分:1)

您正在使用在其他版本的O.S。

中编译的二进制文件

检查PC的操作系统版本和远程机器的操作系统版本。 使用相同的操作系统来编译程序。

这也可以解决远程机器中的代码编译问题。

您可以使用命令行检查:

lsb_release -a

答案 1 :(得分:1)

将gcc和gdb升级到两台计算机上的最新版本。同时升级到Debian 8.8。但问题没有解决。

因此,接下来在远程主机上安装与在Linux PC上相同的QT版本5.3.2。瞧!问题解决了。

唯一阻止在远程无头机器上安装QT 5.3.2的错误是:Could not connect to X Server

所以,SSH使用-X参数并且安装发生了。 :)

如果没有@Rama的帮助,这是不可能的!