sofa-framework / sofa

Real-time multi-physics simulation with an emphasis on medical simulation.
https://www.sofa-framework.org
GNU Lesser General Public License v2.1
871 stars 297 forks source link

SOFA is compatible with only x86_64, not arm64. #4690

Open GoGoComputer opened 2 weeks ago

GoGoComputer commented 2 weeks ago

Problem

Description hello, I wanted to use Sofa 23.06.00 in M1 Mac Book Pro But I can not use Sofa. This error message indicates: (have 'x86_64', need 'arm64e' or 'arm64')) I'd like to know the solution. I want to use Sofa 23.06.00

Steps to reproduce < LIST THE STEPS TO REPRODUCE YOUR PROBLEM HERE >

  1. install anaconda and make virtual environment
  2. install sofa framework
  3. define the environment variables
  4. import Sofa in python

Expected behavior < DESCRIBE WHAT YOU THINK SHOULD HAVE HAPPEN INSTEAD >

Success importing Sofa in python without any error.


Environment

Context

Command called


(sofarl) bemore@BeMores-MacBook-Pro site-packages % python 
Python 3.8.19 (default, Mar 20 2024, 15:27:52) 
[Clang 14.0.6 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import Sofa
---------------------------------------
Checking SOFA_ROOT and SOFAPYTHON3_ROOT
Using environment variable SOFA_ROOT: /Users/bemore/Library/CloudStorage/OneDrive-Personal/DEV/SOFA_study/SOFA_v23.06.00_MacOS
---------------------------------------
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/bemore/Library/CloudStorage/OneDrive-Personal/DEV/SOFA_study/SOFA_v23.06.00_MacOS/plugins/SofaPython3/lib/python3/site-packages/Sofa/__init__.py", line 140, in <module>
    import Sofa.Helper
ImportError: dlopen(/Users/bemore/Library/CloudStorage/OneDrive-Personal/DEV/SOFA_study/SOFA_v23.06.00_MacOS/plugins/SofaPython3/lib/python3/site-packages/Sofa/Helper.cpython-38-darwin.so, 0x0002): tried: '/Users/bemore/Library/CloudStorage/OneDrive-Personal/DEV/SOFA_study/SOFA_v23.06.00_MacOS/plugins/SofaPython3/lib/python3/site-packages/Sofa/Helper.cpython-38-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/bemore/Library/CloudStorage/OneDrive-Personal/DEV/SOFA_study/SOFA_v23.06.00_MacOS/plugins/SofaPython3/lib/python3/site-packages/Sofa/Helper.cpython-38-darwin.so' (no such file), '/Users/bemore/Library/CloudStorage/OneDrive-Personal/DEV/SOFA_study/SOFA_v23.06.00_MacOS/plugins/SofaPython3/lib/python3/site-packages/Sofa/Helper.cpython-38-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64'))
>>> 

Env vars

python -c "exec( \"import os, sys\nprint('#################')\nprint('--- sys.version ---')\nprint(sys.version)\nprint('--- PATH ---')\ntry:\n  print(os.environ['PATH'])\nexcept Exception:\n  pass\nprint('--- SOFA_ROOT ---')\ntry:\n  print(os.environ['SOFA_ROOT'])\nexcept Exception:\n  pass\nprint('--- PYTHONPATH ---')\ntry:\n  print(os.environ['PYTHONPATH'])\nexcept Exception:\n  pass\nprint('--- sys.path ---')\ntry:\n   print(str(sys.path))\nexcept Exception:\n   pass\nprint('#################')\" )"

--- sys.version ---
3.8.19 (default, Mar 20 2024, 15:27:52) 
[Clang 14.0.6 ]
--- PATH ---
/usr/local/opt/python@3.8/bin/:/opt/anaconda3/envs/sofarl/bin:/opt/anaconda3/condabin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/usr/local/share/dotnet:~/.dotnet/tools
--- SOFA_ROOT ---
/Users/bemore/Library/CloudStorage/OneDrive-Personal/DEV/SOFA_study/SOFA_v23.06.00_MacOS
--- PYTHONPATH ---
/Users/bemore/Library/CloudStorage/OneDrive-Personal/DEV/SOFA_study/SOFA_v23.06.00_MacOS/plugins/SofaPython3/lib/python3/site-packages:/Users/bemore/Library/CloudStorage/OneDrive-Personal/DEV/SOFA_study/SOFA_v23.12.01_MacOS/plugins/SofaPython3/lib/python3/site-packages:/path/to/SofaPython3/lib/python3/site-packages:
--- sys.path ---
['', '/Users/bemore/Library/CloudStorage/OneDrive-Personal/DEV/SOFA_study/SOFA_v23.06.00_MacOS/plugins/SofaPython3/lib/python3/site-packages', '/Users/bemore/Library/CloudStorage/OneDrive-Personal/DEV/SOFA_study/SOFA_v23.12.01_MacOS/plugins/SofaPython3/lib/python3/site-packages', '/path/to/SofaPython3/lib/python3/site-packages', '/opt/anaconda3/envs/sofarl/lib/python38.zip', '/opt/anaconda3/envs/sofarl/lib/python3.8', '/opt/anaconda3/envs/sofarl/lib/python3.8/lib-dynload', '/opt/anaconda3/envs/sofarl/lib/python3.8/site-packages']
#################

Logs

Full output


(sofarl) bemore@BeMores-MacBook-Pro site-packages % python 
Python 3.8.19 (default, Mar 20 2024, 15:27:52) 
[Clang 14.0.6 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import Sofa
---------------------------------------
Checking SOFA_ROOT and SOFAPYTHON3_ROOT
Using environment variable SOFA_ROOT: /Users/bemore/Library/CloudStorage/OneDrive-Personal/DEV/SOFA_study/SOFA_v23.06.00_MacOS
---------------------------------------
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/bemore/Library/CloudStorage/OneDrive-Personal/DEV/SOFA_study/SOFA_v23.06.00_MacOS/plugins/SofaPython3/lib/python3/site-packages/Sofa/__init__.py", line 140, in <module>
    import Sofa.Helper
ImportError: dlopen(/Users/bemore/Library/CloudStorage/OneDrive-Personal/DEV/SOFA_study/SOFA_v23.06.00_MacOS/plugins/SofaPython3/lib/python3/site-packages/Sofa/Helper.cpython-38-darwin.so, 0x0002): tried: '/Users/bemore/Library/CloudStorage/OneDrive-Personal/DEV/SOFA_study/SOFA_v23.06.00_MacOS/plugins/SofaPython3/lib/python3/site-packages/Sofa/Helper.cpython-38-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/bemore/Library/CloudStorage/OneDrive-Personal/DEV/SOFA_study/SOFA_v23.06.00_MacOS/plugins/SofaPython3/lib/python3/site-packages/Sofa/Helper.cpython-38-darwin.so' (no such file), '/Users/bemore/Library/CloudStorage/OneDrive-Personal/DEV/SOFA_study/SOFA_v23.06.00_MacOS/plugins/SofaPython3/lib/python3/site-packages/Sofa/Helper.cpython-38-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64'))
>>> 

Content of build_dir/CMakeCache.txt

< DRAG AND DROP YOUR CMAKECACHE.TXT HERE >


Thank you for your report.

bakpaul commented 2 weeks ago

Yes, the CI builder generating the binaries is an intel mac. This is a compatibility choice, to enable the use of our binaries by every one. To use them on a arm64 you need to install Rosetta on your mac to run x86 libraries. But it will not run at full speed because of the compatibility layer. To have optimized binaries for your architecture, you'll need to compile them yourself.