Why does it complain Missing separate debuginfos about my c++ with gdb? - c++

My OS: CentOS Linux release 7.9.2009 (Core)
I am debugging a c++ program with:
gdb demo_test
But I got an error:
Breakpoint 1, Log (level=2, msg=0x7ffff79df035 "[%s]:default model:%s") at ./api/test/test.cpp:16
16 va_start(ap, msg);
Missing separate debuginfos, use: debuginfo-install glibc-2.17-324.el7_9.x86_64 libgcc-4.8.5-44.el7.x86_64 libstdc++-4.8.5-44.el7.x86_64
Then I did:
yum install yum-utils
Loaded plugins: langpacks, product-id, search-disabled-repos
Package yum-utils-1.1.31-54.el7_8.noarch already installed and latest version
Nothing to do
Then I did:
# debuginfo-install glibc
Loaded plugins: langpacks, product-id
Could not find debuginfo for main pkg: glibc-2.17-324.el7_9.x86_64
Could not find debuginfo pkg for dependency package nss-softokn-freebl-3.53.1-6.el7_9.x86_64
No debuginfo packages available to install
This doesn't fix the issue. I also tried to remove the -02 flag from the g++:
g++ -g -Wall -O2 ./api/test/test.cpp ./${NAME}.so -o demo_test $(CINCLUDE) $(CLIB)
But it doesn't help either. How can I possibly fix the issue? Really thanks in advance.

Related

Update g++ but still old version

I installed g++ using those commands line:
sudo add-apt-repository ppa:jonathonf/gcc-7.1
sudo apt-get update
Then
sudo apt-get install gcc-7 g++-7
When it was done I tried g++ -v but still shows me the old version
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)
Am I not upgrading it correctly?
Edit
:~$ dpkg -L g++-7
/.
/usr
/usr/lib
/usr/lib/gcc
/usr/lib/gcc/x86_64-linux-gnu
/usr/lib/gcc/x86_64-linux-gnu/7
/usr/lib/gcc/x86_64-linux-gnu/7/cc1plus
/usr/share
/usr/share/doc
/usr/share/doc/gcc-7-base
/usr/share/doc/gcc-7-base/C++
/usr/share/doc/gcc-7-base/C++/README.C++
/usr/share/doc/gcc-7-base/C++/changelog.gz
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/x86_64-linux-gnu-g++-7.1.gz
/usr/bin
/usr/bin/x86_64-linux-gnu-g++-7
/usr/share/doc/g++-7
/usr/share/man/man1/g++-7.1.gz
/usr/bin/g++-7
:~$ which g++
/usr/bin/g++
Installing a newer (or older) version of GCC than the Ubuntu default version via the package manager
does not delete the default version. You get both. You can install as many
versions as you like. gcc/g++ will continue
to run the default version. If you have installed GCC 7, then you run
the new compilers with gcc-7 or g++-7. For most build systems, it is sufficient to set the environment variables CC=gcc-7 CXX=g++-7 before starting the build.
I installed the gcc-7 using the directions given in Ubuntu Forum, rebooted the system (to make sure all environment variables are loaded) and to compile with C++ 17, type the following on the shell :
g++-7 -std=c++17 program_name.cpp -o program.out
Hope this helps.

g++: internal compiler error: Segmentation fault (program cc1plus) - where do I start?

I am porting code that compiled on Ubuntu 14.04 to 16.04. I have cloned my git repo, installed dependencies and tried the usual make command, soon I hit a g++: internal compiler error: Segmentation fault (program cc1plus) ... yet I am not sure where to start to diagnose and resolve this issue.
I will share as much as I can, see if someone can guide me through a resolution.
Ubuntu
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.2 LTS
Release: 16.04
Codename: xenial
g++
$ g++ --version
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
python
$ python --version
Python 2.7.12
Some environment variables
PYTHON /usr/bin/python2.7
ARCH x86_64
OS Linux
VERSION 4.4.071generic
PLATFORM linux2
HOSTNAME deploy
USER myUser
WUSS_BUILD NO
CCVER gcc
PYLIBDIR build.x86_64-linux2
LIBDIR build.x86_64-linux2
BINDIR build.x86_64-linux2
ODIR build.x86_64-linux2-gcc
STATICLIBDIR build-static.x86_64-linux2
Error
The make command leads to
+++ Compile mycore/boost_json.cc to build.x86_64-linux2-gcc
g++: internal compiler error: Segmentation fault (program cc1plus) <===
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-5/README.Bugs> for instructions.
mk/makelib2.inc:48: recipe for target 'build.x86_64-linux2-gcc/mycore/boost_json.o' failed
make[1]: *** [build.x86_64-linux2-gcc/mycore/boost_json.o] Error 4
Makefile:152: recipe for target 'make.stage1c' failed
make: *** [make.stage1c] Error 2
The error message seems to be pointing at a g++ compiler error (?)
makelib2.inc:48
$(ODIR)/%.o : %.c
#mkdir -p $(dir $#)
#echo "+++ Compile $< to $(ODIR)"
#$(CC) -MMD -MP -MF $(#:.o=.d) -c -I$(ODIR) $(CFLAGS) $(CFLAGS_$*) -o $# $<
I realize that this is going to be very difficult to craft a proper question that would lead to getting proper help. So please bear with me and feel free to suggest adding anything that may help. Unfortunately, I can't share the code.
Update
Going to try upgrade g++ to a more recent version. Following this thread
HERE how to install g++ 7 on Ubuntu
HERE how to install gcc 6 on Ubuntu
How I resolved my g++ segmentation fault issue
Inspired by this thread
I executed the following on my Ubuntu 16.04
sudo apt-get install build-essential software-properties-common -y
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt-get update
sudo apt-get install gcc-snapshot -y
After what g++ was incremented from 5.4.0 to 5.4.1 which resolve the segmentation fault issue
$ g++ --version
g++ (Ubuntu 5.4.1-2ubuntu1~16.04) 5.4.1 20160904
Simply do as you were instructed:
Please submit a full bug report, with preprocessed source if appropriate.
If you can't solve your problem using above methods, you can have a try to check if you are running out of disk space using below command. This is the workaround of my problem.
df -h
sudo du -h --max-depth=1

Installing gevent on Mavericks (Enthought Canopy python)

Has anyone had any luck building gevent 1.0 in Mavericks?
I've tried the following:
pip (as recommended on the gevent package index)
easy_install
compiling from source
I keep getting the same error when building 'gevent.core':
...
building 'gevent.core' extension
creating build/temp.macosx-10.6-i386-2.7/gevent
Compiling with an SDK that doesn't seem to exist: /Developer/SDKs/MacOSX10.6.sdk
Please check your Xcode installation
gcc -DNDEBUG -g -O3 -arch i386 -isysroot /Developer/SDKs/MacOSX10.6.sdk -U__llvm__ -
DLIBEV_EMBED=1 -DEV_COMMON= -DEV_CHECK_ENABLE=0 -DEV_CLEANUP_ENABLE=0 -DEV_EMBED_ENABLE=0
-DEV_PERIODIC_ENABLE=0 -Ibuild/temp.macosx-10.6-i386-2.7/libev -Ilibev -
I/Applications/Canopy.app/appdata/canopy-1.2.0.1610.macosx-
x86/Canopy.app/Contents/include/python2.7 -c gevent/gevent.core.c -o build/temp.macosx-
10.6-i386-2.7/gevent/gevent.core.o
clang: warning: no such sysroot directory: '/Developer/SDKs/MacOSX10.6.sdk'
In file included from gevent/gevent.core.c:17:
/Applications/Canopy.app/appdata/canopy-1.2.0.1610.macosx-
x86/Canopy.app/Contents/include/python2.7/Python.h:33:10: fatal error:
'stdio.h' file not found
#include <stdio.h>
^
1 error generated.
error: command 'gcc' failed with exit status 1
Seems to be a problem with XCode. I made sure I have the XCode (v. 5.0.2) command line tools installed with:
xcode-select --install
But that didn't seem to change anything. Apparently I'm not alone with this problem (a missing /Developer/SDKs/MacOSX10.6.sdk), but I'd like to stick with Enthought's Canopy version of python if I can (and have already spent too much time combing the Apple Developer site to try download MacOSX10.6.sdk directly).
Any suggestions that don't involve starting over with a macport'ed python? Thanks!
IIUC, Apple pulled a fast one on the latest XCode, such that gcc is no longer actually gcc, but is symlinked to clang, which is not compatible with standard Pythons, including Canopy's.
It should work better if you install Xcode 3.2.1 Developer Tools from https://developer.apple.com/downloads/index.action
For me the hint on gevent website helped:
pip install cython git+git://github.com/gevent/gevent.git#egg=gevent

Missing separate debuginfo for

I try to use gdb to debug code with coredump, but I met:
Missing separate debuginfo for /lib/libc.so.6
Try: zypper install -C "debuginfo(build-id)=c4b9060b36834391b7b73976d38302a7584ae40e"
Missing separate debuginfo for /lib/ld-linux.so.2
Try: zypper install -C "debuginfo(build-id)=39c1043d2fcf5b72a2199cfb765d020b1faeb863"
Missing separate debuginfo for
Try: zypper install -C "debuginfo(build-id)=753a47afb9757471dc4823893adf607eb014b82f"
Missing separate debuginfo for /lib/libc.so.6
Try: zypper install -C "debuginfo(build-id)=c4b9060b36834391b7b73976d38302a7584ae40e"
Missing separate debuginfo for /lib/ld-linux.so.2
Try: zypper install -C "debuginfo(build-id)=39c1043d2fcf5b72a2199cfb765d020b1faeb863"
Then I installed debuginfo for glibc and update glibc to latest version, I try gdb again, it still has one information:
Missing separate debuginfo for
Try: zypper install -C "debuginfo(build-id)=753a47afb9757471dc4823893adf607eb014b82f"
But it doesn't mention which part is missed.
My GDB version is:
-> gdb --version
GNU gdb (GDB) SUSE (7.3-41.1.2)
Copyright (C) 2011 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 "i586-suse-linux".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
OS is:
Linux OpenSUSE-12.1
Add these repositories to the Zypper repositories list:
sudo zypper ar -f -n "openSUSE-Debug" http://download.opensuse.org/debug/distribution/12.1/repo/oss/ repo-debug
sudo zypper ar -f -n "openSUSE-Update-Debug" http://download.opensuse.org/debug/update/12.1/ repo-debug-update
After this, refresh and upgrade repositories:
sudo zypper ref
sudo zypper dup
Then, if necessary (you may get a message suggesting run zypper ps) restart you computer and install debuginfo for gdb:
sudo zypper in glibc-debuginfo
Add these repos:
http://download.opensuse.org/debug/distribution/XX/repo/oss/
http://download.opensuse.org/debug/update/XX/
Where XX is number of your OpenSUSE version.
Make sure they are active:
zypper lr
Then
sudo zypper in glibc-debuginfo

error while loading shared libraries: libstdc++.so.6: wrong ELF class: ELFCLASS64

I am trying to install Qt in my CentOS system. While building the library, I'm getting this error:
/root/capture/qt-everywhere-opensource-src-4.7.0/bin/qmake: error while loading shared libraries: libstdc++.so.6: wrong ELF class: ELFCLASS64
/root/capture/qt-everywhere-opensource-src-4.7.0/bin/qmake: error while loading shared libraries: libstdc++.so.6: wrong ELF class: ELFCLASS64
It seems the softlink of the libstdc++.so.6 has been changed and is pointing to libstdc++.so.6.0.13 (64-bit?). I just changed the softlink by issuing the following command (in /usr/lib folder):
rm -f libstdc++.so.6
ln -s ./libstdc++.so.6.0.8 ./libstdc++.so.6
I was having this problem running binaries compiled with g++ under a 64bit ubuntu 14.04 installation.
I installed g++-multilib and everything runs fine now
sudo apt-get install g++-multilib
yum reinstall $(rpm -qa)
The above command will resolve all the issue in centos.