Skip to content

Commit

Permalink
Merge pull request #3309 from rcurtin/osx_link_m
Browse files Browse the repository at this point in the history
Correctly link with `-lm` in Python bindings
  • Loading branch information
rcurtin committed Nov 14, 2022
2 parents 3fdb791 + 6924efd commit 8d29301
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/mlpack/bindings/python/setup.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ else:
# Windows and Linux linking behavior.
libraries = '${MLPACK_LIBRARIES}'.split(' ')

# Workaround: if we receive "m" as a library, what was actually meant was -lm.
for i in range(len(libraries)):
if libraries[i] == 'm':
libraries[i] = '-lm'

# Potentially faulty assumption: we can always link against libraries directly
# by just specifying the full path to them on the command line.
extra_link_args += libraries
Expand Down

0 comments on commit 8d29301

Please sign in to comment.