Log in

View Full Version : An Enjoyable(Not) Java Compiler Error (Stack Guard)


maglax
25-06-2015, 22:57
Whenever I try to run a project, my debug window shows a Java Stack Guard Error. This one to be exact:
Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar
Java HotSpot(TM) 64-Bit Server VM warning: You have loaded library /tmp/libwpilibJavaJNI4147524003046367514.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'.
Exception in thread "main" java.lang.UnsatisfiedLinkError: /tmp/libwpilibJavaJNI4147524003046367514.so: /tmp/libwpilibJavaJNI4147524003046367514.so: wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch)

I have tried installing the official version of Java (Versus openjdk (I run ubuntu)), and uninstalling and purging every version of java from my system and reinstalling the official java release. Then I started to pay more attention the the error and saw that it asked me to run execstack -c /tmp/libwpilibJavaJNI4147524003046367514.so so I did (after installing execstack of course) but it could not find the file sadly because it was a temp file so was gone already.

Paying attention to the file I see it is wpilib related. I have been using the toast api, but it doesn't look like it was that. I also had a failed installation of frcsim (I have Ubuntu 15.04 not 14.04 so it would not work ): )

Has anyone had this problem and fixed it or know how to fix it? Is this frcsim related or toast or wbilib error or something I am unaware of?

Any help is appreciated. Thanks in advance!



/*
*----------EDIT----------
*
*/

It appears that the Stack Guard error may be caused by the wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch). After some googling I found that it is related to my system architecture (32 bit vs 64). Am I correct in saying that wpilib is not architecture specific? Most of the fixes I have seen for this involve rebuilding a file, but I don't know if I can do this for wpilpb. Any sugestions?

Ben Wolsieffer
26-06-2015, 11:44
Are you accidently trying to run the code on the simulator (by choosing the "WPILib Java Simulation" rather than "WPILib Java Deploy" in the Run As dialog or some other reason)?

That is the only reason I could think of that a native library would be needed on your computer. If you are using a 64bit Java VM, then loading the 32bit simulation library could possibly cause this issue.

Arhowk
26-06-2015, 17:12
Are you accidently trying to run the code on the simulator (by choosing the "WPILib Java Simulation" rather than "WPILib Java Deploy" in the Run As dialog or some other reason)?

That is the only reason I could think of that a native library would be needed on your computer. If you are using a 64bit Java VM, then loading the 32bit simulation library could possibly cause this issue.

This is what I think too. The key here is

JNI

You shouldn't be invoking the JNI at all...

e/ well maybe the compiled file invokes the JNI on the roboRIO but it shouldn't be executed compile-tile

Tom Bottiglieri
26-06-2015, 17:46
This is just the jar that contains the robot code for the roboRIO trying to run on your machine, which is wrong.

You need to deploy the jar to your robot. I think you can do this in Eclipse with the WPILib plugins by right clicking on the project then Run As > WPILib Java Deploy.

Alternatively, you can run 'ant deploy' on the command line in your source directory.

maglax
26-06-2015, 17:52
This is just the jar that contains the robot code for the roboRIO trying to run on your machine, which is wrong.

You need to deploy the jar to your robot. I think you can do this in Eclipse with the WPILib plugins by right clicking on the project then Run As > WPILib Java Deploy.

Alternatively, you can run 'ant deploy' on the command line in your source directory.

I am trying to run the toast api simulation, which involves changing the run configuration to include the argument "-sim 'my main class'". So I do need to run it on my computer.

Ben Wolsieffer
26-06-2015, 18:26
I am trying to run the toast api simulation, which involves changing the run configuration to include the argument "-sim 'my main class'". So I do need to run it on my computer.

It looks like this bug might be specific to Toast and how you have your system set up, so you might get more help by talking to the Toast API developer directly, as not many people on CD have used Toast.

Jaci
26-06-2015, 23:58
Hey there, I'm the Dev behind Toast. The problem you're having is indeed related to Toast. If you're running Eclipse or IntelliJ IDEA (and have the latest version of the Toast Release), running 'gradlew eclipse' or 'gradlew idea' should be enough to generate the Run Configurations for you.

Alternatively, adding the argument '-sim --search' or '-sim [your.robot.Class]' should be enough to make Toast both start in Simulation Mode and find your ToastModule class. If you're running from the command line, these arguments are just appended to the command, i.e. 'java -jar Toast.jar -sim --search'. In Eclipse and IntelliJ IDEA, this is found under the 'Launch Configurations' window.

Hopefully this fixes everything, have fun!

maglax
27-06-2015, 00:41
Hey there, I'm the Dev behind Toast. The problem you're having is indeed related to Toast. If you're running Eclipse or IntelliJ IDEA (and have the latest version of the Toast Release), running 'gradlew eclipse' or 'gradlew idea' should be enough to generate the Run Configurations for you.

Alternatively, adding the argument '-sim --search' or '-sim [your.robot.Class]' should be enough to make Toast both start in Simulation Mode and find your ToastModule class. If you're running from the command line, these arguments are just appended to the command, i.e. 'java -jar Toast.jar -sim --search'. In Eclipse and IntelliJ IDEA, this is found under the 'Launch Configurations' window.

Hopefully this fixes everything, have fun!



So just checking, I should have my workspace located in the release folder of the Toast API directory and that is where ./gradlew eclipse should be run?

It may also be that I am understanding toast wrong? Do I program it the same way as a regular robot?

Jaci
27-06-2015, 00:55
The Toast Repository shouldn't be downloaded for your module. Download the Universal Release (https://github.com/Open-RIO/ToastAPI/releases/tag/Universal) and extract the Toast.zip file to where you wish to have your module. From there you can run ./gradlew eclipse and your Module will be setup for you.