Mantis - Resin
Viewing Issue Advanced Details
4823 minor always 10-24-11 16:19 10-27-11 14:27
rickHigh  
ferg  
normal  
closed  
fixed  
none    
none 4.0.24  
0004823: Resin does not compile easily on Amazon Linux AMI
Amazon has their own version of CentOS for Amazon AWS EC2.

This version uses their own Yum repository.

The Java SDK (OpenJDK 1.6) is missing the jni.h header files that Resin needs to compile the JNI C modules for faster HTTP handling.

In general there seems to be more issues compiling on CentOS than Debian derivatives.
It seems we really need a rpm package with some install instructions for it.

Notes
(0005580)
rickHigh   
10-24-11 16:23   
To get Resin to compile at all you need this command:

sudo yum groupinstall "Development Tools"


This installs all of the dev tools like C compiler.

It still fails to find the JNI libs....

configure: error:

    *** Can't find JNI directory in JAVA_HOME=/usr/lib/jvm/jre
    *** JNI is expected in /usr/lib/jvm/jre/include/linux


I ran into this same issue with CentOS 4.5 a few weeks ago when trying to track down a CentOS compile issue.

Amazon Linux is CentOS....

http://www.infoworld.com/d/open-source/why-red-hat-should-fear-amazon-linux-675 [^]
(0005582)
rickHigh   
10-25-11 00:28   
This seem to do the trick for getting the header....

sudo yum install java-1.6.0-openjdk-devel.x86_64


$ pwd
/usr/lib/jvm
[ec2-user@ip-10-124-214-37 jvm]$ find . -name "*.h"
./java-1.6.0-openjdk-1.6.0.0.x86_64/include/jawt.h
./java-1.6.0-openjdk-1.6.0.0.x86_64/include/classfile_constants.h
./java-1.6.0-openjdk-1.6.0.0.x86_64/include/jvmticmlr.h
./java-1.6.0-openjdk-1.6.0.0.x86_64/include/jni.h
./java-1.6.0-openjdk-1.6.0.0.x86_64/include/jdwpTransport.h
./java-1.6.0-openjdk-1.6.0.0.x86_64/include/jvmti.h
./java-1.6.0-openjdk-1.6.0.0.x86_64/include/linux/jni_md.h
./java-1.6.0-openjdk-1.6.0.0.x86_64/include/linux/jawt_md.h


To get the gcc compiler...

sudo yum groupinstall 'Development Tools'


I was still getting compile error....

configure: error:

    *** Can't find JNI directory in JAVA_HOME=/usr/lib/jvm/jre
    *** JNI is expected in /usr/lib/jvm/jre/include/linux
  
$ export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64

This got me past that issue.

I changed it to 64 bit (not sure why this is not the default on a 64 bit OS)

$ ./configure --enable-64bit

OpenSSL support not enabled at this point.

That seemed to work.
(0005584)
rickHigh   
10-27-11 00:50   
Even when you install the right obscure package that has the headers. The build does not work without manually setting JAVA_HOME which does not work for rpmbuild to build rpm files as you can't rely on manually setting JAVA_HOME.
(0005585)
rickHigh   
10-27-11 00:53   
To get rpmbuild to work with creating a resin rpm, I needed to set the following...

sudo ln -s /usr/lib/jvm/java-1.6.0-openjdk.x86_64/bin /usr/lib/jvm/bin

somehow the build expects java to be in /usr/lib/jvm/bin and it is not for Amazon WS and CentOS.
(0005586)
rickHigh   
10-27-11 00:57   
Now I am getting this from rpmbuild. It seems like he resets the JAVA_HOME


checking if /bin/cp accepts -u... yes
configure: error:

    *** Can't find JNI directory in JAVA_HOME=/usr/lib/jvm
    *** JNI is expected in /usr/lib/jvm/include/linux
  
error: Bad exit status from /var/tmp/rpm-tmp.sotT7x (%build)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.sotT7x (%build)
[ec2-user@domU-12-31-38-04-B2-A3 resin-rpm]$ echo $JAVA_HOME
/usr/lib/jvm/java-1.6.0-openjdk.x86_64
(0005587)
rickHigh   
10-27-11 01:02   
[ec2-user@domU-12-31-38-04-B2-A3 resin-rpm]$ sudo mv /usr/lib/jvm /usr/lib/java-libs
[ec2-user@domU-12-31-38-04-B2-A3 resin-rpm]$ sudo ln -s /usr/lib/java-libs/java-1.6.0-openjdk.x86_64/ /usr/lib/jvm

[ec2-user@domU-12-31-38-04-B2-A3 resin-rpm]$ export JAVA_HOME=/usr/lib/jvm

Now the rpmbuild fails with...

[ec2-user@domU-12-31-38-04-B2-A3 resin-rpm]$ sudo rpmbuild -v -bb --clean SPECS/resin.spec


checking sys/epoll.h presence... yes
checking for sys/epoll.h... yes
checking for JAVA_HOME...
configure: error: Can't find valid JAVA_HOME
error: Bad exit status from /var/tmp/rpm-tmp.Z9fgLH (%build)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.Z9fgLH (%build)