Skip to content

Conversation

mgorny
Copy link
Contributor

@mgorny mgorny commented Dec 31, 2024

Detect if LLVM has been built with the request to link to dylib, and use dylib rather than trying to link components libs in that case. This fixes undesirable static linking when static libraries are installed, and an error when they are not.

Note that this probably is not the best way of handling the problem (upstream recommends using something like llvm_config(symengine USE_SHARED ${SYMENGINE_LLVM_COMPONENTS})) but it makes minimal changes to the current complex logic, and therefore is least likely to break something.

Fixes #2074

Detect if LLVM has been built with the request to link to dylib,
and use dylib rather than trying to link components libs in that case.
This fixes undesirable static linking when static libraries are
installed, and an error when they are not.

Note that this probably is not the best way of handling the problem
(upstream recommends using something like `llvm_config(symengine
USE_SHARED ${SYMENGINE_LLVM_COMPONENTS})`) but it makes minimal changes
to the current complex logic, and therefore is least likely to break
something.

Fixes symengine#2074
Co-authored-by: Isuru Fernando <isuruf@gmail.com>
@isuruf
Copy link
Member

isuruf commented Feb 15, 2025

Thanks

@isuruf isuruf merged commit ea925e1 into symengine:master Feb 16, 2025
33 of 36 checks passed
mgorny added a commit to mgorny/symengine that referenced this pull request Jul 20, 2025
This is a followup to symengine#2075 that fixes linking against LLVM dylib
in reverse dependencies of SymEngine (e.g. the Python package).
Unfortunately, my original patch missed this second occurrence.

Given that we permit overriding the dylib use via a cache variable
and it is unlikely for a dylib install to suddenly become non-dylib
let's store the value in the config file.

Signed-off-by: Michał Górny <mgorny@gentoo.org>
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.

CMake failure when using LLVM dylib
2 participants