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

Work around libgmdjni64.dylib not compatible with arm64 architecture on macOS #531

Closed
ravitby opened this issue May 21, 2024 · 3 comments · Fixed by #532
Closed

Work around libgmdjni64.dylib not compatible with arm64 architecture on macOS #531

ravitby opened this issue May 21, 2024 · 3 comments · Fixed by #532
Assignees
Labels
backend.jdbc Interaction with ixmp_source via JDBCBackend & JPype

Comments

@ravitby
Copy link

ravitby commented May 21, 2024

Installing Gams on the arm64 version reproducing the following error.
The issue is related to the closed issue #473

java.lang.UnsatisfiedLinkError: java.lang.UnsatisfiedLinkError: 
/Users/ravitb/Workspace/TAU/ilTransport/ixmp/ixmp/backend/jdbc/libgmdjni64.dylib: 
dlopen(/Users/ravitb/Workspace/TAU/ilTransport/ixmp/ixmp/backend/jdbc/libgmdjni64.dylib, 0x0001): tried: 
'/Users/ravitb/Workspace/TAU/ilTransport/ixmp/ixmp/backend/jdbc/libgmdjni64.dylib' (mach-o file, but is an incompatible 
architecture (have 'x86_64', need 'arm64')), 
'/System/Volumes/Preboot/Cryptexes/OS/Users/ravitb/Workspace/TAU/ilTransport/ixmp/ixmp/backend/jdbc/libgmdjni64.dylib' (no
such file), '/Users/ravitb/Workspace/TAU/ilTransport/ixmp/ixmp/backend/jdbc/libgmdjni64.dylib' (mach-o file, but is an 
incompatible architecture (have 'x86_64', need 'arm64'))

I wrote to Gams support and they suggested to replace the libgmdjni64.dylib dll file from the installation Gams path:

/Library/Frameworks/GAMS.framework/Versions/Current/Resources/apifiles/Java/api/libgmdjni64.dylib

to the ixmp path as follows:

Path to ixmp/ixmp/backend/jdbc/libgmdjni64.dylib
@khaeru
Copy link
Member

khaeru commented May 22, 2024

Thanks! This is indeed a simpler work-around than previously devised.

It may be possible to automatically achieve this for users, but I am not sure how. Some ideas include:

  1. Build and publish different 'wheels' for the different macOS architectures: for x86_64, including the current file, and for arm64 including instead the other file.

  2. Package two files with names like:

    • libgmdjni64-x86_64.dylib
    • libgmdjni64-amd64.dylib

    …and depend on Java picking up the correct one. I am not sure if this would work.

  3. Put files with the correct names in separate directories, and selectively add one or the other to the Java CLASSPATH when starting the JVM:

    ixmp/ixmp/backend/jdbc.py

    Lines 1244 to 1252 in f08447f

    # Keyword arguments
    kwargs = dict(
    # Glob pattern for ixmp.jar and related Java binaries
    classpath=str(Path(__file__).parent.joinpath("jdbc", "*")),
    # For JPype 0.7 (raises a warning) and 0.8 (default is False). 'True' causes
    # Java string objects to be converted automatically to Python str(), as expected
    # by ixmp Python code.
    convertStrings=True,
    )

@khaeru khaeru added the backend.jdbc Interaction with ixmp_source via JDBCBackend & JPype label May 22, 2024
@khaeru khaeru changed the title Solved - Gams studio ixmp incompatible with arm64 architecture Work around libgmdjni64.dylib not compatible with arm64 architecture on macOS May 22, 2024
@khaeru
Copy link
Member

khaeru commented May 22, 2024

@ravitby could you please give the result of the following on your system?

import platform
print(platform.processor(), platform.uname()

This could help develop a solution per (3) above.

@ravitby
Copy link
Author

ravitby commented May 22, 2024

This is the results of the print:

print(platform.processor(), platform.uname())
arm uname_result(system='Darwin', node='Ravits-MacBook-Pro.local', release='23.2.0', version='Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:18 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6000', machine='arm64')

@khaeru khaeru self-assigned this May 23, 2024
@khaeru khaeru linked a pull request Jul 8, 2024 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend.jdbc Interaction with ixmp_source via JDBCBackend & JPype
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants