GDB with Eclipse CDT - eclipse

When I try to run my C++ hello world program in Eclipse, I get the error "Error while launching command: gdb --version".
SO won't let me upload the following screenshot: Screenshot 1
I'm running eclipse on Windows 7 and using Cygwin's GCC/GDB. Typing gdb --version in cygwin causes no problems. I've confirmed that it's in C:/cygwin/bin. This path is added as an environment variable. What's the problem?
Here's a screenshot of my path variable: Screenshot 2

This is be because Eclipse CDT does not support gdb version 7.5. Please try to install the gdb version 7.3, or older.

Related

No source available in Eclipse

I'm using GDB 7.3 in Eclipse. It's connecting to a GDBServer.
When I launch the debugger in Eclipse I get:
No source available for "main() at 0x101250"
I'm compiling with the optimizer turned off and the debug flag set to max:
-O0 -g3
I see the debug symbols when I run:
./powerpc-unknown-eabi-objdump.exe -g | grep debug
GDB 8.1 is able to find the sources. However, I can't use it due to incompatibilities with the GDBServer I'm connecting to :(
Edit:
I have added the source in the "Source" tab in the "Debug Configuration." I've even added the source manually in the GDB terminal aka "Debugger Console" using the following:
directory /path/to/src/
Source directories searched: /path/to/src/:$cdir:$cwd
For those who have this issue in the future.
The problem comes from using a new version of GCC (GCC 8.1) and an older version of GDB (GDB 7.3)
GCC is putting out a new version of debug symbols that the old version GDB does not know how to deal with. I added flags to GCC to produce older dwarf symbols:
-ggdb -gdwarf-3
Here is the documentation for those flags

Command line tools not accessible from Eclipse on OSX

I am using Eclipse on a macOS machine. CMake is present on my machine at /usr/local/bin/cmake and has been installed using Homebrew. Eclipse is at the latest version (2018-09).
I have the following target in a Makefile, which has been set up and is visible from Eclipse:
all:
./configure
Rscript -e "Rcpp::compileAttributes()"
R CMD INSTALL --no-multiarch --with-keep.source .
Inside the configure file, there is this code:
cd src/build;cmake ..
However, when I double click the all target in Eclipse, I get the following message:
make all
./configure
./configure: line 1: cmake: command not found
make: *** [all] Error 127
I remember that some time ago this target worked out of the box on macOS. I can also launch CMake from a terminal without any trouble.
echo $PATH shows different behaviour:
If called from a standard macOS terminal, it yields /usr/local/sbin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/opt/X11/bin
If called from a TM Terminal inside Eclipse, it yields /usr/bin:/bin:/usr/sbin:/sbin
What is the most canonical way to have Eclipse detect my CMake installation ?
For macOS High Sierra 10.13.6, the solution provided here works. This must be performed to see the changes immediately.

Eclipse scala-ide won't start after installing Mac OS X Sierra (Mac OS 10.12)

Eclipse quit Unexpectedly error is showing up.
Process: eclipse [1612] Path:
/Applications/Eclipse.app/Contents/MacOS/eclipse Identifier:
scalaide.product.id Version: 1.0.0 (1.0.0.201605041117)
Code Type: X86-64 (Native) Parent Process: ??? [1]
Responsible: eclipse [1612] User ID: 501
Date/Time: 2016-11-05 08:25:36.767 +0530 OS Version:
Mac OS X 10.12 (16A323) Report Version: 12 Anonymous UUID:
756B4B0B-5772-3B0B-F072-86AA384C8784
Sleep/Wake UUID: 9458E0FB-8ADB-4FF1-AF46-A0CE9A6FC72D
Time Awake Since Boot: 6100 seconds Time Since Wake: 3100
seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes:
KERN_INVALID_ADDRESS at 0x000000000000003c Exception Note:
EXC_CORPSE_NOTIFY
I installed the new Mac Sierra & installed the latest scala-ide (scala-SDK-4.4.1-vfinal-2.11-macosx.cocoa.x86_64.zip) but its showing above error on opening the application.
I also faced the same issue in sierra.
There seems to be some issue with unzipping in sierra.
Both double click as well as unzip command.
I ended up using windows (i had windows VM in VMFusion) and used 7zip to uncompress the zip. After that, it open properly in Mac.
I have a workaround if you find interesting:
brew install Caskroom/cask/scala-ide
It worked for me and installed the version 4.4.1 on macOS Sierra 10.12.1.
Note: You will need to have brew installed so for instructions on that check this url: http://brew.sh .
I didn't dig deep into this, but it looks like it may be an error of the Mac OS X utility that automatically compresses files.
I have downloaded the zip, uncompressed it via unzip, and it worked (launched via command line).
I was having same issue with Eclipse Kepler when double clicking to unzip a .tar.gz file. The above reference about using Terminal worked for me.
Instead of double clicking to unsip a .zip or a .tar.gz file, try using Terminal to cd to the same directory as the downloaded file, and run command
For a .zip file:
unzip -a foo.zip
For a .tar.gz file:
gunzip -c foo.tar.gz | tar xopf -
while replacing 'foo' with name of your downloaded file.
I was also required to download and install legacy Java 6 runtime.
Reference:
http://magma.maths.usyd.edu.au/magma/faq/extract
Scala IDE is not compatible with Java SE 9 and higher versions. You might need to downgrade or install Java SE 8 in order to fix the issue.
Lets go through each step how you can fix it.
Step 1. Check what version of Java you have installed on your machine.
Run this command in your terminal: /usr/libexec/java_home --verbose
As you can see I have three different versions of java running on my machine.
Step 2: Install Java SE 8 (jdk1.8) if you don't find it in your list. Refer this blog for java installation steps.
Step 3: Now open your .bashrc file (run command: vi ~/.bashrc) and copy-paste below line in your bashrc file.
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
Step 4: Save the file (:wq!) and reload your profile (source ~/.bashrc)
Step 5: Now you need to define eclipse.ini arguments in order to use Java 1.8 version.
On a Mac OS X system, you can find eclipse.ini by right-clicking (or Ctrl+click) on the Scala IDE executable in Finder, choose Show Package Contents, and then locate eclipse.ini in the Eclipse folder under Contents.
The path is often /Applications/Scala IDE.app/Contents/Eclipse/eclipse.ini
Step 6: Open it with text editor and copy-paste below line in eclipse.ini file. Change the version (if needed) according to your java version. Mine is 1.8.0_171.
-vm
/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/bin
Step 7: Save the file and exit.
Step 8: Run the Scala IDE application now and it should run:
Reference: Website
Facing the same error using macOS 10.12.5. Tried using different unzipped and home-brew.
Finally made it:
Installed it using brew cask install scala-ide. Changed the default workspace to "workspace_new" when getting asked at the first start.

Why is this error showing when I try to use javaws?

When I try to use an application with the following command on Ubuntu:
javaws http://example.com.br/remote_example.jnlp
or simply type
javaws
The followin error shows up:
Java HotSpot(TM) 64-Bit Server VM warning: You have loaded library /usr/lib/jvm/java-6-oracle/jre/lib/amd64/libdeploy.so which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
I've searched on Google, but didn't find the answer. I'm sure i'm using 64 bit Ubuntu with 64 bit 1.6 jdk, my coworkers are using the same set up but have no idea what this message is about.
The problem is the java 6 loading screen pops up but after that no signal of the application being opened.
I've installed execstack with apt-get and run execstack -c on the library, the message doesn't show up anymore, but the application still won't open.
Running this on the command line solved the problem:
update-alternatives --config javaws
And then selecting the 1.6 jdk instead of any other appearing there.
For some reason it was using the my java 8 jdk even though my $JAVA_HOME variable was set to jdk 1.6 path.

The JDK is missing and is required to run some NetBeans modules

Complete error message:
The JDK is missing and is required to run some NetBeans modules
Please use the --jdkhome command line option to specify a JDK installation or see http://wiki.netbeans.org/FaqRunningOnJre for more information.
Some details: I just installed Netbeans on Linux mint for the first time and when I start it when its turning on modules this error message appears. But I do have jdk installed.
$ java -version
java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)
$ javac -version
javac 1.8.0_66
Find the file [netbeans installation directory]/etc/netbeans.conf
Luckily, Linux has a find helper like
find /home/ -name "netbeans.conf,
in which you can change the /home/ to a location where you want to search.
I found it at /usr/local/netbeans-8.1/etc/netbeans.conf
Once, you found the file, the following property needs to be set:
netbeans_jdkhome="[jdk_path]"
where you can find the jdk_path using:
update-alternatives --config java
In my case, I found it at /opt/java/jdk1.8.0_191
[Solved] For Mac OSX 10.11 (El Capitan).
Solution may be similar for other Unix-based systems.
The problem may have occurred because I inadvertently installed the jre
prior to installing the jdk. I uninstalled the jre, installed the jdk
and reinstalled NetBeans but the problem (popup window) remained.
However, the fix was fairly simple.
1. Make sure NetBeans is not running.
2. Make sure the jdk is installed.
3. Determine the location of the jdk:
The jdk location can be determined by entering the following (in Terminal):
$ /usr/libexec/java_home
For my system, the output was:
/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home
4. Edit the NetBeans configuration file to indicate the location of the jdk.
Near the bottom of this Netbeans configuration file (or equivalent for your NetBeans version):
/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/etc/netbeans.conf
Comment out the following line (insert a # before the first character):
#netbeans_jdkhome="/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/bin/jre"
Then, add the following line (or equivalent for your jdk version):
netbeans_jkdhome="/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home"
Then, save and exit the editor.
5. Start NetBeans (no more popup window indicating that the jdk is missing).
When netbeans has problems trying to find the path of the jdk, it's mainly because the version of the jdk does not match. Open the file C:\Program Files\NetBeans 8.2\etc\netbeans.conf, and verify that netbeans_jdkhome = "C:\Program Files\Java\jdk1.8.0_111".
Open netbeans.conf
sudo nano "/usr/lib/jvm/java-8-oracle/netbeans.conf"
Set proper sdk path:
netbeans_jdkhome="/usr/lib/jvm/java-8-oracle"
Exit Ctrl + X and to save changes Ctrl + T
This error showed up when I updated the Mac to Mojave. To fix, I edited the netbeans.conf file with the current jdk by using Terminal to find the correct jdk. Type
/usr/libexec/java_home -V
Here was my output.
Matching Java Virtual Machines (4):
1.8.311.11 (x86_64) "Oracle Corporation" - "Java" /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
1.8.0_131 (x86_64) "Oracle Corporation" - "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
1.8.0_25 (x86_64) "Oracle Corporation" - "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home
1.7.0_79 (x86_64) "Oracle Corporation" - "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
Entering the first jdk listed did not work.
I edited the conf file with the second one listed:
netbeans_jdkhome="/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home"
Restarted Netbeans. That fixed it.
This worked for me
1. install full JDK
2. either edit <netbeans-IDE-installation>/etc/netbeans.conf
2.1 unmark netbeans_jdkhome
2.2 link to JDK location e.g. /usr/local/share/java/jdk1.6.0_07/
3. or use --jdkhome command-line option e.g. ./bin/netbeans --jdkhome /usr/local/share/java/jdk1.6.0_07/
take care with the "/" at the end
More info in http://wiki.netbeans.org/FaqRunningOnJre
Ubuntu 16.04 LTS:
Uninstall the netbeans you have.
Delete .cache/netbeans folder
Download http://www.oracle.com/technetwork/java/javase/downloads/jdk-netbeans-jsp-142931.html
Install your download
I have this problem to. But now i resolove this problem with edit one line.
Find and open this file /etc/netbeans.conf
If you see netbeans_jdkhome="C:\Program Files\Java\jre1.8.0_151" replace netbeans_jdkhome="C:\Program Files\Java\jdk1.8.0_131"
Save as adminstrator
Problem reseloved
In mid April 2019, Oracle has changed the JDK's licence. However, I was still able to solve this issue with NetBeans 11 and the JDK 12's open source build on my Windows machine. Just downloaded the open source JDK from https://jdk.java.net/ and extracted it. Then, in my NetBeans config file, I typed in the path to the extracted directory (NOT the "bin" folder!).
I resolved this problem by changing default version of JRE and JDK that I'm using to 11.x.x with following commands:
sudo update-alternatives --config java
sudo update-alternatives --config javac