fommil
fommil

Reputation: 5875

cross compiling Java JNI libraries for Windows / RPi from OS X / Linux

I have access to a 64 bit OS X environment, but I'd like to dramatically reduce the process for releasing native library builds for x86 / x86_64 / armv6 Linux and 32 / 64 bit Windows.

How can I cross compile JNI code from OS X (and failing that, from 64 bit Ubuntu Linux)? Which compilers must I install (I'm using macports) and from where can I install the foreign JDK environments that I must include and link against? What special compiler / linker flags are needed?

I'm using the maven-native-plugin so I can easily change the compiler, linker and JDK_HOME for every target. I have one module (i.e. pom.xml) per target platform.

The project, for those interested in details, is netlib-java/native_ref.

Upvotes: 3

Views: 996

Answers (1)

fommil
fommil

Reputation: 5875

I've found out that various Linux cross-compilers come with macports in the form of

  • arm-elf-gcc
  • i386-elf-gcc
  • x86_64-elf-gcc
  • i386-mingw32-gcc

with 64 bit Windows cross-compile on its way.

Unfortunately, for my purposes I also need a Fortran compiler, so I'm asking for more help on that now on the macports mailing lists

EDIT: the current state of fortran cross-compilers (and mingw in general) on OS X is woeful. Best advice at the moment is to run a Linux box in VirtualBox and cross-compile all the targets from there. Two builds, not optimal, but better than all native.

Upvotes: 2

Related Questions