GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-104523: Use dynamic rule for compiling libmpdec and libexpat by indygreg · Pull Request #104574 · python/cpython

Conversation

@indygreg

@indygreg indygreg commented May 17, 2023 •
edited by bedevere-bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Before we had a separate rule for each source/object file. We can use $(foreach $(eval $(call ...))) to dynamically derive rules to avoid the repetition.

I think this is sufficiently portable. If not, there are alternatives to $(patsubst) that can be leveraged.

  • Issue: Overhaul build system rules related to profiling #104523

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-bot bedevere-bot added the awaiting review label May 17, 2023
@bedevere-bot bedevere-bot mentioned this pull request May 17, 2023
Overhaul build system rules related to profiling #104523
Closed
@indygreg
pythongh-104523: use dynamic rule for compiling libmpdec and libexpat
44eda25
Before we had a separate rule for each source/object file. We can
use `$(foreach $(eval $(call ...)))` to dynamically derive rules to
avoid the repetition.

skip news (behavior preserving build system change)
@indygreg
indygreg force-pushed the dynamic-build-rules branch from 0c12c20 to 44eda25 Compare May 18, 2023 00:12
@erlend-aasland
erlend-aasland requested review from erlend-aasland and zware May 18, 2023 21:15
@erlend-aasland erlend-aasland changed the title gh-104523: use dynamic rule for compiling libmpdec and libexpat gh-104523: Use dynamic rule for compiling libmpdec and libexpat May 18, 2023
@erlend-aasland erlend-aasland added the skip news label May 18, 2023
@erlend-aasland

erlend-aasland commented May 18, 2023

Copy link
Copy Markdown
Contributor

cc. also @ned-deily who has opinions about the build process.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@indygreg

indygreg commented May 18, 2023

Copy link
Copy Markdown
Contributor Author

FWIW I have a follow-up change to the module freezing code that is a net -100 lines on the diff which uses a similar approach to reduce make boilerplate and redundancy. That one more clearly demonstrates value in the general pattern than this one. But the justifications are basically the same.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@zware

zware commented May 18, 2023

Copy link
Copy Markdown
Member

Is this really more portable than the pattern rule approach? It's certainly more cryptic :)

In these particular cases, I'd personally like to work towards getting libmpdec and expat out of our repository entirely (i.e., make --with-system-expat --with-system-libmpdec the default and later only way to build), though that's a bigger project with a longer timeline. I wonder if it would make sense to pull in a bit extra from these packages for now in order to delegate to their own build system to build them instead of shoehorning them into ours, but a cursory look says that's probably more effort than it's worth.

This looks reasonable enough to try it on the buildbots, at least.

erlend-aasland reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@zware zware added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label May 18, 2023
@bedevere-bot

bedevere-bot commented May 18, 2023

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @zware for commit 44eda25 🤖

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label May 18, 2023
@zware

zware commented May 19, 2023

Copy link
Copy Markdown
Member

The buildbot failures don't look related to this change.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ned-deily

ned-deily commented May 19, 2023

Copy link
Copy Markdown
Member

The buildbot failures don't look related to this change.

@zware, it looks like the FreeBSD buildbot build didn't or hasn't run yet? I think this is the relevant buildrequest.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@zware

zware commented May 19, 2023

Copy link
Copy Markdown
Member

That worker has apparently been down for about 4 months now, though I can't tell at a glance if the fault lies on the client or server side (@koobs?)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland

erlend-aasland commented May 20, 2023

Copy link
Copy Markdown
Contributor

IMO, we should wait for 3.13 to open before landing this.

zware reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@indygreg

indygreg commented May 20, 2023

Copy link
Copy Markdown
Contributor Author

I didn't realize we were only days away from the end of the 3.12 new features window. I guess I'm so used to Rust and its 6 week release cadence.

Anyway, yes, I'm fine waiting until the 3.13 window to land more invasive build system changes. (Not like I have much choice in the matter.)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland
Merge branch 'main' into dynamic-build-rules
38b0c37
@erlend-aasland

erlend-aasland commented Jun 22, 2023

Copy link
Copy Markdown
Contributor

@indygreg: How does this fare on BSD Make?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland
Merge branch 'main' into dynamic-build-rules
d3cbd2b
@vstinner

vstinner commented Sep 4, 2023

Copy link
Copy Markdown
Member

On my FreeBSD, I can no longer build Python :-(

$ make
make: "/usr/home/vstinner/python/main/Makefile" line 1047: Invalid line type
make: "/usr/home/vstinner/python/main/Makefile" line 1050: Invalid line type
make: "/usr/home/vstinner/python/main/Makefile" line 1052: Invalid line type
make: "/usr/home/vstinner/python/main/Makefile" line 1062: Invalid line type
make: "/usr/home/vstinner/python/main/Makefile" line 1065: Invalid line type
make: "/usr/home/vstinner/python/main/Makefile" line 1067: Invalid line type
make: Fatal errors encountered -- cannot continue
make: stopped in /usr/home/vstinner/python/main

I have;

$ make -V MAKE_VERSION
20220208
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland

erlend-aasland commented Sep 4, 2023

Copy link
Copy Markdown
Contributor

On my FreeBSD, I can no longer build Python :-(

Could you build it on FreeBSD before this PR?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Sep 4, 2023

Copy link
Copy Markdown
Member

Could you build it on FreeBSD before this PR?

Sorry. I mean: currently, on the main branch of Python (without this PR), I can no longer build Python :-(

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland

erlend-aasland commented Sep 5, 2023

Copy link
Copy Markdown
Contributor

Could you build it on FreeBSD before this PR?

Sorry. I mean: currently, on the main branch of Python (without this PR), I can no longer build Python :-(

Aha, so this PR does not change the status quo! I suspected that. I guess we should clarify if was want to restore BSD Make compatibility, or carry on with GNU Make only.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Sep 5, 2023

Copy link
Copy Markdown
Member

Please fix building Python on FreeBSD before making the situation worse.

erlend-aasland reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Sep 5, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Sadly, the maintainer of our two FreBSD decided to remove them. Right now, there is no FreeBSD CI. We should consider CirrusCI.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Sep 5, 2023

Copy link
Copy Markdown
Member

I tested FreeBSD again, and I'm sorry, I didn't test make correctly previously.

  • Building Python in the main branch on FreeBSD is fine!
  • Building Python with this PR on FreeBSD no longer works

This PR introduces these issues in Makefile:

$ make
make: "/usr/home/vstinner/python/main/Makefile" line 1047: Invalid line type
make: "/usr/home/vstinner/python/main/Makefile" line 1050: Invalid line type
make: "/usr/home/vstinner/python/main/Makefile" line 1052: Invalid line type
make: "/usr/home/vstinner/python/main/Makefile" line 1062: Invalid line type
make: "/usr/home/vstinner/python/main/Makefile" line 1065: Invalid line type
make: "/usr/home/vstinner/python/main/Makefile" line 1067: Invalid line type
make: Fatal errors encountered -- cannot continue
make: stopped in /usr/home/vstinner/python/main

Surprise, surprise, it's the "non portable" part of this PR which introduces the issue. Like:

# "%.o: %c" is not portable
define libmpdec_compile
$(1): $$(srcdir)/$$(patsubst %.o,%.c,$(1)) $$(LIBMPDEC_HEADERS) $$(PYTHON_HEADERS)
        $$(CC) -c $$(LIBMPDEC_CFLAGS) -o $$@ $$<
endef
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

vstinner
vstinner requested changes Sep 5, 2023
View reviewed changes

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

While it's appealing to use cool GNU make features to make the Makefile shorter, I don't think that it's worth it if in exchange we break FreeBSD support.

FreeBSD is a Tier-3 platform: https://peps.python.org/pep-0011/

Is there another command which is compatible with GNU make and bsdmake?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-bot bedevere-bot removed the awaiting review label Sep 5, 2023
@bedevere-bot

bedevere-bot commented Sep 5, 2023

Copy link
Copy Markdown

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.

And if you don't make the requested changes, you will be put in the comfy chair!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot added the awaiting changes label Sep 5, 2023
@vstinner vstinner mentioned this pull request Sep 5, 2023
Add FreeBSD build and test using Cirrus-CI #91960
Closed
@erlend-aasland
Merge branch 'main' into dynamic-build-rules
444a7c1
@vstinner

vstinner commented Oct 4, 2023

Copy link
Copy Markdown
Member

@erlend-aasland: Is this change worth it if it breaks FreeBSD support? Should we just close it?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland

This comment was marked as outdated.

Sign in to view
@bedevere-bot

bedevere-bot commented Oct 4, 2023

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @erlend-aasland for commit 444a7c1 🤖

The command will test the builders whose names match following regular expression: .*freebsd.*

The builders matched are:

  • AMD64 FreeBSD PR
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland

This comment was marked as outdated.

Sign in to view
@bedevere-bot

This comment was marked as duplicate.

Sign in to view
@erlend-aasland

erlend-aasland commented Oct 4, 2023

Copy link
Copy Markdown
Contributor

@erlend-aasland: Is this change worth it if it breaks FreeBSD support? Should we just close it?

If it breaks FreeBSD support it is not worth it. There might be a more portable approach, though. cc. @indygreg

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Oct 4, 2023

Copy link
Copy Markdown
Member

If it breaks FreeBSD support it is not worth it.

Do you expect that FreeBSD buildbot will behave differently than my previous manual test?
#104574 (comment)

The PR didn't change in the meanwhile.

There might be a more portable approach, though. cc. @indygreg

I'm fine with any syntax as soon as it works on all platforms supported by Python ;-)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland

erlend-aasland commented Oct 4, 2023

Copy link
Copy Markdown
Contributor

Do you expect that FreeBSD buildbot will behave differently than my previous manual test? #104574 (comment)

The PR didn't change in the meanwhile.

Oh, I forgot you already tested this!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Oct 4, 2023

Copy link
Copy Markdown
Member

buildbot/AMD64 FreeBSD PR — Build done.

Fail to build:

 using PTY: False
make: "/buildbot/buildarea/pull_request.ware-freebsd/build/Makefile" line 1049: Invalid line type
make: "/buildbot/buildarea/pull_request.ware-freebsd/build/Makefile" line 1052: Invalid line type
make: "/buildbot/buildarea/pull_request.ware-freebsd/build/Makefile" line 1054: Invalid line type
make: "/buildbot/buildarea/pull_request.ware-freebsd/build/Makefile" line 1064: Invalid line type
make: "/buildbot/buildarea/pull_request.ware-freebsd/build/Makefile" line 1067: Invalid line type
make: "/buildbot/buildarea/pull_request.ware-freebsd/build/Makefile" line 1069: Invalid line type
make: stopped in /buildbot/buildarea/pull_request.ware-freebsd/build
make: Fatal errors encountered -- cannot continue
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@indygreg

indygreg commented Oct 4, 2023 via email

Copy link
Copy Markdown
Contributor Author
There’s a gmake port on FreeBSD, no? What’s wrong with requiring people to use gmake? Are there actually platforms where GNU Make isn’t trivially installable?
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Oct 5, 2023

Copy link
Copy Markdown
Member

What’s wrong with requiring people to use gmake?

It makes building Python on FreBSD more annoying and complicated.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Oct 5, 2023

Copy link
Copy Markdown
Member

If someone wants to use more advanced Makefile rule, I suggest to rewrite the whole Python build system with CMake, Meson or anything else.

erlend-aasland reacted with heart emoji rindeal reacted with rocket emoji
All reactions
  • ❤️ 1 reaction
  • 🚀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@encukou encukou added the build The build process and cross-build label Mar 8, 2024
@github-actions

github-actions Bot commented Apr 13, 2026

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 13, 2026
@koobs

koobs commented Apr 14, 2026

Copy link
Copy Markdown

unstale

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Apr 14, 2026

Copy link
Copy Markdown
Member

This change breaks support for BSD make on FreeBSD. I don't think that it's worth it, so I prefer to close it.

@zware:

In these particular cases, I'd personally like to work towards getting libmpdec and expat out of our repository entirely

For libmpdec, there is a concrete plan for that: #115119. This PR is mostly about libmpdec, it only changes 6 lines about expat.

Building Python with this PR on FreeBSD no longer works
(...)
While it's appealing to use cool GNU make features to make the Makefile shorter, I don't think that it's worth it if in exchange we break FreeBSD support.

If someone disagrees, please open a discussion on discuss.python.org suggesting to drop support for BSD make and require GNU make on FreeBSD.

There are also generic discussions about changing the whole Python build system, such as What do you want to see in tomorrow’s CPython build system?

@indygreg:

I think this is sufficiently portable. If not, there are alternatives to $(patsubst) that can be leveraged.

If someone wants to propose a PR using $(patsubst), please go ahead. I can test it on FreeBSD.

Another approach would be to generate the code for libmpdec, as we already do to build stdlib extension modules. (I'm not sure which code is involved, maybe Modules/makesetup.)

koobs reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner vstinner closed this Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@vstinner vstinner vstinner requested changes
@zware zware Awaiting requested review from zware
@erlend-aasland erlend-aasland Awaiting requested review from erlend-aasland erlend-aasland is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

awaiting changes build The build process and cross-build skip news stale Stale PR or inactive for long period of time.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

8 participants

@indygreg @erlend-aasland @zware @bedevere-bot @ned-deily @vstinner @koobs @encukou
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.