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

Create custom build_ext for correct rpath linking on mac #79

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

noahness
Copy link

@noahness noahness commented Mar 3, 2020

Workaround distutils bug 36353; see https://bugs.python.org/issue36353. On MacOS, the build_ext --rpath option is getting converted to -L rather than -Wl,-rpath=. This change sub-classes build_ext and correctly passes appropriate rpath options to clang linker.

Snippet from distutils.unixccompiler.py:

  compiler = os.path.basename(sysconfig.get_config_var("CC"))
        if sys.platform[:6] == "darwin":
            # MacOSX's linker doesn't understand the -R flag at all
            return "-L" + dir
        elif sys.platform[:7] == "freebsd":
            return "-Wl,-rpath=" + dir
        elif sys.platform[:5] == "hp-ux":
            if self._is_gcc(compiler):
                return ["-Wl,+s", "-L" + dir]
            return ["+s", "-L" + dir]

Workaround code taken from python/cpython#12418.

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.

1 participant