Recompiling BungeeCord native libraries for use on CentOS/RHEL

My blog is a bit dusty. Time for an update!

I don't use RHEL-based systems like CentOS. I personally despise it.

But if you do use CentOS, you might see that you can't use native crypto. Here's a quick guide to enable the use of native crypto on CentOS.

Why do I have to do this?

BungeeCord's native libraries are built against Debian 7. While this supports Ubuntu and Debian just fine, RHEL-based systems often ship older or newer OpenSSL versions than what Debian 7 shipped.

Setting up your environment

First, you will need to install the dependencies. I assume you already have the JDK installed. Start by running yum install gcc-c++ zlib-devel openssl-devel to install g++, zlib, and OpenSSL development files.

By default, CentOS/RHEL does not define JAVA_HOME. You will need to find the correct value; look in /usr/lib/jvm to find the correct value to use. If you find bin/javac in the directory, you have found the JDK. You will need to use export JAVA_HOME=/usr/lib/jvm/<the JDK value>.

Compiling the libraries

Once you have done this, clone a copy of BungeeCord and move to the native/ directory.

Run ./compile-native.sh. This will recompile the native libraries. To verify this works, run mvn clean test. If you completed these steps successfully, net.md_5.bungee.NativeCipherTest should now pass.