Skip to content

Compiling on conda-forge's Macs#59

Merged
sanathkeshav merged 8 commits intoDataAnalyticsEngineering:developfrom
claudiushaag:compiling
May 20, 2025
Merged

Compiling on conda-forge's Macs#59
sanathkeshav merged 8 commits intoDataAnalyticsEngineering:developfrom
claudiushaag:compiling

Conversation

@claudiushaag
Copy link
Member

This PR is part of our effort to introduce osx versions of FANS via conda-forge.
The recipe-update was done in this PR

Restrictive to this process was the fact that conda-forge only builds against Clang on MacOS, and crosscompiles for arm64.
I did this with little to no deep knowledge of CMake and compilation in general - sorry if I messed up any working aspect and introduced some regression. Would be open to fix this obviously.

The overall strategy was:

  1. introduce support for Clang using CMakePresets
  2. get Clang compilation on conda-forge working for x86
  3. enable cross-compilation to arm64.
  4. Get this PR merged into a version
  5. From the above version on, conda-forge can build osx-64 and osx-arm64 version of FANS.

Steps 2 and 3 were mainly carried out in the conda recipe itself. The result of the first step is this PR.
Step 4 and 5 are still ahead of us.

Introduced Changes

  • raise CMake min Verison to 3.21 for Presets
  • Introduce presets for gcc and clang, both with release and debug flags (don't know wether helpful/used)
  • Ported settings from CMakeLists.txt to Presets
    • there should be no setting missing because of this PR
  • ⚠️ CodeChange: added default virtual destructors for Matmodel and Solver, as those crashed on osx as Illegal Instruction and also showed up as a compiler warning:
    /home/USADR/xxxx/scratch/Code/FANS/src/main.cpp:32:9: warning: delete called on 'Matmodel<1>' that is abstract but has non-virtual destructor [-Wdelete-abstract-non-virtual-dtor]
       32 |         delete matmodel;
          |         ^
    
  • removed all AVX2 and FMA detection logic - those CPUs are just to old.

Todos

I don't know how these changes will interact with all other setup in the repo itself:

  • Testing
  • Deployment
    so please check. Would love PRs on the branch, so I can test the conda-CI.
    There is also a Markdown-File which I generated to give a short introduction into how to use the Presets. I would delete that before merging, but maybe it serves a purpose right now as inspo for docs, README and testing...

claudiushaag and others added 7 commits May 15, 2025 13:40
+ updatet to cmake 3.21
+ introduced presets
+ on linux both gcc and clang working
+ added markdown for overview
+ gcc and clang-linux working, same speed for test
main.cpp:32:9: warning: delete called on 'Matmodel<1>' that is abstract but has non-virtual destructor [-Wdelete-abstract-non-virtual-dtor]
   32 |         delete matmodel;
given through clang.
+ also applied the same to Solver
+ uncomment compile options
+ remove unnecessary comment
+ remove doubled CMake min version
+ introduce CXX_FLAGS for gcc in preset
    + also in parts for Clang, -fmax-errors does not exist  there
+ reintroduce RPATH-logic for Apple -> don't understand it
+ add condition to mac presets -> only loose, as darwin is open-source and could NOT be apple... but seems to be standard vs APPLE-check....
Copy link
Collaborator

@IshaanDesai IshaanDesai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the valuable contribution @claudiushaag ! I just have one minor comment regarding consistency. I would suggest in keeping the documentation in the repository, perhaps as notes in a sub folder. It is valuable content.

Shall we also add CI to check conda builds? Perhaps it makes sense.

@IshaanDesai
Copy link
Collaborator

Please don't forget to add a change log entry.

@sanathkeshav sanathkeshav merged commit 6960e64 into DataAnalyticsEngineering:develop May 20, 2025
7 checks passed
@sanathkeshav sanathkeshav mentioned this pull request May 21, 2025
@claudiushaag claudiushaag deleted the compiling branch October 27, 2025 16:14
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.

3 participants