NeuronRobotics / nrjavaserial

A Java Serial Port system. This is a fork of the RXTX project that uses in jar loading of the native code.
Other
345 stars 143 forks source link

Improved approach to building the native libraries #71

Closed mnlipp closed 7 years ago

mnlipp commented 8 years ago

This is just a proposal. Coming to the project from "outside" I find no clear approach how to build the native libraries. The existing Makefile is rather confusing -- besides, it looks rather like a shell script than a Makefile.

My approach is to use a Ubuntu (x86_64) system for building as many native libraries as possible. That's why I have created a new Makefile as Makefile.ubuntu64 (to indicate that it is supposed to be used on a Ubuntu x86_64 host). The host can (obviously) easily be used to build the Linux x86_64 and x86 libraries. Among all major Linux distributions, Ubuntu is (to my knowledge) the system that provides the best cross-compilation support. With the packages installed that are mentioned at the beginning of the Makefile.ubuntu64 the Ubuntu x86_64 host can be used to cross-compile the ARM libraries and the Windows libraries. (I've tested the resulting linux64, ARMv7HF, ARMv6HF, windows64 and windows32 libraries on my systems). Looking at the Ubuntu package list, it should also be possible to cross-compile for PPC.

This leaves FreeBSD (don't know why it needs special libraries), OS X (never owned a Mac, never will) and Android. I feel that cross compilation for Android should be easy to add, as cross-compilation is the "standard" way to create Android natives. And there is an Android cross-compilation toolchain in the Ubuntu repositories. But I currently have no time to look into that further.

Note that this branch includes only the files required to build the binaries, not newly built binaries.

crea-doo commented 7 years ago

I currently trying to extend your work so that this build script is used to automatically build on the TravisCI platform. I'm developing in the branch https://github.com/crea-doo/nrjavaserial/tree/travis-multi-os and have managed to build it on a Ubuntu Trusty 64bit image. I also tried to compile for 32bit but liblockdev seems to be not available somehow (see https://travis-ci.org/crea-doo/nrjavaserial/jobs/258270420). Do you have some hints how to proceed?

crea-doo commented 7 years ago

I managed to get the following build running on Travis (see https://www.travis-ci.org/crea-doo/nrjavaserial/builds/270717267):

BUT: I had to remove the liblockdev dependency temporarily

Now the idea was to have all the necessary things in the repo and compile against that, but unfortunately that failed. See https://www.travis-ci.org/crea-doo/nrjavaserial/builds/270764868 for details.

As I'm really no C expert any help is appreciated :-)

Another option would be to replace lockdev with something else - I found some related issues:

But I don't know if that is an option in our case...