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

Can't create isolate on Macos Sonoma 14.3.1 #8843

Open
dzeraRhoades opened this issue Apr 26, 2024 · 13 comments
Open

Can't create isolate on Macos Sonoma 14.3.1 #8843

dzeraRhoades opened this issue Apr 26, 2024 · 13 comments
Assignees

Comments

@dzeraRhoades
Copy link

I'm using a shared library, built with graalVm 17 with following params:
--no-fallback
--shared
-O0
-H:-CheckToolchain
-H:DynamicProxyConfigurationResources=...
-H:ReflectionConfigurationResources=...
-H:+TraceNativeToolUsage

This is how i'm creating isolate:
graal_isolatethread_t* isolateThread = NULL;
graal_create_isolate_fn_t createIsolateFuncPtr = (graal_create_isolate_fn_t)loadFuncPtr("graal_create_isolate", handle);
int graalInitCode = createIsolateFuncPtr(NULL, NULL, &isolateThread);
But createIsolateFuncPtr returns 23.

On windows, linux and Macos Ventura 13.6.1 works fine

@selhagani
Copy link
Member

Hi @dzeraRhoades, Thank you for reaching out to us regarding the issue you're experiencing with GraalVM. In order to assist you effectively, could you please provide us with a concise reproducer for the problem you're encountering?

Additionally, it would be helpful for us to know which version of GraalVM you're currently using, as well as the architecture of your system.

@selhagani selhagani self-assigned this Apr 26, 2024
@dzeraRhoades
Copy link
Author

dzeraRhoades commented May 2, 2024

Hi, sorry for late answer, couldn't answer earlier.
Dll is built with Oracle GraalVM 22.0.1+8.1 (build 22.0.1+8 jvmci-b01)
System, on which the error occures: Darwin Kernel Version 23.3.0: Wed Dec 20 21:31:00 PST 2023; RELEASE_ARM64_T6020 arm64
Steps to reproduce the problem:

  1. With graalvm native image tool generate dll, using params, I v mentioned in previous comment (on another system, which architecture I don't know, probably x64)
  2. Try to use this dll like this:
    void* handle = dlopen(invLib, RTLD_GLOBAL | RTLD_NOW);
    if (handle == NULL) {
    return;
    }
    graal_isolatethread_t* isolateThread = NULL;
    graal_create_isolate_fn_t createIsolateFuncPtr = (graal_create_isolate_fn_t)loadFuncPtr("graal_create_isolate", handle);
    int graalInitCode = createIsolateFuncPtr(NULL, NULL, &isolateThread);
    _ASSERT(graalInitCode == 0, "error occured while creating isolate\n");

@dzeraRhoades
Copy link
Author

I believe the error may occur because shared library is built with graalvm for x64 but is used on aarch64 system. Can that be the reason?

@selhagani
Copy link
Member

Absolutely, that could indeed be the case. It's quite possible that the error stems from using a shared library built with GraalVM for x64 architecture on an aarch64 system. Architecture mismatches like this can often lead to compatibility issues.

@codewithakamathb
Copy link

@dzeraRhoades Do you have sample project which I can refer in Objective C or Swift how you have consumed shared library.It would be great help for me.I am trying to do same in Mac application.

@selhagani
Copy link
Member

@codewithakamathb Have you had a chance to take a look at this documentation ? It could offer some valuable insights for your task.

@k4kranti
Copy link

Issue with Macos Sonoma 14.4.1 with graalvm-jdk-22.0 installation.

I use brew install --cask graalvm-jdk for installation, is there any security settings need to be updated?

Screenshot 2024-05-13 at 4 18 40 PM

@dzeraRhoades
Copy link
Author

@codewithakamathb do you still need a sample?

@dzeraRhoades
Copy link
Author

@k4kranti i ve had the same problem and solved it by manually installing the jdk without brew

@dzeraRhoades
Copy link
Author

@selhagani Thanks for reply! I have tried to build my dylib and executable with GraalVM for aarch64 and it solved the problem! But, in my case, the dylib should be built on server with Macos x64 (not locally). Is there a workaround to get rid of this problem on arm?

@codewithakamathb
Copy link

@dzeraRhoades a small POC how did you consume the shared native image .a file in Objective C. Simple example should be done

@dzeraRhoades
Copy link
Author

@codewithakamathb I ve pasted some code in my first comment. Unfortunately, i cannot add anything else, cause the project is private. I use it in C++ code, by the way.
Shared library on MacOS is .dylib file (u can use .so too, but .dylib is a better option).

@codewithakamathb
Copy link

I need a code for invoking Native Image shared dll method via Objective C.A simple Add method also should do the job

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

No branches or pull requests

4 participants