Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

test_tools_plugindatabase.py: Could not load module libelektra-jni.so #3747

Closed
mpranj opened this issue Apr 6, 2021 · 4 comments · Fixed by #3761
Closed

test_tools_plugindatabase.py: Could not load module libelektra-jni.so #3747

mpranj opened this issue Apr 6, 2021 · 4 comments · Fixed by #3761
Assignees
Milestone

Comments

@mpranj
Copy link
Member

mpranj commented Apr 6, 2021

Steps to Reproduce the Problem

Build Elektra using the following steps (or see this GitHub Actions log).

mkdir build && cd build
SYSTEM_DIR="$PWD/kdbsystem"
export PLUGINS="ALL;-xerces;-curlget;-yamlcpp;-yamlsmith;-yanlr"
export BINDINGS="ALL;-rust"
export TOOLS="ALL;-qt-gui"
export CC=gcc-10
export CXX=g++-10
CMAKE_OPT+=(
          -GNinja
          -DPLUGINS="${PLUGINS:-ALL}"
          -DBINDINGS="${BINDINGS:-ALL}"
          -DTOOLS="${TOOLS:-ALL}"
          -DBUILD_FULL="${BUILD_FULL:-OFF}"
          -DBUILD_SHARED="${BUILD_SHARED:-ON}"
          -DENABLE_ASAN="${ENABLE_ASAN:-OFF}"
          -DCOMMON_FLAGS="${COMMON_FLAGS--Werror}"
          -DENABLE_DEBUG=ON
          -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
          -DKDB_DB_SYSTEM="$SYSTEM_DIR"
          -DKDB_DEFAULT_STORAGE="${KDB_DEFAULT_STORAGE:-dump}"
          -DKDB_DB_FILE="${KDB_DB_FILE:-default.ecf}"
          -DKDB_DB_INIT="${KDB_DB_INIT:-elektra.ecf}"
        )
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo ${CMAKE_OPT[@]}
ninja
cmake --build . --target run_all

Concrete CMake config:

-GNinja
-DPLUGINS=ALL;-xerces;-curlget;-yamlcpp;-yamlsmith;-yanlr
-DBINDINGS=ALL;-rust
-DTOOLS=ALL;-qt-gui
-DBUILD_FULL=OFF
-DBUILD_SHARED=ON
-DENABLE_ASAN=OFF
-DCOMMON_FLAGS=-Werror
-DENABLE_DEBUG=ON
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-DKDB_DB_SYSTEM=/Users/mpranj/workspace/libelektra/build/kdbsystem
-DKDB_DEFAULT_STORAGE=dump
-DKDB_DB_FILE=default.ecf
-DKDB_DB_INIT=elektra.ecf

Expected Result

Tests succeed.

Actual Result

1/2 Test  #41: test_tools_plugindatabase.py .....***Failed    0.25 sec
.E
======================================================================
ERROR: test_pluginspec (__main__.PluginDatabase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/mpranj/workspace/libelektra/src/bindings/swig/python/tests_tools/test_tools_plugindatabase.py", line 17, in test_pluginspec
    self.assertEqual(self.db.status(kdb.tools.PluginSpec("does_not_exist")), kdb.tools.ModulesPluginDatabase.missing)
kdb.tools.NoPlugin: No plugin that provides does_not_exist could be found, got errors: Was not able to load such a plugin!

Maybe you misspelled it, there is no such plugin or the loader has problems.
You might want to try to set LD_LIBRARY_PATH, use kdb-full or kdb-static.
Errors/Warnings during loading were:
10 Warnings were issued:
	Sorry, module kdb issued the warning C01200:
	Installation: Dlopen failed. Could not load module libelektra-jni.so. Reason: dlopen(libelektra-jni.so, 130): Library not loaded: @rpath/libjvm.dylib
  Referenced from: /usr/local/opt/openjdk/libexec/openjdk.jdk/Contents/Home/lib/libjawt.dylib
  Reason: image not found
	Mountpoint: /
	Configfile:
	At: ../src/libs/loader/dl.c:90
,

----------------------------------------------------------------------
Ran 2 tests in 0.134s

FAILED (errors=1)

System Information

  • Elektra Version: master
  • macOS Big Sur
  • openjdk 15, gcc10
@mpranj
Copy link
Member Author

mpranj commented Apr 6, 2021

Not sure if this is related to #3669 or is the same issue.

I posted it separately as the config is quite large and the error does not occur using the "default" macOS toolchain (Apple Clang).

@mpranj mpranj added this to the 0.9.* milestone Apr 6, 2021
mpranj added a commit to mpranj/libelektra that referenced this issue Apr 6, 2021
@markus2330
Copy link
Contributor

Thank you for reporting this problem! Yes, it has probably the same underlying cause (libjvm not found) but this issue is about MacOS (libjvm.dylib) and #3669 about Linux (libjvm.so), so it makes sense to keep both open.

@markus2330 markus2330 modified the milestones: 0.9.*, 0.9.5 Apr 6, 2021
@markus2330 markus2330 mentioned this issue Apr 6, 2021
6 tasks
@robaerd robaerd mentioned this issue Apr 7, 2021
20 tasks
@mpranj mpranj self-assigned this Apr 8, 2021
@mpranj mpranj modified the milestones: 0.9.5, 0.9.6 Apr 12, 2021
a-kraschitzer pushed a commit to a-kraschitzer/libelektra that referenced this issue Apr 14, 2021
a-kraschitzer pushed a commit to a-kraschitzer/libelektra that referenced this issue Apr 14, 2021
@mpranj
Copy link
Member Author

mpranj commented Apr 29, 2021

There are actually multiple problems here.

The reported problem is upstream, as some packaged openjdk libraries are linked incorrectly with libjvm.dylib (wrong RPATH) on macOS. This can be seen from the error report in Referenced from:, but I overlooked that.

Another problem was that jni's CMake overrides JAVA_HOME on macOS with an empty path, due to a wrong invocation here:

execute_process (
COMMAND "/usr/libexec/java_home --failfast"
ERROR_QUIET
OUTPUT_VARIABLE JAVA_HOME
OUTPUT_STRIP_TRAILING_WHITESPACE)

The command args needed to be separate, so this silently never worked.

The problems are fixed in #3761.

@markus2330
Copy link
Contributor

Thanks a lot for fixing this!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants