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

No native library found for os.name=Linux, os.arch=aarch64 #474

Closed
lanmaoxinqing opened this issue Sep 9, 2021 · 8 comments
Closed

No native library found for os.name=Linux, os.arch=aarch64 #474

lanmaoxinqing opened this issue Sep 9, 2021 · 8 comments
Milestone

Comments

@lanmaoxinqing
Copy link
Contributor

The os.arch system variable may be aarch64 in some linux arm64 machines like below and OSInfo.java in native module doesn't recognize it.

$ uname -a
Linux xxx xxx.aarch64 #1 SMP Fri Aug 9 04:09:13 UTC 2019 aarch64 aarch64 aarch64 GNU/Linux

I will submit a PR for this later if it's necessary to compatible with this situation.

lanmaoxinqing added a commit to lanmaoxinqing/mvnd that referenced this issue Sep 9, 2021
lanmaoxinqing added a commit to lanmaoxinqing/mvnd that referenced this issue Sep 9, 2021
@lanmaoxinqing
Copy link
Contributor Author

It seems that org.fusesource.jansi:jansi:2.3.2 which we dependent on also uses OSInfo.java and has the same question, So this PR can not cannot actually work until we release a newer jansi version with aarch64 support.

    public static String getArchName() {
        String osArch = System.getProperty("os.arch");
        // For Android
        if (isAndroid()) {
            return "android-arm";
        }

        if (osArch.startsWith("arm")) {    //  <-- linux arch named `aarch64` can not go into this
            osArch = resolveArmArchType();
        } else {
            String lc = osArch.toLowerCase(Locale.US);
            if (archMapping.containsKey(lc))
                return archMapping.get(lc);
        }
        return translateArchNameToFolderName(osArch);
    }

https://github.com/fusesource/jansi/blob/master/src/main/java/org/fusesource/jansi/internal/OSInfo.java#L185

@martin-g
Copy link
Member

I was able to workaround the issue by doing:

cp -r ./native/src/main/resources/org/mvndaemon/mvnd/nativ/Linux/arm64 ./native/src/main/resources/org/mvndaemon/mvnd/nativ/Linux/aarch64

@martin-g
Copy link
Member

martin-g commented Oct 12, 2021

The next error is:

[INFO] Maven Daemon - Common .............................. SUCCESS [ 17.811 s]
[INFO] Maven Daemon - Client .............................. FAILURE [ 17.354 s]
[INFO] Maven Daemon ....................................... SKIPPED
[INFO] Maven Daemon - IPC Sync Context .................... SKIPPED
[INFO] Maven Daemon - Distribution ........................ SKIPPED
[INFO] Maven Daemon - Integration Tests ................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  43.941 s
[INFO] Finished at: 2021-10-12T09:24:39+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.graalvm.nativeimage:native-image-maven-plugin:20.3.2:native-image (default) on project mvnd-client: Could not find executable native-image in /home/ubuntu/devel/jdk-11/jre/lib/svm/bin/native-image -> [Help 1]
[ERROR] 

For some reason it tries to find native-image in my JDK 11 installation. I had to export JAVA_HOME to point to GRAALVM_HOME to overcome this one.

Update: Apologies! This is mentioned in the README!

@martin-g
Copy link
Member

martin-g commented Oct 12, 2021

As mentioned by @lanmaoxinqing the last problem is in Jansi library:

Caused by: java.lang.Exception: No native library found for os.name=Linux, os.arch=aarch64, paths=[]
	at org.fusesource.jansi.internal.JansiLoader.loadJansiNativeLibrary(JansiLoader.java:333)
	at org.fusesource.jansi.internal.JansiLoader.initialize(JansiLoader.java:60)
	... 4 more
--- stderr+stdout end ---
[INFO] 
[ERROR] Tests run: 12, Failures: 10, Errors: 0, Skipped: 0
[INFO] 
[INFO] 
[INFO] --- mrm-maven-plugin:1.2.0:stop (mrm-stop) @ mvnd-integration-tests ---
[INFO] Mock Repository Manager was not started
[INFO] 
[INFO] --- maven-failsafe-plugin:3.0.0-M5:verify (default) @ mvnd-integration-tests ---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Maven Daemon - Parent 0.6.1-SNAPSHOT:
[INFO] 
[INFO] Maven Daemon - Parent .............................. SUCCESS [  3.277 s]
[INFO] Maven Daemon - Documentation Maven Plugin .......... SUCCESS [  4.446 s]
[INFO] Maven Daemon - Native Library ...................... SUCCESS [  2.446 s]
[INFO] Maven Daemon - Agent ............................... SUCCESS [  0.471 s]
[INFO] Maven Daemon - Helper Agent ........................ SUCCESS [  0.157 s]
[INFO] Maven Daemon - Common .............................. SUCCESS [  8.137 s]
[INFO] Maven Daemon - Client .............................. SUCCESS [ 56.741 s]
[INFO] Maven Daemon ....................................... SUCCESS [  8.553 s]
[INFO] Maven Daemon - IPC Sync Context .................... SUCCESS [ 41.232 s]
[INFO] Maven Daemon - Distribution ........................ SUCCESS [ 13.082 s]
[INFO] Maven Daemon - Integration Tests ................... FAILURE [04:24 min]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  06:42 min
[INFO] Finished at: 2021-10-12T09:35:47+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:3.0.0-M5:verify (default) on project mvnd-integration-tests: There are test failures.
[ERROR] 

Fixed by @lanmaoxinqing with fusesource/jansi#219

@gnodet
Copy link
Contributor

gnodet commented Oct 12, 2021

I'm working on jansi these days. There's one issue remaining which is Apple/M1 support which I'd like to get in before releasing it.

@martin-g
Copy link
Member

I was able to build mvnd locally but the README does not explain how to package it properly to make use of it.
I've copied the binary to $PATH:

cp client/target/mvnd ~/bin/

but then trying to use it fails with:

Exception in thread "main" java.lang.IllegalStateException: Could not get value for Environment.MVND_HOME from any of the following sources: value: mvnd.home, path relative to the mvnd executable, system property mvnd.home, environment variable MVND_HOME, property mvnd.home in /home/ubuntu/devel/mvnd/.mvn/mvnd.properties, property mvnd.home in /home/ubuntu/.m2/mvnd.properties
	at org.mvndaemon.mvnd.client.DaemonParameters$EnvValue.couldNotgetValue(DaemonParameters.java:592)
	at org.mvndaemon.mvnd.client.DaemonParameters$EnvValue.lambda$orFail$8(DaemonParameters.java:569)
	at org.mvndaemon.mvnd.client.DaemonParameters$EnvValue.get(DaemonParameters.java:602)
	at org.mvndaemon.mvnd.client.DaemonParameters$EnvValue.asPath(DaemonParameters.java:625)
	at org.mvndaemon.mvnd.client.DaemonParameters.mvndHome(DaemonParameters.java:112)
	at org.mvndaemon.mvnd.client.DaemonParameters.globalPropertiesPath(DaemonParameters.java:184)
	at org.mvndaemon.mvnd.client.DaemonParameters.property(DaemonParameters.java:367)
	at org.mvndaemon.mvnd.client.DaemonParameters.noBuffering(DaemonParameters.java:330)
	at org.mvndaemon.mvnd.client.DefaultClient.main(DefaultClient.java:114)

I need to copy some more files and folders next to it to make it look like the archives in GitHub releases.

@gnodet
Copy link
Contributor

gnodet commented Oct 12, 2021

@martin-g I've added some infos at https://github.com/mvndaemon/mvnd#install-mvnd, let me know if this is sufficient.

@martin-g
Copy link
Member

Confirmed! Everything works now!
Thank you, @lanmaoxinqing & @gnodet !

@gnodet gnodet added this to the 0.6.1 milestone Oct 19, 2021
@gnodet gnodet closed this as completed Oct 19, 2021
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

No branches or pull requests

3 participants