Bug 226234 - textproc/elasticsearch5: JNA not found
Summary: textproc/elasticsearch5: JNA not found
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Mark Felder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-02-27 06:59 UTC by Gatolabo
Modified: 2018-03-02 13:08 UTC (History)
4 users (show)

See Also:
bugzilla: maintainer-feedback? (tj)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gatolabo 2018-02-27 06:59:41 UTC
[WARN ][o.e.b.Natives            ] JNA not found. native methods will be disabled.
[WARN ][o.e.b.Natives            ] cannot check if running as root because JNA is not available
[o.e.b.Natives            ] cannot register console handler because JNA is not available
[ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [] fatal error in thread [main], exiting
java.lang.NoClassDefFoundError: com/sun/jna/win32/StdCallLibrary$StdCallCallback


# ls -l /usr/local/lib/elasticsearch/lib
lrwxr-xr-x  1 root  wheel        62  Feb 27 14:55 jna.jar -> ../../../../../../../../../../local/share/java/classes/jna.jar

The symbolic link path is wrong.
Comment 1 Mark Felder freebsd_committer 2018-02-27 14:47:11 UTC
It was right, but the file wasn't there because it was accidentally set as a BUILD_DEPENDS instead of RUN_DEPENDS.

This has been fixed in the next PORTREVISION bump.
Comment 2 Lorenz Pressler 2018-02-28 17:14:57 UTC
no, the link is wrong nonetheless.
Comment 3 Mark Felder freebsd_committer 2018-02-28 19:09:19 UTC
(In reply to Lorenz Pressler from comment #2)

The link is not wrong. It is a relative symlink which is what the portmgr team now prefers which is why it looks strange. Here's output from a production server:

$ pkg info | grep elas
elasticsearch5-5.6.8_2         Full-text search engine for Java
$ ls -la jna.jar 
lrwxr-xr-x  1 root  wheel  72 Feb 26 23:23 jna.jar -> ../../../../../../../../../../../../usr/local/share/java/classes/jna.jar
$ file jna.jar 
jna.jar: symbolic link to ../../../../../../../../../../../../usr/local/share/java/classes/jna.jar
$ file 
$ md5 jna.jar 
MD5 (jna.jar) = 5736a11b203679cda4b3cb5237a82b70
$ md5 ../../../../../../../../../../../../usr/local/share/java/classes/jna.jar
MD5 (../../../../../../../../../../../../usr/local/share/java/classes/jna.jar) = 5736a11b203679cda4b3cb5237a82b70
$
Comment 4 Gatolabo 2018-03-01 01:06:31 UTC
I do not care about compatible symlink.
It does not work because "/usr" is missing in my environment.

# ls -l /usr/local/lib/elasticsearch/lib
lrwxr-xr-x  1 root  wheel        62  Feb 27 14:55 jna.jar -> ../../../../../../../../../../local/share/java/classes/jna.jar
Comment 5 Mark Felder freebsd_committer 2018-03-01 22:41:04 UTC
(In reply to Yoshito Uchiyama from comment #4)

Do you mean you don't have /usr in your filesystem at all? Is this a specialized FreeBSD install?
Comment 6 Gatolabo 2018-03-02 00:30:50 UTC
No, my FreeBSD is not a special install.

% ls -l /usr/local/share/java/classes
-rw-r--r--  1 root  wheel  1439719  Feb 27 15:09 jna.jar

% ls -l /usr/local/lib/elasticsearch/lib
lrwxr-xr-x  1 root  wheel        62  Feb 27 14:55 jna.jar -> ../../../../../../../../../../local/share/java/classes/jna.jar
                             ^ '/usr' is missing

This symbolic link is broken.
Comment 7 Gatolabo 2018-03-02 03:58:41 UTC
Thank you for 5.6.8_3.
However, the link is unchanged and it is broken.

% ls -l /usr/local/lib/elasticsearch/lib
lrwxr-xr-x  1 root  wheel        62  Mar 2 11:07 jna.jar -> ../../../../../../../../../../local/share/java/classes/jna.jar
Comment 8 Gatolabo 2018-03-02 06:03:43 UTC
Makefile
${INSTALL} -lrs ${JAVASHAREDIR}/classes/jna.jar ${STAGEDIR}${PREFIX}/lib/elasticsearch/lib/jna.jar

This line is being done as below.

install -lrs /usr/local/share/java/classes/jna.jar /usr/ports/textproc/elasticsearch5/work/stage/usr/local/lib/elasticsearch/lib/jna.jar


% ls -l /usr/ports/textproc/elasticsearch5/work/stage/usr/local/lib/elasticsearch/lib
total 0
lrwxr-xr-x  1 root  wheel  62  Mar  2 14:28 jna.jar -> ../../../../../../../../../../local/share/java/classes/jna.jar

At this point this is the correct symbolic link.
However, if this link is simply copied to /usr/local/lib/elasticsearch/lib, it becomes a broken symbolic link.
Comment 9 commit-hook freebsd_committer 2018-03-02 13:06:58 UTC
A commit references this bug:

Author: feld
Date: Fri Mar  2 13:06:24 UTC 2018
New revision: 463392
URL: https://svnweb.freebsd.org/changeset/ports/463392

Log:
  textproc/elasticsearch{5,6}: Fix symlink

  Relative symlinks should only be used when both files are in the
  STAGEDIR. In this situation poudriere was producing usable packages
  because of the unique location of WRKSRC (/wrksrc/...) which caused the
  relative symlink to be deep enough "../../../../../" to hit the root of the
  filesystem and then point to the location of the file. However, users
  who were building the port directory with "make" or "portmaster" were
  getting symlinks that did not point to the right location.

  PR:		226234 226265 222261

Changes:
  head/textproc/elasticsearch5/Makefile
  head/textproc/elasticsearch6/Makefile