Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load libc on darwin in any cases #891

Merged
merged 1 commit into from Apr 5, 2020
Merged

Conversation

pradal
Copy link
Contributor

@pradal pradal commented Apr 5, 2020

Per #888

load_dll('c').free fail on Darwin, without MacPort or Homebrew, because libc is not found on my system.
By default, on Mac, libc is provided by libSystem.dylib.

A robust solution is to replace load_dll('c').free by CDLL(None).free because Python is already using libc.

CDLL(None) internally calls dlopen(NULL), and as the dlopen
manpage says, "If filename is NULL, then the returned handle is for the
# main program". This way we can let the linker do the work to figure out
# which libc Python is actually using.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 81.717% when pulling 98f6b36 on pradal:libc_mac into 81ddee0 on Toblerity:maint-1.7.

# manpage says, "If filename is NULL, then the returned handle is for the
# main program". This way we can let the linker do the work to figure out
# which libc Python is actually using.
free = CDLL(None).free
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

@sgillies sgillies left a comment

Choose a reason for hiding this comment

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

@pradal thank you!

@sgillies sgillies merged commit a34ec59 into shapely:maint-1.7 Apr 5, 2020
@pradal pradal deleted the libc_mac branch April 6, 2020 07:17
@adamjstewart
Copy link
Contributor

I just ran into this same issue on macOS. Shouldn't this be merged to master as well?

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.

None yet

4 participants