Support for arm64 Mac silicon
Closed this issue · 5 comments
I attempted to validate my default file using CLI but encountered an error regarding arm64 architecture.
Error Trace:
WARNING: Not able to assign machine() = arm64 to a cpu value!
Using cpu = 'i386' instead!
...
...
Traceback (most recent call last):
File "jnius/jnius_export_class.pxi", line 119, in jnius.MetaJavaClass.__new__
File "jnius/jnius_export_class.pxi", line 179, in jnius.MetaJavaClass.resolve_class
File "jnius/jnius_env.pxi", line 11, in jnius.get_jnienv
File "jnius/jnius_jvm_dlopen.pxi", line 102, in jnius.get_platform_jnienv
File "jnius/jnius_jvm_dlopen.pxi", line 69, in jnius.create_jnienv
SystemError: Error calling dlopen(b'/Library/Java/JavaVirtualMachines/amazon-corretto-8.jdk/Contents/Home/jre/lib/jli/libjli.dylib'): b"dlopen(/Library/Java/JavaVirtualMachines/amazon-corretto-8.jdk/Contents/Home/jre/lib/jli/libjli.dylib, 0x000A): tried: '/Library/Java/JavaVirtualMachines/amazon-corretto-8.jdk/Contents/Home/jre/lib/jli/libjli.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Library/Java/JavaVirtualMachines/amazon-corretto-8.jdk/Contents/Home/jre/lib/jli/libjli.dylib' (no such file), '/Library/Java/JavaVirtualMachines/amazon-corretto-8.jdk/Contents/Home/jre/lib/jli/libjli.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))"
I previously used it on an old Mac with an Intel chip. Can it be supported on the M1 Mac or is there a workaround available?
Environment:
- Python Verison: 3.8.17
- Mac OS: Ventura - Apple M1 Pro Chip
@gmarupilla which version of pyliquibase
are you using?
do you have chance to test the master branch? pyjnius recently upgraded to 1.5.0, to latest release
pip install https://github.com/memiiso/pyliquibase/archive/master.zip --upgrade --user
I am currently using version 2.0.11, but even after trying to install the master code through pip, I still encountered a similar error.
Error Trace
....
....
2023-06-09 07:02:19,532 - WARNING - Failed to download Liquibase extension: liquibase-snowflake-4.21.1
Traceback (most recent call last):
File "/opt/homebrew/opt/python@3.8/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/opt/homebrew/opt/python@3.8/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "<my_project_path>/utils/liquibase.py", line 75, in <module>
main()
File "<my_project_path>/utils/liquibase.py", line 13, in main
execute(
File "<my_project_path>/utils/liquibase.py", line 35, in execute
liquibase = Pyliquibase(
File "<my_project_path>/.venv/lib/python3.8/site-packages/pyliquibase/__init__.py", line 89, in __init__
self.cli = self._cli()
File "<my_project_path>/.venv/lib/python3.8/site-packages/pyliquibase/__init__.py", line 112, in _cli
from jnius import JavaClass, MetaJavaClass, JavaMethod
File "<my_project_path>/.venv/lib/python3.8/site-packages/jnius/__init__.py", line 45, in <module>
from .reflect import * # noqa
File "<my_project_path>/.venv/lib/python3.8/site-packages/jnius/reflect.py", line 19, in <module>
class Class(JavaClass, metaclass=MetaJavaClass):
File "jnius/jnius_export_class.pxi", line 118, in jnius.MetaJavaClass.__new__
File "jnius/jnius_export_class.pxi", line 178, in jnius.MetaJavaClass.resolve_class
File "jnius/jnius_env.pxi", line 11, in jnius.get_jnienv
File "jnius/jnius_jvm_dlopen.pxi", line 95, in jnius.get_platform_jnienv
File "jnius/jnius_jvm_dlopen.pxi", line 62, in jnius.create_jnienv
SystemError: Error calling dlopen(b'/Library/Java/JavaVirtualMachines/amazon-corretto-8.jdk/Contents/Home/jre/lib/jli/libjli.dylib'): b"dlopen(/Library/Java/JavaVirtualMachines/amazon-corretto-8.jdk/Contents/Home/jre/lib/jli/libjli.dylib, 0x000A): tried: '/Library/Java/JavaVirtualMachines/amazon-corretto-8.jdk/Contents/Home/jre/lib/jli/libjli.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Library/Java/JavaVirtualMachines/amazon-corretto-8.jdk/Contents/Home/jre/lib/jli/libjli.dylib' (no such file), '/Library/Java/JavaVirtualMachines/amazon-corretto-8.jdk/Contents/Home/jre/lib/jli/libjli.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))"
This seems something related to pyjnius
https://github.com/kivy/pyjnius/blob/7da449434e9b1c825c283e4a9103db27d17aee2f/jnius/env.py#L369-L375
probably this variable need to be extended, could you submit it to pyjnius project?
https://github.com/kivy/pyjnius/blob/7da449434e9b1c825c283e4a9103db27d17aee2f/jnius/env.py#L23
@gmarupilla could you also try this code to see if its solving it.
# add arm64 to MACHINE2CPU list
import jnius
jnius.env.MACHINE2CPU = {
"arm64": "arm64",
"i686": "i386",
"x86_64": "amd64",
"AMD64": "amd64",
"armv7l": "arm",
"aarch64": "aarch64",
"sun4u": "sparcv9",
"sun4v": "sparcv9"
}
# run liquibase code
liquibase = Pyliquibase(defaultsFile="changelogs/liquibase.properties", logLevel="INFO")
# call execute with arguments
liquibase.execute("status")
Thanks for the response @ismailsimsek. It seems I cannot override the MACHINE2CPU` env from my local. I'll open the issue in the pyjnius project to support the arm64 arch. Thanks!
I'm closing this issue because it doesn't seem to be directly related to this package.