Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Master] Build fails after d6bc920e056baad7782f47b86cba85d1336bb134 - Class not found #24225

Closed
6 tasks
coffeinflash opened this issue Dec 12, 2023 · 14 comments · May be fixed by #25212
Closed
6 tasks

[Master] Build fails after d6bc920e056baad7782f47b86cba85d1336bb134 - Class not found #24225

coffeinflash opened this issue Dec 12, 2023 · 14 comments · May be fixed by #25212
Labels
Triage: Needed (managed by bot!) issue that was just created and needs someone looking at it

Comments

@coffeinflash
Copy link

Bug report

Describe the bug

Building the latest master fails after d6bc920 .
The required groovy class(es) cannot be found.

I am building kodi packages for openSUSE using OBS: https://build.opensuse.org/package/show/home:Herbster0815:HTPC:Test/kodi
During the build there is no network connection so the required zips containing the needed java libraries can not be downloaded.
As stated in d6bc920 I added the source directories to cmake configuration:

Complete spec-file: https://build.opensuse.org/package/view_file/home:Herbster0815:HTPC:Test/kodi/kodi.spec?expand=0

Except from spec-file:
(...)
Source12: http://mirrors.kodi.tv/build-deps/sources/apache-groovy-binary-4.0.16.zip
Source13: http://mirrors.kodi.tv/build-deps/sources/commons-lang3-3.14.0-bin.tar.gz
Source14: http://mirrors.kodi.tv/build-deps/sources/commons-text-1.11.0-bin.tar.gz
(...)
unzip -q %{SOURCE12}
tar xzf %{SOURCE13}
tar xzf %{SOURCE14}
(...)
%cmake
-DVERBOSE=ON
-DCMAKE_BUILD_TYPE=Release
-DCORE_SYSTEM_NAME=linux
-DAPP_RENDER_SYSTEM=gles
-DCORE_PLATFORM_NAME=gbm
-DGIT_VERSION="%{_git_version}"
-DENABLE_EVENTCLIENTS=ON
-DENABLE_INTERNAL_CROSSGUID=OFF
-DENABLE_INTERNAL_CDIO=OFF
-DENABLE_INTERNAL_FLATBUFFERS=OFF
-DENABLE_INTERNAL_FMT=OFF
-DENABLE_INTERNAL_FSTRCMP=OFF
-DENABLE_INTERNAL_RapidJSON=OFF
-DENABLE_INTERNAL_SPDLOG=OFF
-DENABLE_INTERNAL_DAV1D=ON
-DDAV1D_URL="%{SOURCE11}"
-DENABLE_INTERNAL_UDFREAD=ON
-DUDFREAD_URL="%{SOURCE10}"
-Dgroovy_SOURCE_DIR="%{buildroot}"/groovy-4.0.16
-Dapache-commons-lang_SOURCE_DIR="%{buildroot}"/commons-lang3-3.14.0
-Dapache-commons-text_SOURCE_DIR="%{buildroot}"/commons-text-1.11.0
-DENABLE_INTERNAL_GTEST=OFF
-DENABLE_INTERNAL_KISSFFT=OFF
-DENABLE_INTERNAL_TINYXML2=OFF
-DENABLE_AIRTUNES=OFF
-DENABLE_DVDCSS=OFF
-DENABLE_PULSEAUDIO=OFF
-DENABLE_PIPEWIRE=OFF
-DENABLE_MYSQLCLIENT=OFF
-DENABLE_MARIADBCLIENT=ON
-DENABLE_GOLD=OFF
-DENABLE_MOLD=OFF
-DENABLE_INTERNAL_FFMPEG=ON
-DFFMPEG_URL="%{SOURCE9}"
-DENABLE_INTERNAL_CEC=OFF
-DENABLE_INTERNAL_NFS=OFF
-DENABLE_INTERNAL_PCRE=OFF
-DENABLE_INTERNAL_TAGLIB=OFF
-DENABLE_OPENGLES=ON
-DENABLE_VAAPI=ON
-DENABLE_VDPAU=OFF
-DUSE_LTO=ON
-DBUILD_SHARED_LIBS=1
-DENABLE_TESTING=OFF
-DENABLE_DEBUGFISSION=OFF

Expected Behavior

Building from source shoud find all java classed and succeed.

Actual Behavior

Building fails:

[  650s] cd "/home/abuild/rpmbuild/BUILD/kodi-21.x.+git.20231211T201719~e62709b37/build/build/swig" && /usr/lib64/jvm/java/bin/java --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.util.regex=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED -cp /home/abuild/rpmbuild/BUILDROOT/kodi-21.x.+git.20231211T201719~e62709b37-62.1.x86_64/groovy-4.0.16/lib/*:/home/abuild/rpmbuild/BUILDROOT/kodi-21.x.+git.20231211T201719~e62709b37-62.1.x86_64/commons-lang3-3.14.0/*:/home/abuild/rpmbuild/BUILDROOT/kodi-21.x.+git.20231211T201719~e62709b37-62.1.x86_64/commons-text-1.11.0/*:/home/abuild/rpmbuild/BUILD/kodi-21.x.+git.20231211T201719~e62709b37/tools/codegenerator:/home/abuild/rpmbuild/BUILD/kodi-21.x.+git.20231211T201719~e62709b37/xbmc/interfaces/swig/../python groovy.ui.GroovyMain /home/abuild/rpmbuild/BUILD/kodi-21.x.+git.20231211T201719~e62709b37/tools/codegenerator/Generator.groovy AddonModuleXbmcwsgi.i.xml /home/abuild/rpmbuild/BUILD/kodi-21.x.+git.20231211T201719~e62709b37/xbmc/interfaces/swig/../python/PythonSwig.cpp.template AddonModuleXbmcwsgi.i.cpp > /dev/null
[  650s] Error: Could not find or load main class groovy.ui.GroovyMain
[  650s] Caused by: java.lang.ClassNotFoundException: groovy.ui.GroovyMain
[  650s] make[2]: *** [build/swig/CMakeFiles/python_binding.dir/build.make:115: build/swig/AddonModuleXbmcwsgi.i.cpp] Error 1
[  650s] make[2]: Leaving directory '/home/abuild/rpmbuild/BUILD/kodi-21.x.+git.20231211T201719~e62709b37/build'
[  650s] make[1]: *** [CMakeFiles/Makefile2:11063: build/swig/CMakeFiles/python_binding.dir/all] Error 2
[  650s] make[1]: *** Waiting for unfinished jobs....
[  650s] make[2]: Entering directory '/home/abuild/rpmbuild/BUILD/kodi-21.x.+git.20231211T201719~e62709b37/build'

To me it seems the classpath is set correctly but nevertheless the groovy classed cannot be found:
-cp /home/abuild/rpmbuild/BUILDROOT/kodi-21.x.+git.20231211T201719~e62709b37-62.1.x86_64/groovy-4.0.16/lib/*:/home/abuild/rpmbuild/BUILDROOT/kodi-21.x.+git.20231211T201719~e62709b37-62.1.x86_64/commons-lang3-3.14.0/*:/home/abuild/rpmbuild/BUILDROOT/kodi-21.x.+git.20231211T201719~e62709b37-62.1.x86_64/commons-text-1.11.0/*

Possible Fix

No idea at the moment.

To Reproduce

Try to build a kosi rpm with sources and spec file from https://build.opensuse.org/package/show/home:Herbster0815:HTPC:Test/kodi

Debuglog

The buildlog can be found here: https://build.opensuse.org/build/home:Herbster0815:HTPC:Test/openSUSE_Tumbleweed/x86_64/kodi/_log

Screenshots

Additional context or screenshots (if appropriate)

Here is some additional context or explanation that might help:

Your Environment

Used Operating system:

  • Android

  • iOS

  • tvOS

  • [x ] Linux

  • macOS

  • Windows

  • Windows UWP

  • Operating system version/name:

  • Kodi version: kodi-21.x.+git.20231211T201719~e62709b37

note: Once the issue is made we require you to update it with new information or Kodi versions should that be required.
Team Kodi will consider your problem report however, we will not make any promises the problem will be solved.

@xbmc-gh-bot xbmc-gh-bot bot added the Triage: Needed (managed by bot!) issue that was just created and needs someone looking at it label Dec 12, 2023
@coffeinflash coffeinflash changed the title [Master] Build fails after https://github.com/xbmc/xbmc/commit/d6bc920e056baad7782f47b86cba85d1336bb134 - Class not found [Master] Build fails after d6bc920e056baad7782f47b86cba85d1336bb134 - Class not found Dec 12, 2023
@fuzzard
Copy link
Contributor

fuzzard commented Dec 12, 2023

No idea sorry. Ive made same folder structure for the groovy/commons extractions, and it doesnt fail locally, cant see build log, dont know how opensuse builders work. Can you actually check the workspace has the folders extracted/located as intended?

@fuzzard
Copy link
Contributor

fuzzard commented Dec 12, 2023

Only way i can get it to fail is to intentionally give an incorrect path to the groovy extraction

[ 97%] Generating AddonModuleXbmcwsgi.i.cpp
cd /Users/brent/Dev/macos/build/build/swig && /Users/Shared/xbmc-depends/arm-darwin23.0.0-native/bin/swig -w401 -c++ -o AddonModuleXbmcwsgi.i.xml -xml -I/Users/brent/Dev/macos/xbmc -xmllang python /Users/brent/Dev/macos/xbmc/interfaces/swig/../swig/AddonModuleXbmcwsgi.i
cd /Users/brent/Dev/macos/build/build/swig && /Library/Java/JavaVirtualMachines/temurin-11.jdk/Contents/Home/bin/java --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.util.regex=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED -cp /Users/brent/Downloads/kodi-21.x.+git.20231211T201719~e62709b37-62.1.x86_64/groovy-4.0.16-2/lib/*:/Users/brent/Downloads/commons-lang3-3.14.0/*:/Users/brent/Downloads/commons-text-1.11.0/*:/Users/brent/Dev/macos/tools/codegenerator:/Users/brent/Dev/macos/xbmc/interfaces/swig/../python groovy.ui.GroovyMain /Users/brent/Dev/macos/tools/codegenerator/Generator.groovy AddonModuleXbmcwsgi.i.xml /Users/brent/Dev/macos/xbmc/interfaces/swig/../python/PythonSwig.cpp.template AddonModuleXbmcwsgi.i.cpp > /dev/null
Error: Could not find or load main class groovy.ui.GroovyMain
Caused by: java.lang.ClassNotFoundException: groovy.ui.GroovyMain
make[2]: *** [build/swig/AddonModuleXbmcwsgi.i.cpp] Error 1

So im guessing your builder isnt packaging/extracting the groovy zip file for whatever reason.

@coffeinflash
Copy link
Author

Yes, you are/were right.
The sources were extracted correctly but it seems cmake does not like the macros, i.e. %buildroot.
I hardcoded the paths and the build was successfull:

-Dgroovy_SOURCE_DIR="/home/abuild/rpmbuild/BUILD/kodi-21.x.+git.20231211T201719~e62709b37/groovy-4.0.16/" \
-Dapache-commons-lang_SOURCE_DIR="/home/abuild/rpmbuild/BUILD/kodi-21.x.+git.20231211T201719~e62709b37/commons-lang3-3.14.0/" \
-Dapache-commons-text_SOURCE_DIR="/home/abuild/rpmbuild/BUILD/kodi-21.x.+git.20231211T201719~e62709b37/commons-text-1.11.0/" \

@coffeinflash
Copy link
Author

So this is no kodi issue.

@samnazarko
Copy link
Contributor

It looks like this is a potential bug with JDK11. I can reproduce this on x86_x64 on Debian Bullseye. Oddly I cannot reproduce this with the same build environment on armv7. Both build environments are identical with the x86_x64 one simply running as a QEMU chroot.

On x86_x64:

/usr/bin/java -cp '../share/groovy/lib/*' groovy.ui.GroovyMain
----_JAVA_LAUNCHER_DEBUG----
Launcher state:
        First application arg index: 4
        debug:on
        javargs:off
        program name:java
        launcher name:openjdk
        javaw:off
        fullversion:11.0.23+9-post-Debian-1deb11u1
Java args:
Command line args:
argv[0] = /usr/bin/java
argv[1] = -cp
argv[2] = ../share/groovy/lib/*
argv[3] = groovy.ui.GroovyMain
JRE path is /usr/lib/jvm/java-11-openjdk-armhf
jvm.cfg[0] = ->-server<-
jvm.cfg[1] = ->-client<-
jvm.cfg[2] = ->-zero<-
2169 micro seconds to parse jvm.cfg
Default VM: server
Does `/usr/lib/jvm/java-11-openjdk-armhf/lib/server/libjvm.so' exist ... yes.
mustsetenv: FALSE
JVM path is /usr/lib/jvm/java-11-openjdk-armhf/lib/server/libjvm.so
30674 micro seconds to LoadJavaVM
Expanded wildcards:
    before: "../share/groovy/lib/*"
    after : "../share/groovy/lib/*"
[9:46](https://teamkodi.slack.com/archives/D01AHBG65GV/p1715373993873389)

On ARMv7:

Expanded wildcards:
    before: "../share/groovy/lib/*"
    after : "../share/groovy/lib/javaparser-core-3.25.6.jar:../share/groovy/lib/ant-junit-1.10.14.jar:../share/groovy/lib/groovy-macro-4.0.16.jar:../share/groovy/lib/hamcrest-core-1.3.jar:../share/groovy/lib/jackson-dataformat-toml-2.16.0.jar:../share/groovy/lib/groovy-console-4.0.16.jar:../share/groovy/lib/jackson-annotations-2.16.0.jar:../share/groovy/lib/groovy-swing-4.0.16.jar:../share/groovy/lib/groovy-jsr223-4.0.16.jar:../share/groovy/lib/groovy-typecheckers-4.0.16.jar:../share/groovy/lib/junit-jupiter-engine-5.10.1.jar:../share/groovy/lib/jansi-2.4.1.jar:../share/groovy/lib/commons-cli-1.6.0.jar:../share/groovy/lib/groovy-groovysh-4.0.16.jar:../share/groovy/lib/groovy-jmx-4.0.16.jar:../share/groovy/lib/groovy-xml-4.0.16.jar:../share/groovy/lib/groovy-cli-commons-4.0.16.jar:../share/groovy/lib/groovy-datetime-4.0.16.jar:../share/groovy/lib/multiverse-core-0.7.0.jar:../share/groovy/lib/xstream-1.4.20.jar:../share/groovy/lib/ant-antlr-1.10.14.jar:../share/groovy/lib/groovy-dateutil-4.0.16.jar:../share/groovy/lib/groovy-json-4.0.16.jar:../share/groovy/lib/testng-7.5.1.jar:../share/groovy/lib/groovy-yaml-4.0.16.jar:../share/groovy/lib/jackson-dataformat-yaml-2.16.0.jar:../share/groovy/lib/opentest4j-1.3.0.jar:../share/groovy/lib/jline-2.14.6.jar:../share/groovy/lib/groovy-templates-4.0.16.jar:../share/groovy/lib/qdox-1.12.1.jar:../share/groovy/lib/jackson-core-2.16.0.jar:../share/groovy/lib/groovy-contracts-4.0.16.jar:../share/groovy/lib/snakeyaml-2.2.jar:../share/groovy/lib/groovy-macro-library-4.0.16.jar:../share/groovy/lib/junit-platform-commons-1.10.1.jar:../share/groovy/lib/junit-platform-launcher-1.10.1.jar:../share/groovy/lib/org.abego.treelayout.core-1.0.3.jar:../share/groovy/lib/groovy-nio-4.0.16.jar:../share/groovy/lib/groovy-test-4.0.16.jar:../share/groovy/lib/groovy-sql-4.0.16.jar:../share/groovy/lib/groovy-testng-4.0.16.jar:../share/groovy/lib/ant-launcher-1.10.14.jar:../share/groovy/lib/groovy-ginq-4.0.16.jar:../share/groovy/lib/junit-4.13.2.jar:../share/groovy/lib/ivy-2.5.2.jar:../share/groovy/lib/groovy-cli-picocli-4.0.16.jar:../share/groovy/lib/jsr166y-1.7.0.jar:../share/groovy/lib/groovy-test-junit5-4.0.16.jar:../share/groovy/lib/slf4j-api-2.0.9.jar:../share/groovy/lib/jcommander-1.78.jar:../share/groovy/lib/groovy-servlet-4.0.16.jar:../share/groovy/lib/groovy-4.0.16.jar:../share/groovy/lib/gpars-1.2.1.jar:../share/groovy/lib/mxparser-1.2.2.jar:../share/groovy/lib/jquery-3.5.1.jar:../share/groovy/lib/groovy-astbuilder-4.0.16.jar:../share/groovy/lib/groovy-groovydoc-4.0.16.jar:../share/groovy/lib/ant-1.10.14.jar:../share/groovy/lib/junit-jupiter-api-5.10.1.jar:../share/groovy/lib/jackson-databind-2.16.0.jar:../share/groovy/lib/groovy-ant-4.0.16.jar:../share/groovy/lib/groovy-toml-4.0.16.jar:../share/groovy/lib/groovy-docgenerator-4.0.16.jar:../share/groovy/lib/junit-platform-engine-1.10.1.jar"

@hbiyik
Copy link

hbiyik commented May 13, 2024

@samnazarko
i reproduced the same error with a twist.
I have 2 containers running both with qemu-user-static, one is armv7hf, the other one is aarch64.

aarch64 runs without issues but, armv7hf is not picking up path spec:
cmd: _JAVA_LAUNCHER_DEBUG=true /usr/bin/java -cp "build/share/groovy/lib/*" groovy.ui.GroovyMain

aarch64 output:

----_JAVA_LAUNCHER_DEBUG----
Launcher state:
	First application arg index: 4
	debug:on
	javargs:off
	program name:java
	launcher name:openjdk
	javaw:off
	fullversion:17.0.11+9
Java args:
Command line args:
argv[0] = /usr/bin/java
argv[1] = -cp
argv[2] = build/share/groovy/lib/*
argv[3] = groovy.ui.GroovyMain
JRE path is /usr/lib/jvm/java-17-openjdk
jvm.cfg[0] = ->-server<-
jvm.cfg[1] = ->-client<-
1721 micro seconds to parse jvm.cfg
Default VM: server
Does `/usr/lib/jvm/java-17-openjdk/lib/server/libjvm.so' exist ... yes.
mustsetenv: FALSE
JVM path is /usr/lib/jvm/java-17-openjdk/lib/server/libjvm.so
39230 micro seconds to LoadJavaVM
Expanded wildcards:
    before: "build/share/groovy/lib/*"
    after : "build/share/groovy/lib/junit-4.13.2.jar:build/share/groovy/lib/groovy-4.0.16.jar:build/share/groovy/lib/commons-cli-1.6.0.jar:build/share/groovy/lib/multiverse-core-0.7.0.jar:build/share/groovy/lib/groovy-contracts-4.0.16.jar:build/share/groovy/lib/groovy-astbuilder-4.0.16.jar:build/share/groovy/lib/groovy-toml-4.0.16.jar:build/share/groovy/lib/groovy-console-4.0.16.jar:build/share/groovy/lib/groovy-test-4.0.16.jar:build/share/groovy/lib/groovy-ant-4.0.16.jar:build/share/groovy/lib/jackson-dataformat-yaml-2.16.0.jar:build/share/groovy/lib/ant-junit-1.10.14.jar:build/share/groovy/lib/groovy-sql-4.0.16.jar:build/share/groovy/lib/snakeyaml-2.2.jar:build/share/groovy/lib/groovy-yaml-4.0.16.jar:build/share/groovy/lib/junit-jupiter-engine-5.10.1.jar:build/share/groovy/lib/mxparser-1.2.2.jar:build/share/groovy/lib/junit-platform-commons-1.10.1.jar:build/share/groovy/lib/jackson-core-2.16.0.jar:build/share/groovy/lib/groovy-test-junit5-4.0.16.jar:build/share/groovy/lib/testng-7.5.1.jar:build/share/groovy/lib/jcommander-1.78.jar:build/share/groovy/lib/org.abego.treelayout.core-1.0.3.jar:build/share/groovy/lib/ant-1.10.14.jar:build/share/groovy/lib/groovy-jsr223-4.0.16.jar:build/share/groovy/lib/groovy-docgenerator-4.0.16.jar:build/share/groovy/lib/groovy-ginq-4.0.16.jar:build/share/groovy/lib/groovy-dateutil-4.0.16.jar:build/share/groovy/lib/opentest4j-1.3.0.jar:build/share/groovy/lib/ivy-2.5.2.jar:build/share/groovy/lib/jackson-databind-2.16.0.jar:build/share/groovy/lib/ant-launcher-1.10.14.jar:build/share/groovy/lib/groovy-groovydoc-4.0.16.jar:build/share/groovy/lib/junit-platform-launcher-1.10.1.jar:build/share/groovy/lib/groovy-json-4.0.16.jar:build/share/groovy/lib/groovy-typecheckers-4.0.16.jar:build/share/groovy/lib/jsr166y-1.7.0.jar:build/share/groovy/lib/groovy-xml-4.0.16.jar:build/share/groovy/lib/jansi-2.4.1.jar:build/share/groovy/lib/groovy-cli-commons-4.0.16.jar:build/share/groovy/lib/groovy-datetime-4.0.16.jar:build/share/groovy/lib/groovy-jmx-4.0.16.jar:build/share/groovy/lib/groovy-servlet-4.0.16.jar:build/share/groovy/lib/xstream-1.4.20.jar:build/share/groovy/lib/jackson-dataformat-toml-2.16.0.jar:build/share/groovy/lib/jquery-3.5.1.jar:build/share/groovy/lib/groovy-swing-4.0.16.jar:build/share/groovy/lib/junit-platform-engine-1.10.1.jar:build/share/groovy/lib/groovy-nio-4.0.16.jar:build/share/groovy/lib/groovy-macro-4.0.16.jar:build/share/groovy/lib/groovy-templates-4.0.16.jar:build/share/groovy/lib/groovy-macro-library-4.0.16.jar:build/share/groovy/lib/junit-jupiter-api-5.10.1.jar:build/share/groovy/lib/ant-antlr-1.10.14.jar:build/share/groovy/lib/slf4j-api-2.0.9.jar:build/share/groovy/lib/gpars-1.2.1.jar:build/share/groovy/lib/groovy-groovysh-4.0.16.jar:build/share/groovy/lib/javaparser-core-3.25.6.jar:build/share/groovy/lib/jline-2.14.6.jar:build/share/groovy/lib/qdox-1.12.1.jar:build/share/groovy/lib/groovy-cli-picocli-4.0.16.jar:build/share/groovy/lib/groovy-testng-4.0.16.jar:build/share/groovy/lib/hamcrest-core-1.3.jar:build/share/groovy/lib/jackson-annotations-2.16.0.jar"

armv7f:

----_JAVA_LAUNCHER_DEBUG----
Launcher state:
	First application arg index: 4
	debug:on
	javargs:off
	program name:java
	launcher name:openjdk
	javaw:off
	fullversion:21.0.2+13
Java args:
Command line args:
argv[0] = /usr/bin/java
argv[1] = -cp
argv[2] = /home/boogie/.agr/packages/boogie/kodi-mpp-git/src/kodi-build/build/share/groovy/lib/*
argv[3] = groovy.ui.GroovyMain
JRE path is /usr/lib/jvm/java-21-openjdk
jvm.cfg[0] = ->-server<-
jvm.cfg[1] = ->-client<-
1596 micro seconds to parse jvm.cfg
Default VM: server
Does `/usr/lib/jvm/java-21-openjdk/lib/server/libjvm.so' exist ... yes.
mustsetenv: FALSE
JVM path is /usr/lib/jvm/java-21-openjdk/lib/server/libjvm.so
24576 micro seconds to LoadJavaVM
Expanded wildcards:
    before: "/home/boogie/.agr/packages/boogie/kodi-mpp-git/src/kodi-build/build/share/groovy/lib/*"
    after : "/home/boogie/.agr/packages/boogie/kodi-mpp-git/src/kodi-build/build/share/groovy/lib/*"
JavaVM args:
    version 0x00010002, ignoreUnrecognized is JNI_FALSE, nOptions is 4
    option[ 0] = '-Dsun.java.launcher.diag=true'
    option[ 1] = '-Djava.class.path=/home/boogie/.agr/packages/boogie/kodi-mpp-git/src/kodi-build/build/share/groovy/lib/*'
    option[ 2] = '-Dsun.java.command=groovy.ui.GroovyMain'
    option[ 3] = '-Dsun.java.launcher=SUN_STANDARD'
382295 micro seconds to InitializeJVM
Main class is 'groovy.ui.GroovyMain'
App's argc is 0
Error: Could not find or load main class groovy.ui.GroovyMain
Caused by: java.lang.ClassNotFoundException: groovy.ui.GroovyMain
java.lang.ClassNotFoundException: groovy.ui.GroovyMain
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:534)
	at java.base/java.lang.Class.forName(Class.java:513)
	at java.base/sun.launcher.LauncherHelper.loadMainClass(LauncherHelper.java:797)
	at java.base/sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:692)

tested with jre17,21,22 openjdk and started to think this is more an issue of qemu side.

my elf configs for qemu:

armv7h:
:qemu-arm:M::\\x7fELF\\x01\\x01\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x02\\x00\\x28\\x00:\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\xfe\\xff\\xff\\xff:/usr/bin/qemu-arm-static:FPC

aarhc64:
:qemu-aarch64:M::\\x7fELF\\x02\\x01\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x02\\x00\\xb7\\x00:\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\x00\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xfe\\xff\\xff\\xff:/usr/bin/qemu-aarch64-static:FPC\n

could you find a solution?

@samnazarko
Copy link
Contributor

samnazarko commented May 13, 2024 via email

@hbiyik
Copy link

hbiyik commented May 13, 2024

@samnazarko
the rootfs in container is archlinux arm.
host is archlinux.

@samnazarko
Copy link
Contributor

samnazarko commented May 13, 2024 via email

@hbiyik
Copy link

hbiyik commented May 13, 2024

@samnazarko

thanks for the tips, i think i made a progress...

i copied jars to /tmp (tempfs) folder, it works from there.

the original path which does not work was an overlay mounted path

overlay on /home type overlay (rw,relatime,lowerdir=/home/boogie/.agr/containers/alarm-armv7h/alarm-armv7h/home,upperdir=/home/boogie/.agr/containers/alarm-armv7h/overlays/home,workdir=/home/boogie/.agr/containers/alarm-armv7h/overlays/.#homecfe90636e6c3f273,index=off,xino=off)

so something seems to be fishy there.

@hbiyik
Copy link

hbiyik commented May 13, 2024

btw i am using systemd-nspawn if it would matter, and somehow i am now suspucious about those inodes things. purely speculative though.

@samnazarko
Copy link
Contributor

samnazarko commented May 13, 2024 via email

@hbiyik
Copy link

hbiyik commented May 14, 2024

Here is summary of my investigation:

The issue is triggered when java is used in containerized environment.
When the container tool mounts/binds ext4 fs directly or with an overlayfs, the wildcard used in CLASSPATH (-cp) of java is not processing all the files pointed. This seems to happen only when host and the contaniner has different architecture (ie: 32 vs 64). So not every containerized env has this issue.

Workarounds:
For overlays fs, giving an option xino=on prevents this happening, for systemd-nspawn, --bind argument does mount with xino=off, therefore i could not find a way to modify this.

For ext4 mounting to container, i could not find a workaround.

General workaround in Kodi Buildsystem is to point directly to jar files instead of using wildcards.

here is a patch

diff --git a/xbmc/interfaces/swig/CMakeLists.txt b/xbmc/interfaces/swig/CMakeLists.txt
index 0d0cadc..60e5739 100644
--- a/xbmc/interfaces/swig/CMakeLists.txt
+++ b/xbmc/interfaces/swig/CMakeLists.txt
@@ -1,7 +1,9 @@
 function(generate_file file)
-  set(classpath ${groovy_SOURCE_DIR}/lib/*
-                ${apache-commons-lang_SOURCE_DIR}/*
-                ${apache-commons-text_SOURCE_DIR}/*
+  set(classpath ${groovy_SOURCE_DIR}/lib/groovy-${GROOVY_VER}.jar
+                ${groovy_SOURCE_DIR}/lib/groovy-xml-${GROOVY_VER}.jar
+                ${groovy_SOURCE_DIR}/lib/groovy-templates-${GROOVY_VER}.jar
+                ${apache-commons-lang_SOURCE_DIR}/commons-lang3-${APACHE_COMMONS_LANG_VER}.jar
+                ${apache-commons-text_SOURCE_DIR}/commons-text-${APACHE_COMMONS_TEXT_VER}.jar
                 ${CMAKE_SOURCE_DIR}/tools/codegenerator
                 ${CMAKE_CURRENT_SOURCE_DIR}/../python)
   if(NOT CORE_SYSTEM_NAME STREQUAL windows AND NOT CORE_SYSTEM_NAME STREQUAL windowsstore)

@fuzzard @samnazarko do you think above patch makes sense to PR, this is how it was working before commit d6bc920

Regardless of my findings above i have seen other complaints that openjdk can not find jar files when wildcards are used, so may be having the patch is a little bit more defensive to future whatever problem...

@samnazarko
Copy link
Contributor

Thanks for investigating.

Yes -- I suspected an architecture mismatch would be the cause of this problem; and it explains why building on an ARM system doesn't exhibit these symptoms.

I think the proposed change is acceptable and worthy of a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Triage: Needed (managed by bot!) issue that was just created and needs someone looking at it
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants