Skip to content

gh-127604: ensure -ldl is passed to the linker when dladdr1 is found #133040

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

Merged
merged 7 commits into from
Apr 27, 2025

Conversation

picnixz
Copy link
Member

@picnixz picnixz commented Apr 27, 2025

@picnixz picnixz changed the title gh-127605: ensure -ldl is passed to the linker when dladdr1 is found gh-127604: ensure -ldl is passed to the linker when dladdr1 is found Apr 27, 2025
@picnixz picnixz requested a review from ZeroIntensity April 27, 2025 10:13
Copy link
Member

@ZeroIntensity ZeroIntensity left a comment

Choose a reason for hiding this comment

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

LGTM, but let's run buildbots to make sure we didn't break anything.

@ZeroIntensity ZeroIntensity added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Apr 27, 2025
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @ZeroIntensity for commit 3d22310 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F133040%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Apr 27, 2025
@picnixz picnixz merged commit 2443662 into python:main Apr 27, 2025
42 checks passed
@picnixz picnixz deleted the fix/configure/backtrace-ldflags-127604 branch April 27, 2025 22:28
@freakboy3742
Copy link
Contributor

@picnixz This seems to have resulted in the -ldl argument being included twice on macOS and iOS builds. It's not causing an error, but it is raising a lot of compiler warnings

@freakboy3742
Copy link
Contributor

Looks like it's not just macOS and iOS; Ubuntu builds now include compilation statements like gcc -shared -ldl -ldl -ldl -ldl -ldl -ldl .... It doesn't look like GCC is complaining... but I think dl might be linked. 🤣

@picnixz
Copy link
Member Author

picnixz commented Apr 28, 2025

Aaaaaah I don't understand:( Why would it include it twice I'll investigate

@picnixz
Copy link
Member Author

picnixz commented Apr 28, 2025

Instead of adding it to all LDLFLAGS, I'll only add it the LDLFLAGS for faulthandler

Mmh, it's actually in Python/traceback.c. A bit more annoying.

@picnixz
Copy link
Member Author

picnixz commented Apr 28, 2025

Hum. I also forgot removing defined(HAVE_BACKTRACE_SYMBOLS) after Victor told me that backtrace_symbols wasn't used.

@vstinner
Copy link
Member

faulthandler is built as a built-in module, since Py_FatalError() uses it (dump the backtrace and than turns off faulthandler).

@picnixz
Copy link
Member Author

picnixz commented Apr 28, 2025

I found the issue. Because of AC_CHECK_HEADERS + AC_CHECK_FUNCS, we actually expand LDFLAGS 2x3=6 times, hence the 6 -ldl -ldl -ldl -ldl -ldl -ldl.

@picnixz
Copy link
Member Author

picnixz commented Apr 28, 2025

PR is ready: #133071.

It doesn't look like GCC is complaining... but I think dl might be linked. 🤣

And yes, that's why I didn't see the warnings. I use gcc and not clang

@ZeroIntensity
Copy link
Member

I was wondering if autoreconf was smart enough to deal with the extra flags. Buildbots passed so I figured it was ok :(.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants