Skip to content

macOS Apple Silicon build fixes#9

Open
basile-simvia wants to merge 1 commit into
SalomePlatform:masterfrom
simvia-tech:local/macos-apple-silicon-9.14.0
Open

macOS Apple Silicon build fixes#9
basile-simvia wants to merge 1 commit into
SalomePlatform:masterfrom
simvia-tech:local/macos-apple-silicon-9.14.0

Conversation

@basile-simvia

Copy link
Copy Markdown

@mohd-afeef-badri @nitawa as discussed during our video call last week, here are the changes related to the Salome 9.14 version on macOS.

Adapt KERNEL to build on macOS (Apple Silicon, Clang, Python 3.12+, NumPy >= 1.24, SWIG 4.x). All changes are guarded by APPLE or version macros so non-macOS builds are unaffected.

  • src/Container/Component_i.cxx: on macOS pthread_t is opaque, so guard the existing 'pthread_self() != _ThreadId' comparisons with APPLE branches that use pthread_equal() instead. Also drop the '_ThreadId > 0' test in CpuUsed_impl() for the same reason.
  • src/Container/Container_i.cxx: macOS does not expose 'environ' directly; include <crt_externs.h> and define 'environ' via _NSGetEnviron().
  • src/Launcher/SALOME_ExternalServerLauncher.cxx: provide an APPLE-only get_current_dir_name() shim (the GNU function is missing on macOS) using getcwd(nullptr, 0).
  • src/Launcher_SWIG/Launcher.i: rename SWIG $function to $action in the two %exception blocks (SWIG 4.x).
  • src/DSC/DSC_Python/calcium.i: redefine PyEval_CallObject to PyObject_CallObject for Python >= 3.12 (removed symbol). Add an APPLE branch with the NumPy >= 1.24 strict typing fix (PyArray_TYPE cast + PyArray_INT/LONG/DOUBLE/FLOAT/STRING/CFLOAT aliases to NPY_*).
  • src/DSC/DSC_User/Datastream/Calcium/CalciumC.c: add missing forward declarations of ecp_fin_/ecp_cd_ and the CALCIUM_C2CPP_INTERFACE_CXX prototypes so Clang's stricter C frontend accepts the file.
  • src/DSC/CMakeLists.txt: reorder DSC subdirs so DSC_Python is built before DSC_User (DSC_Python only depends on common headers).
  • src/TestContainer/CMakeLists.txt: add an IF(APPLE) variant of COMMON_LIBS that omits SalomeTestComponentEngine from its own dependency list, and append ${OMNIORB_LIBRARIES} to the link line so omniORB symbols are resolved.

Adapt KERNEL to build on macOS (Apple Silicon, Clang, Python 3.12+,
NumPy >= 1.24, SWIG 4.x). All changes are guarded by __APPLE__ or
version macros so non-macOS builds are unaffected.

- src/Container/Component_i.cxx: on macOS pthread_t is opaque, so guard
  the existing 'pthread_self() != _ThreadId' comparisons with
  __APPLE__ branches that use pthread_equal() instead. Also drop the
  '_ThreadId > 0' test in CpuUsed_impl() for the same reason.
- src/Container/Container_i.cxx: macOS does not expose 'environ'
  directly; include <crt_externs.h> and define 'environ' via
  _NSGetEnviron().
- src/Launcher/SALOME_ExternalServerLauncher.cxx: provide an
  __APPLE__-only get_current_dir_name() shim (the GNU function is
  missing on macOS) using getcwd(nullptr, 0).
- src/Launcher_SWIG/Launcher.i: rename SWIG $function to $action
  in the two %exception blocks (SWIG 4.x).
- src/DSC/DSC_Python/calcium.i: redefine PyEval_CallObject to
  PyObject_CallObject for Python >= 3.12 (removed symbol). Add an
  __APPLE__ branch with the NumPy >= 1.24 strict typing fix
  (PyArray_TYPE cast + PyArray_INT/LONG/DOUBLE/FLOAT/STRING/CFLOAT
  aliases to NPY_*).
- src/DSC/DSC_User/Datastream/Calcium/CalciumC.c: add missing forward
  declarations of ecp_fin_/ecp_cd_ and the CALCIUM_C2CPP_INTERFACE_CXX
  prototypes so Clang's stricter C frontend accepts the file.
- src/DSC/CMakeLists.txt: reorder DSC subdirs so DSC_Python is built
  before DSC_User (DSC_Python only depends on common headers).
- src/TestContainer/CMakeLists.txt: add an IF(APPLE) variant of
  COMMON_LIBS that omits SalomeTestComponentEngine from its own
  dependency list, and append ${OMNIORB_LIBRARIES} to the link line
  so omniORB symbols are resolved.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant