eclipsesource / J2V8

Java Bindings for V8
2.54k stars 355 forks source link

Support for MacOS (Apple Silicon, M1) architecture (j2v8_macosx_armv7l). #556

Open alexvfrolov opened 3 years ago

alexvfrolov commented 3 years ago

Hi,

In our JVM-based project, we are using the J2V8 library. Here are the Maven dependencies we are using:

            <dependency>
                <groupId>com.eclipsesource.j2v8</groupId>
                <artifactId>j2v8_linux_x86_64</artifactId>
                <version>4.6.0</version>
            </dependency>
            <dependency>
                <groupId>com.eclipsesource.j2v8</groupId>
                <artifactId>j2v8_win32_x86_64</artifactId>
                <version>4.6.0</version>
            </dependency>
            <dependency>
                <groupId>com.eclipsesource.j2v8</groupId>
                <artifactId>j2v8_macosx_x86_64</artifactId>
                <version>4.6.0</version>
            </dependency>

But since Apple build its new MacBooks on the M1 chips, we faced the problem in developing the application.

Caused by: java.lang.IllegalStateException: J2V8 native library not loaded
Caused by: java.lang.UnsatisfiedLinkError: 
Could not load J2V8 library. Reasons: 
    no j2v8_macosx_armv7l in java.library.path

Are there any plans to provide builds for this architecture, or is it possible to build the library on such a machine? We can do build for our own, but we need help with how to do this.

Thanks.

ahmadov commented 3 years ago

Hello @alexvfrolov, since we dropped the support for macOS, J2V8 does not provide a build for macOS but of course, you can build the J2V8 on your machine for macOS. I did some experiments on how we can enable it for macOS again. Please refer that branch to see what should be done: https://github.com/eclipsesource/J2V8/tree/macos_build

CodeMokee commented 1 year ago

There is a workaround for the m1 j2v8, as we know, apple has Rosetta to run the apps build for x64 intel chip, we can use the x64 version JDK and let it run with Rosetta 2 to emulate the x64 to run the java program in M1 series chip to address this issue.

ronamir1 commented 1 year ago

There is a workaround for the m1 j2v8, as we know, apple has Rosetta to run the apps build for x64 intel chip, we can use the x64 version JDK and let it run with Rosetta 2 to emulate the x64 to run the java program in M1 series chip to address this issue.

Can you elaborate, I’ve installed Rosetta but still get this error.

CodeMokee commented 1 year ago

@ronamir1 do you have replace the JDK to a x64 version? for example:

image

As shown in the picture, the jdk with aarch64 suffix is for apple chip, and the other for intel x64, you should download a x64 jdk and keep sure your codes running on it.