Skip to content

Darwin-specific wmake rule prevents compilation with CGAL 5

Summary

Darwin/macOS-specific wmake rule at wmake/rules/darwin64Clang/cgal causes macOS builds to fail with a linker error with CGAL versions >= 5

Steps to reproduce

Compile OpenFOAM on macOS with CGAL version >= 5

Note: CGAL versions >= 5.5 are also affected by #2665 (closed)

Example case

N/A

What is the current bug behaviour?

Linker error ld: library not found for -lCGAL (note: CGAL >= 5 is header-only)

What is the expected correct behavior?

Build succeeds

Relevant logs and/or images

wmake PolyhedronReader
    link: /Volumes/OpenFOAM-v2206/platforms/darwin64ClangDPInt32Opt/lib/libPolyhedronReader.dylib
ld: library not found for -lCGAL
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [/Volumes/OpenFOAM-v2206/platforms/darwin64ClangDPInt32Opt/lib/libPolyhedronReader.dylib] Error 1
make[2]: *** [surfaceBooleanFeatures] Error 2
make[1]: *** [surface] Error 2

Environment information

  • OpenFOAM version : v2206|v2112|master|develop
  • Operating system : macOS
  • Hardware info : arm64|x86_64
  • Compiler : clang

Possible fixes

Delete the wmake/rules/darwin64Clang/cgal file. I have tried this and can report that OpenFOAM will build with CGAL 5 on macOS if this specific file is deleted.

Additional note: the wmake/rules/darwin64Clang/cgal rule seems to be written for CGAL 4 (i.e., before CGAL went header-only). I'm aware that, as of the current develop branch, OpenFOAM won't build with CGAL 4.x anymore (at least on macOS), so this fix becomes more important for macOS users. EDIT: this last part doesn't seem to be true as of v2212, but CGAL 4 is now an old version anyway

Edited by Gabriel Gerlero