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
344 stars 142 forks source link

[question] Linux x86-64 binary linked against lockdev/liblockdev #217

Open splatch opened 3 years ago

splatch commented 3 years ago

Hey, I am running two kinds of linux machines - one is my developer box powered by arch, another is embedded linux distro made with yocto. In both cases I ran into issues with locks. At least for arch lock dir (/var/run/lock) does exist, permissions are fine for all software but not for rxtx/nrjavaserial.

I started to look at never ending topic of locks #60 and some other issues. I would love to see issue fixed since my embedded linux is also x86-64. How to get make linux64 produce binary linked against lockdev?

MrDOS commented 3 years ago

If you're comfortable building your own native binaries, probably the easiest workaround to locking issues at the moment is to build with DISABLE_LOCKFILES defined – edit src/main/c/Makefile and add -DDISABLE_LOCKFILES to the CFLAGS definition:

diff --git a/src/main/c/Makefile b/src/main/c/Makefile
index 90d43bd..3ff9359 100644
--- a/src/main/c/Makefile
+++ b/src/main/c/Makefile
@@ -63,7 +63,8 @@ include platform.mk
 # it will work as a library (dlopen(3) et al. can load it into any memory).
 export CFLAGS ?= -I$(JAVA_HOME)/include -I./include -I./include/target \
                    -O3 -fPIC -c \
-                   -Wall
+                   -Wall \
+                   -DDISABLE_LOCKFILES
 # We want to use the compiler frontend to invoke the linker, too.
 export LD = $(CC)
 # We want to link objects into a shared library.

Then you can make clean-linux64 linux64.