You are not logged in.
I can't use my g++ or gcc;
when i run any program(including "hello world"), it returns with Segmentation fault
i tried -std=c++11,14,17,20,98 -O2 -O3 or -static -lm but none of these work
here's my output of gcc -v:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --enable-languages=ada,c,c++,d,fortran,go,lto,m2,objc,obj-c++,rust --enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://gitlab.archlinux.org/archlinux/packaging/packages/gcc/-/issues --with-build-config=bootstrap-lto --with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit --enable-cet=auto --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-libstdcxx-backtrace --enable-link-serialization=1 --enable-linker-build-id --enable-lto --enable-multilib --enable-plugin --enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch --disable-werror
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.1.1 20240720 (GCC)
here's the output of uname -a:
Linux archlinux 6.10.2-arch1-1 #1 SMP PREEMPT_DYNAMIC Sat, 27 Jul 2024 16:49:55 +0000 x86_64 GNU/Linux
i've tried to reinstall gcc or install gcc13, but it doesn't work
here's the output of gcc-13 -v:
Using built-in specs.
COLLECT_GCC=gcc-13
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/13.3.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc13/src/gcc/configure --enable-languages=c,c++,fortran --enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://gitlab.archlinux.org/archlinux/packaging/packages/gcc13/-/issues --with-build-config=bootstrap-lto --with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit --enable-cet=auto --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-libstdcxx-backtrace --enable-link-serialization=1 --enable-linker-build-id --enable-lto --disable-multilib --enable-plugin --enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch --disable-werror --program-suffix=-13 --enable-version-specific-runtime-libs
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.3.0 (GCC)
i've tried to install gcc9 with yay, but it makes for hours and leaves an error
i even tried to install mingw,but it returns with exe
what should i do?
Last edited by hanyixuanten (2024-08-03 07:01:27)
Offline
when i run any program(including "hello world"), it returns with Segmentation fault
Why not post your coredump.
https://wiki.archlinux.org/title/Core_dump
Offline
gcc is not for running programs, it's for compiling. Post the full input and output of the commands you are running.
Offline
Yes, I mean compile.
this is the comand: g++ -o tmp tmp.cpp
this is tmp.cpp:
#include<bits/stdc++.h>
using namespace std;
int main(){
return 0;
}
and i run `./tmp` and it returns with Segmentation fault
Last edited by hanyixuanten (2024-08-03 06:31:48)
Offline
when i run any program(including "hello world"), it returns with Segmentation fault
Why not post your coredump.
https://wiki.archlinux.org/title/Core_dump
i'll try
Offline
this is the output of gdb:
Temporary breakpoint 1 at 0x111d: file tmp.cpp, line 4.
Starting program: /(my_working_dir)/tmp
During startup program terminated with signal SIGSEGV, Segmentation fault.
Last edited by hanyixuanten (2024-08-03 06:31:28)
Offline
I tried to make gcc9, and it returns with:
make: Entering directory '/home/hanyixuanten/.cache/yay/gcc9/src/gcc-build'
make: *** /libstdc++-v3/doc: No such file or directory. Stop.
make: Leaving directory '/home/hanyixuanten/.cache/yay/gcc9/src/gcc-build'
==> ERROR: A failure occurred in build().
Aborting...
-> error making: gcc9-exit status 4
-> Failed to install the following packages. Manual intervention is required:
gcc9 - exit status 4
gcc9-libs - exit status 4
Last edited by hanyixuanten (2024-08-03 06:31:06)
Offline
Please don't bump, edit your previous post if nobody has replied.
Then please use [code][/code] tags. Edit your post in this regard.
On topic: you get the backtrace from gdb w/ "bt"
gdb ./tmp 2>&1 | tee tmp.backtrace
run
bt
detach
quit
cat tmp.backtrace | curl -F 'file=@-' 0x0.st
I suppose including bits/stdc++.h is critical to hit the segfault?
Offline
ok,here's the result:
GNU gdb (GDB) 15.1
Copyright (C) 2024 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-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://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 ./tmp...
[?2004h(gdb) run
[?2004l
Starting program: /run/media/hanyixuanten/data/ten/DEV/文档/编程/c++/date/2024/7/信友队/^笔记/tmp
During startup program terminated with signal SIGSEGV, Segmentation fault.
[?2004h(gdb) bt
[?2004l
No stack.
[?2004h(gdb) detach
[?2004l
The program is not being run.
[?2004h(gdb) quit
[?2004l
Offline
ldd ./tmp
pacman -Qikk gcc-libs glibc
strace -o /tmp/tmp.strace ./tmp
cat /tmp/tmp.strace | curl -F 'file=@-' 0x0.st
I suppose including bits/stdc++.h is critical to hit the segfault?
Offline
ldd ./tmp pacman -Qikk gcc-libs glibc strace -o /tmp/tmp.strace ./tmp cat /tmp/tmp.strace | curl -F 'file=@-' 0x0.st
seth wrote:I suppose including bits/stdc++.h is critical to hit the segfault?
output:
execve("./tmp", ["./tmp"], 0x7ffedf3ace20 /* 67 vars */) = -1 EOPNOTSUPP (Operation not supported)
+++ killed by SIGSEGV +++
i think it's not an issue with libs because i tried a code with only main and return 0; but the errors are the same
Offline
What kind of filesystem is
/run/media/hanyixuanten/data/ten/DEV/文档/编程/c++/date/2024/7/信友队/^笔记/tmp
?
Test the code in /tmp
Offline
What kind of filesystem is
/run/media/hanyixuanten/data/ten/DEV/文档/编程/c++/date/2024/7/信友队/^笔记/tmp
?
Test the code in /tmp
It works!
/run/media/hanyixuanten/data is a NTFS disk which was used in Windows. Is this the problem?
Offline
EOPNOTSUPP is b/o of missing O_TMPFILE (most likely) which is specifc to the filesystem, driver and mount options
Edit: Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.
Last edited by seth (2024-08-03 06:57:08)
Offline