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

Use liblockdev to lock serial line. #64

Closed mnlipp closed 8 years ago

mnlipp commented 8 years ago

This should implement https://github.com/NeuronRobotics/nrjavaserial/issues/60.

As already outlined there, using liblockdev can simply be activated with the appropriate define. This commit also includes updates to make cross compilation for ARM work.

The committed native libs are up to date and have been tested for x86_64 and ARM.

MrDOS commented 8 years ago

Thanks for this. I'm sorry I didn't get around to commenting on the other issue before you made the builds – I could have saved you some effort. In order to maximize binary compatibility, I can compile the ARMv5 natives on a machine running glibc 2.7 and the i386/amd64 natives under glibc 2.5 if you remove those from the pull request. Just for records-keeping sake, under what environment were the ARMv6/v7 binaries compiled?

Can you explain the presence of src/main/c/cross-compile-libs/ARM/liblockdev.so.1? This looks like a system library. Do we need to have it in the repo?

mnlipp commented 8 years ago

Sorry, but I don't know how to remove something from a pull request. Wouldn't the normal procedure be to merge without commit, replace anything you don't want from my pull request and commit then?

Binaries were compiled with gcc version 5.2.1 20151010 (Ubuntu 5.2.1-22ubuntu1) (both x86_64 and the ARM binaries).

The library src/main/c/cross-compile-libs/ARM/liblockdev.so.1 is needed for cross-compilation. If you want to compile a shared library that references another shared library, the referenced library must be available to the linker to enable it to find out which symbols the shared library provides. There is no need for that library to be up-to-date, only the API version must match (.1 in our case), i.e. it must provide the correct symbols (but it could be a file with stubs). Assuming that you compile on a x86_64 system, the "native" liblockdev1 (Ubuntu) should obviously be installed, the 32bit version is supported by the multiarch configuration and can be installed as well, but people tend to warn you about "MultiarchCross" setups, so you shouldn't try to install liblockdev1:armv7 (or whatever it is called in Ubuntu) on your build host. To support cross-compilation "out-of-the-box" (provided you have arm-linux-gnueabi-gcc/++ installed) I have added the ARM version of liblockdev to the project.

madhephaestus commented 8 years ago

To remove files from a pull request, just roll back the commit in your core repo where the files were added and force push the new state of the repo to your fork. Once your fork is right, make a new pull request like you did with this one.

Thank you for helping out with this!

mnlipp commented 8 years ago

Okay, this is the new pull request: https://github.com/NeuronRobotics/nrjavaserial/pull/65.