Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1357903

Summary: Arduino only works on 64-bit systems because of bad astyle library check
Product: [Fedora] Fedora Reporter: Jonathan Bartlett <jonathan>
Component: arduinoAssignee: Dennis Chen <barracks510>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 23CC: barracks510, giallu, mavit, tchollingsworth, thozza
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-19 15:58:29 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jonathan Bartlett 2016-07-19 14:36:30 UTC
Description of problem:

Installing Arduino on a 32-bit system crashes on startup due to bug in finding JNI library.  Even on 32-bit systems attempts to 

How reproducible:

Always

Steps to Reproduce:

Install 32-bit Fedora (I believe this is also true for 24, but only tried on 23).  Run arduino from a terminal.  See arduino crash with JNI complaint about not finding the 64-bit astyle library.

Additional info:

I believe the problem is in the RPM patch "arduino-use-system-astyle.patch".  It has the following code:

+    File libdir = new File("/usr/lib64");
+    String astylePath;
+    if (libdir.exists() && libdir.isDirectory()) {
+      astylePath = "/usr/lib64/libastyle.so";
+    } else {
+      astylePath = "/usr/lib/libastyle.so";
+    }

32-bit systems *do* have the /usr/lib64 directory, even though it doesn't have anything installed in them.  Therefore, the "true" branch will always be taken, and it will look for the 64-bit library instead of the 32-bit one.  I am not very familiar with Java and JNI, but I think you should check for the file itself.  You can probably change that to:

+    File libfile = new File("/usr/lib64/libastyle.so");
+    String astylePath;
+    if (libfile.exists()) {
+      astylePath = "/usr/lib64/libastyle.so";
+    } else {
+      astylePath = "/usr/lib/libastyle.so";
+    }

Comment 1 Dennis Chen 2016-07-19 15:58:29 UTC

*** This bug has been marked as a duplicate of bug 1357005 ***