Ubuntu - Debugging in CLion exits with code 127 - c++

I am running CLion 2017.1.3 on Ubuntu 16.04 LTS. When I click the "Debug"
button, the C++ project builds and then the debugger stops and exits with the error:
"During startup program exited with code 127.
Process finished with exit code 0"
I searched for this issue in StackOverflow and other forums but could not find any answer to resolve my issue. Please help me resolve this error.

The issue was because my SHELL variable was pointing to the wrong path. I found that out when I faced another issue of not being able to install any python packages using pip. When I googled that error, I happened to find out this SHELL variable issue.
Execute echo $SHELL in a terminal and check if it is a valid shell that you are using. I use the bash shell and hence changed it to /bin/bash using the command chsh -s /bin/bash root
Also, some debug libraries went missing, which I was able to restore using Ubuntu's Software Updater. Now, I am able to debug :)

Related

How do i install correctly g++ and clang++ complilers on windows 11 for visual studio code

Well, it's more like a two-part question. I was following step by step this youtube tutorial about setting up visual studio code and trying different compilers(I went to winlibs and downloaded Win64: Zip archive version) and everything was great until 35:30 where the terminal output was fatal error: cannot execute 'cc1plus': CreateProcess: No such file or directory compilation terminated. I uninstalled and repeated the process several times but the problem remained. I followed some other tutorials about fixing the problem but it didn't work and soon after something else came up. I uninstalled and installed again the compilers and when I tried to find them in the command prompt clang++ --version worked and gcc --version but when I tried the g++ --version this appeared on the screen.Screenshot Saying this can't run on your pc or whatever. I really need some help did I do something wrong? How do I fix both these issues (terminal error and this app cant run on your PC) I ran a virus scan,SFC scan, I run command prompt as administrator, and this does work but at the beginning I didn't have to do that and if I don't choose that option still says that and it's really frustrating. I would really appreciate some help. Thanks in advance!

Build QT5 project on Ubuntu for Windows

I tried to build qt project on Ubuntu for windows, following the steps in this post
Building Qt 5 on Linux, for Windows
Everything is good except when I run make command, it complains about "i686-w64-mingw32.static-g++: Command not found". But I did see i686-w64-mingw32.static-g++ under /root/mxe/usr/bin. I have no idea what happen. Do I miss something?
You can try run the command directly in shell. If it goes wrong again, check the PATH.

C++ debugger "gdb.exe --version" error in Eclipse Mars+MinGW

When debugging a C++ project in Eclipse I get the following error:
'Launching Project.exe' has encountered a problem.
Could not determine GDB version using command:
D:\Programme\MinGW\bin\gdb.exe --version
Some Posts on Stackoverflow suggested linking MinGW\bin\gdb.exe directly in the C++/GDB settings solves the problem, but as you can see it didn't for me.
Any suggestions?
Edit: Tried mingw-get.exe install gdb in MinGW\bin, got an error that said the latest version is already installed.
I found the solution for my --version error:
When I ran $ gdb --version from the MinGW shell I got an error message saying zlib1.dll was not found.
I copied zlib1.dll from the \Debug folder of my C++ project into MinGW\bin and now it's working.
If gdb --version works in cmd, then try change path in eclipse - run - debug configurations - debugger - GDB debugger to C:\MinGW\gdb64\bin\gdb.exe, the default one in C:\MinGW\bin could be 32-bit.

Mac C++/eclipse cannot debug: Error while launching command: gdb --version

I am using c++/eclipse kepler on mac, and I cannot debug any project. The error is "Error while launching command: gdb --version" Besides that, I can build and run my code using other libraries.
I searched a site that is similar to my problem: Debugger for C++ eclipse gives the following error. 'Launching program name' has encountered a ... Error while launching command: gdb --version
But what should I change if I am using a mac?
You can fix this by specifying the full path to gdb. You can do this separately for each debug configuration, and you can also set the default gdb location in the preferences under C/C++ > GDB. For example, if you installed gdb via Homebrew, then it's probably located under /usr/local/bin:
And here's a screenshot of the Preferences:
I still don't know why Eclipse can't find GDB even though it is on my path. I guess it doesn't use my .bash_profile or my .bashrc? You could try symlinking gdb into /usr/bin. Maybe Eclipse will look there.
Edit: I tried the symbolic link idea and now Eclipse can debug, but it crashes inexplicably while doing so! So, I guess... don't do that?
This guide from a UC Irvine Computer Science professor's page is a very well-written, detailed, and Mac-specfic description of all the steps involved in installing GDB, creating a certificate, signing GDB using that certificate, and finally configuring Eclipse. I was found this very helpful as someone unfamiliar with each of these steps.
GDB Installation on Mac OS X
I had the same problem. I solved it by:
Install a gdb - ( I used 7.8.1) - compile and install it. It got installed in usr/local/bin
Codesigning certificate
Open eclipse executable using sudo. Otherwise I still get the error.
I am on OS X.
Hope this helps.
I had this error too now, and spent more than an hour looking for it.
In my case, the path was correct, and eclipse seemed to fail to start "any" executable as debugger. (I tested with gksudo cat, but it clearly never got to effectively running it).
The final reason was that I had put in my eclipse.ini -Xms1G and -Xmx1G. It seemed to already use the full memory for the indexer, and trying to allocate some more memory to start the debugger failed with an "unkown" error. Removing the memory limitations fixed the issue.
Hope this helps someone
I had many difficulties making GDB to work on Eclipse. I tried LLDB instead and it worked like a charm:
https://wiki.eclipse.org/CDT/User/FAQ#How_do_I_get_the_LLDB_debugger.3F
This can be a more convenient alternative for Mac users.
Mac OS Sierra 10.13.6 gdb 8.0.1
had the same error as topic-starter.
first, I set the path as Neil Traft (here in the answers) explains to usr/local/bin/gdb;
But it didn't work.
I found these instructions:
https://gist.github.com/gravitylow/fb595186ce6068537a6e9da6d8b5b96d
and I discovered that I already had gdbcert1 in my System. So I followed everything from 7. Works!

Debugger for C++ eclipse gives the following error. 'Launching program name' has encountered a ... Error while launching command: gdb --version

I've always worked around the debugger issue, but now it has gotten too annoying. I'm working on more complex programs and can't anywhere if I cant debug my programs. Has any one else been able to fix this issue in eclipse? It works for java, but not more my C++ plugin from minGW
Debbugger for C++ eclipse gives the following error. 'Launching program name' has encountered a problem. Error while launching command: gdb --version
Assuming you are using Windows and have MinGW installed, you only need to locate the gdb executable in the MinGW bin folder. This can be done on the "Main" tab in the "Debugger" configuration of Eclipse: