jnr / jffi

Java Foreign Function Interface
Apache License 2.0
168 stars 78 forks source link

Native jar artifact does not include OpenBSD build #38

Closed cprice404 closed 4 years ago

cprice404 commented 8 years ago

The native jar artifacts for this project (e.g. http://repo1.maven.org/maven2/com/github/jnr/jffi/1.2.13/jffi-1.2.13-native.jar ) include .so files for most platforms, but not for OpenBSD.

OpenBSD is mentioned in the source code in several places, and if I install JRuby on OpenBSD, I can see this file:

/usr/local/jruby/lib/jni/x86_64-OpenBSD/libjffi-1.2.so

So I'm hoping maybe this is just a minor packaging oversight?

headius commented 7 years ago

@cprice404 I think we just need someone to build the so and contribute it in a PR!

buzzdeee commented 7 years ago

hi @headius, I was providing access to one of my OpenBSD boxes for @cprice404, where he actually figured what the problem is. After he figured what the problem is, and following his suggestions, I did as described here: https://tickets.puppetlabs.com/browse/SERVER-14?focusedCommentId=365569&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-365569

On OpenBSD, there currently is jruby 9.1.5.0 installed/available, providing a /usr/local/jruby/lib/jni/x86_64-OpenBSD/libjffi-1.2.so

I basically copied that file into the puppetserver jar, and things started to work.

If you are fine with me, taking that .so from that jruby version, I can create a PR against jffi.

There may or may not be a problem I see with that approach:

ldd /usr/local/jruby/lib/jni/x86_64-OpenBSD/libjffi-1.2.so
/usr/local/jruby/lib/jni/x86_64-OpenBSD/libjffi-1.2.so:
        Start            End              Type Open Ref GrpRef Name
        00000650c4844000 00000650c4a57000 dlib 2    0   0      /usr/local/jruby/lib/jni/x86_64-OpenBSD/libjffi-1.2.so
        000006500395b000 0000065003b6a000 rlib 0    1   0      /usr/lib/libpthread.so.23.0

with the next major or minor bump of libpthread, the once created .so might stop working. OpenBSD doesn't have that concept of symlinking library versions with each other. so there is no such thing like a plain /usr/lib/libpthread.so or /usr/lib/libpthread.so.23.

There is only: /usr/lib/libpthread.a /usr/lib/libpthread.so.23.0 /usr/lib/libpthread_p.a

not sure if I can kind of can link/create the libjffi-1.2.so file against the static libpthread.a.

Or do I see a problem where there is no problem? If that might be a problem, hints on how to build the libjffi.so against the static libpthread.a are appreciated.

Other minor problem I want to point out, but for the time being neglectable: jruby port/packe is limited to AMD64 on OpenBSD, the comment says: "# Runtime failures on i386 in IO#pos and IO#rewind". If there is a solution for libpthread, then I at least could build a libjffi.so for i386 as well, but it may or may not have runtime issues.

buzzdeee commented 7 years ago

see PR #43

headius commented 4 years ago

This was largely fixed by #43. Any additional issues should be filed separately.