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

gh-115737: Correct the install name for non-framework macOS libPython builds. #115750

Merged
merged 2 commits into from
Feb 21, 2024

Conversation

freakboy3742
Copy link
Contributor

@freakboy3742 freakboy3742 commented Feb 21, 2024

#115120 refactored the configure/Makefile targets in preparation for supporting iOS framework builds. However, this refactoring broke the install_name used for non-framework macOS builds installed into a non-default location (as is used by pyenv).

This PR restores the old behaviour using ${prefix} as the prefix for the install_name for non-framework macOS builds. It also renames the configuration variable to reflect the fact that it is a generic dylib configuration prefix, not a framework-specific prefix.

CC @native-api @ned-deily @ronaldoussoren

Refs pyenv/pyenv#2903

Copy link
Member

@ned-deily ned-deily left a comment

Choose a reason for hiding this comment

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

Thanks for looking into this. I think we can greatly simplify the change to just reverting the original change to the libpython.dylib target in the Makefile. As far as I can see, that's the only problem here as that target is only made in the macOS --enable-shared case. Then there is no need to rename PYTHONFRAMEWORKINSTALLNAMEPREFIX as it will only be used for framework builds. And this shouldn't cause any problems for further iOS changes since only frameworks builds are supported there.

Makefile.pre.in Outdated
@@ -869,7 +869,7 @@ libpython3.so: libpython$(LDVERSION).so
$(BLDSHARED) $(NO_AS_NEEDED) -o $@ -Wl,-h$@ $^

libpython$(LDVERSION).dylib: $(LIBRARY_OBJS)
$(CC) -dynamiclib $(PY_CORE_LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(PYTHONFRAMEWORKINSTALLNAMEPREFIX)/lib/libpython$(LDVERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(DTRACE_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
$(CC) -dynamiclib $(PY_CORE_LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(DYLIBINSTALLNAMEPREFIX)/lib/libpython$(LDVERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(DTRACE_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \
Copy link
Member

Choose a reason for hiding this comment

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

Since this target is only used for macOS --enable-shared builds (and not for framework or non-shared builds), I think the only change we really need is to revert the original change here, though still removing the obsolete -Wl,-single_module. Then there is no need to make any of the other rename changes. So:

$(CC) -dynamiclib $(PY_CORE_LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(prefix)/lib/libpython$(LDVERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(DTRACE_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good point - I'm not sure why I changed this one in the original patch. I can only assume I got a bit search-and-replace happy looking for install_name.

@bedevere-app
Copy link

bedevere-app bot commented Feb 21, 2024

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@freakboy3742
Copy link
Contributor Author

I have made the requested changes; please review again

Copy link
Member

@ned-deily ned-deily left a comment

Choose a reason for hiding this comment

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

LGTM, thanks

@ned-deily ned-deily merged commit 074bbec into python:main Feb 21, 2024
33 of 34 checks passed
woodruffw pushed a commit to woodruffw-forks/cpython that referenced this pull request Mar 4, 2024
diegorusso pushed a commit to diegorusso/cpython that referenced this pull request Apr 17, 2024
freakboy3742 added a commit to freakboy3742/cpython that referenced this pull request Aug 5, 2024
freakboy3742 added a commit to freakboy3742/cpython that referenced this pull request Aug 5, 2024
freakboy3742 added a commit to freakboy3742/cpython that referenced this pull request Aug 5, 2024
freakboy3742 added a commit to freakboy3742/cpython that referenced this pull request Aug 5, 2024
@freakboy3742 freakboy3742 deleted the macOS-non-framework-relocatable branch August 5, 2024 05:30
freakboy3742 added a commit to freakboy3742/cpython that referenced this pull request Sep 6, 2024
freakboy3742 added a commit to freakboy3742/cpython that referenced this pull request Sep 9, 2024
freakboy3742 added a commit to freakboy3742/cpython that referenced this pull request Sep 9, 2024
freakboy3742 added a commit to freakboy3742/cpython that referenced this pull request Sep 9, 2024
freakboy3742 added a commit to freakboy3742/cpython that referenced this pull request Sep 9, 2024
freakboy3742 added a commit to freakboy3742/cpython that referenced this pull request Oct 9, 2024
freakboy3742 added a commit to freakboy3742/cpython that referenced this pull request Dec 13, 2024
freakboy3742 added a commit to freakboy3742/cpython that referenced this pull request Dec 13, 2024
freakboy3742 added a commit to freakboy3742/cpython that referenced this pull request Dec 13, 2024
freakboy3742 added a commit to freakboy3742/cpython that referenced this pull request Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.13 bugs and security fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants