Skip to content

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

Merged
picnixz merged 7 commits into
python:mainfrom
picnixz:fix/configure/backtrace-ldflags-127604
Apr 27, 2025
Merged

gh-127604: ensure -ldl is passed to the linker when dladdr1 is found#133040
picnixz merged 7 commits into
python:mainfrom
picnixz:fix/configure/backtrace-ldflags-127604

Conversation

@picnixz

@picnixz picnixz commented Apr 27, 2025

Copy link
Copy Markdown
Member

@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

@ZeroIntensity ZeroIntensity left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown

🤖 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
Comment thread configure.ac Outdated
Comment thread Doc/library/faulthandler.rst Outdated
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
@picnixz picnixz merged commit 2443662 into python:main Apr 27, 2025
@picnixz picnixz deleted the fix/configure/backtrace-ldflags-127604 branch April 27, 2025 22:28
@freakboy3742

Copy link
Copy Markdown
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
Copy Markdown
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

picnixz commented Apr 28, 2025

Copy link
Copy Markdown
Member Author

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

@picnixz

picnixz commented Apr 28, 2025

Copy link
Copy Markdown
Member Author

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

picnixz commented Apr 28, 2025

Copy link
Copy Markdown
Member Author

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

@vstinner

Copy link
Copy Markdown
Member

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

@picnixz

picnixz commented Apr 28, 2025

Copy link
Copy Markdown
Member Author

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

picnixz commented Apr 28, 2025

Copy link
Copy Markdown
Member Author

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
Copy Markdown
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