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

Build issue in terminal-ffm on Ubuntu 20.04 #911

Closed
dattasid opened this issue Dec 8, 2023 · 14 comments
Closed

Build issue in terminal-ffm on Ubuntu 20.04 #911

dattasid opened this issue Dec 8, 2023 · 14 comments
Milestone

Comments

@dattasid
Copy link
Contributor

dattasid commented Dec 8, 2023

I am seeing the following error when trying to build a freshly downloaded 3.24.1 source. What could be the issue?

JAVA_HOME set to JDK 21
PATH has $JAVA_HOME/bin as first element.

[ERROR] Tests run: 3, Failures: 0, Errors: 2, Skipped: 1, Time elapsed: 0.179 s <<< FAILURE! -- in org.jline.terminal.impl.ffm.FfmTest
[ERROR] org.jline.terminal.impl.ffm.FfmTest.testNewTerminalWithNull -- Time elapsed: 0.142 s <<< ERROR!
java.lang.ExceptionInInitializerError
	at org.jline.terminal.impl.ffm.FfmTerminalProvider.newTerminal(FfmTerminalProvider.java:83)
	at org.jline.terminal.impl.ffm.FfmTest.testNewTerminalWithNull(FfmTest.java:30)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
Caused by: java.util.NoSuchElementException: No value present
	at java.base/java.util.Optional.get(Optional.java:143)
	at org.jline.terminal.impl.ffm.CLibrary.<clinit>(CLibrary.java:398)
	... 5 more

[ERROR] org.jline.terminal.impl.ffm.FfmTest.testNewTerminalNoNull -- Time elapsed: 0.007 s <<< ERROR!
java.lang.NoClassDefFoundError: Could not initialize class org.jline.terminal.impl.ffm.CLibrary
	at org.jline.terminal.impl.ffm.FfmTerminalProvider.newTerminal(FfmTerminalProvider.java:83)
	at org.jline.terminal.impl.ffm.FfmTest.testNewTerminalNoNull(FfmTest.java:47)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
Caused by: java.lang.ExceptionInInitializerError: Exception java.util.NoSuchElementException: No value present [in thread "main"]
	at java.base/java.util.Optional.get(Optional.java:143)

System:
Linux HOSTNAME 5.4.17-<blah>.x86_64 #2 SMP DATE x86_64 x86_64 x86_64 GNU/Linux

$ java -version
openjdk version "21.0.1" 2023-10-17
OpenJDK Runtime Environment (build 21.0.1+12-29)
OpenJDK 64-Bit Server VM (build 21.0.1+12-29, mixed mode, sharing)
@gnodet
Copy link
Member

gnodet commented Dec 8, 2023

This looks like the same problem with openpty method not being linked, see #896.

@dattasid
Copy link
Contributor Author

dattasid commented Dec 9, 2023

This looks like the same problem with openpty method not being linked, see #896.

Is this currently a open issue? I only want to build the basic pure-java JLine, dont need the JNI or any native stuff. Is there a way to just build that via the build script ?

@dattasid dattasid closed this as completed Dec 9, 2023
@dattasid
Copy link
Contributor Author

dattasid commented Dec 9, 2023

Closed by mistake, clicked wrong button.

@dattasid dattasid reopened this Dec 9, 2023
@gnodet
Copy link
Member

gnodet commented Dec 10, 2023

This looks like the same problem with openpty method not being linked, see #896.

Is this currently a open issue? I only want to build the basic pure-java JLine, dont need the JNI or any native stuff. Is there a way to just build that via the build script ?

mvn package -DskipTests ?

@dattasid
Copy link
Contributor Author

@gnodet Excuse my ignorance, what is FFM ?

@gnodet
Copy link
Member

gnodet commented Dec 13, 2023

@dattasid
Copy link
Contributor Author

I tested and the following fixes the issue:

    System.loadLibrary("util");
    SymbolLookup libld = SymbolLookup.loaderLookup();
    libld = libld.or(linker.defaultLookup());
    ...
    libld.find("openpty").get(),

@gnodet
Copy link
Member

gnodet commented Dec 18, 2023

I've tried to reproduce the build problem on two VMs I have without any success... :-(
Linux HOSTNAME 5.19.6-100.fc35.x86_64 #1 SMP PREEMPT_DYNAMIC DATE x86_64 x86_64 x86_64 GNU/Linux
and
Linux HOSTNAME 6.1.10-100.fc36.aarch64 #1 SMP PREEMPT_DYNAMIC DATE aarch64 aarch64 aarch64 GNU/Linux

@cstamas
Copy link
Contributor

cstamas commented Dec 18, 2023

@dattasid what OS/distro you are on?

@cstamas
Copy link
Contributor

cstamas commented Dec 18, 2023

Cannot reproduce on
Linux HOSTNAME 6.6.6-200.fc39.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Dec 11 17:29:08 UTC 2023 x86_64 GNU/Linux

@mattirn
Copy link
Collaborator

mattirn commented Dec 18, 2023

I have reproduced on

% uname -a
Linux HOSTNAME 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
 % lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.6 LTS
Release:	20.04
Codename:	focal

@gnodet
Copy link
Member

gnodet commented Dec 18, 2023

I have reproduced on

% uname -a
Linux HOSTNAME 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
% lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.6 LTS
Release:	20.04
Codename:	focal

I've been able to reproduce it on Ubuntu 20.04 VM...

@dattasid
Copy link
Contributor Author

I saw the issue on Oracle Linux 5.4.17-2136.318.7.1.el8uek.x86_64 .

@gnodet
Copy link
Member

gnodet commented Dec 22, 2023

I have a fix for the FFM provider (see #918), however the exact same problem happen for Jansi et JNI provider (see #896) and things are a bit different, as those use a JNI library. A workaround for those it to define the environment variable LD_PRELOAD=/lib/aarch64-linux-gnu/libutil.so.1 or LD_PRELOAD=/lib/x86_64-linux-gnu/libutil.so.1 on Ubuntu 20.04.

I'm not sure why there's no libutil.so as the JVM is not able to load the library with System.loadLibrary() because the name is libutil.so.1 ...

gnodet added a commit to gnodet/jline3 that referenced this issue Dec 22, 2023
@gnodet gnodet closed this as completed in 0365a9c Dec 22, 2023
@gnodet gnodet added this to the 3.25.0 milestone Dec 22, 2023
@gnodet gnodet changed the title Need help with JLine 3.24 build issue Build issue in terminal-ffm on Ubuntu 20.04 Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants