Skip to content

openmc.deplete incompatible with Apple M1 #2274

Open
@kkiesling

Description

@kkiesling

When trying to import openmc.deplete on a Mac computer with the Apple M1 chip, the following error occurs:

Traceback (most recent call last):
  File "/Users/kkiesling/software/opt/depletion-comparison/pwr/openmc/run_depletion.py", line 5, in <module>
    import openmc.deplete
  File "/Users/kkiesling/software/opt/openmc/openmc/deplete/__init__.py", line 11, in <module>
    from .coupled_operator import *
  File "/Users/kkiesling/software/opt/openmc/openmc/deplete/coupled_operator.py", line 21, in <module>
    import openmc.lib
  File "/Users/kkiesling/software/opt/openmc/openmc/lib/__init__.py", line 32, in <module>
    _dll = CDLL(_filename)
  File "/Users/kkiesling/opt/anaconda3/envs/openmc-dev/lib/python3.10/ctypes/__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(/Users/kkiesling/software/opt/openmc/openmc/lib/libopenmc.dylib, 0x0006): tried: '/Users/kkiesling/software/opt/openmc/openmc/lib/libopenmc.dylib' (mach-o file, but is an incompatible architecture (have (arm64), need (x86_64)))

I have no issue importing other standard openmc modules to build a model and run an eigenvalue problem. It is just this one module (could be others but I haven't encountered the error elsewhere). OpenMC compiles fine, this error occurs at runtime.

Other info/things I have tried:

  • I am compiling from source with the latest develop branch.
  • I have played around with explicitly setting different compilers (tried gcc/g++ and clang/clang++, both from various locations on my computer).
  • I have tried explicitly setting the CMAKE_OSX_ARCHITECTURES to "arm64" (what it is using) and "x86_64" per some google solutions but trying to set the architecture to the latter causes other errors and fails during build.

I am out of ideas for how to fix this on my end and I am not even sure if this is something that can be addressed by OpenMC (maybe there is something to set in CMake but my searching has led to no solutions on this front).

Has anyone else experienced this error with M1 and know how to get around it?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions