bazel-contrib / bazel-contrib/rules_python

Fixing search path of boostrapped Python toolchain dylib is not hermetic

Offen
#3,223 9 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
need: upstream support type: toolchain
Vorherrschende Sprache
Starlark
Sterne
688
Forks
721
Ø Merge
15 Std. 7 Min.
Gemergte PRs (30 T.)
76

Beschreibung

Change #2089 breaks multi-platform builds. The contents of `libpython.dylib` differ depending on which host machine runs the build, since `if "darwin" in platform and "osx" == repo_utils.get_platforms_os_name(rctx)` checks the host machine not the execution platform. This change, if it has to happen conditionally, needs to happen in a build target instead.

```
$ diffoscope /tmp/local.libpython3.11.dylib /tmp/remote.libpython3.11.dylib
--- /tmp/local.libpython3.11.dylib
+++ /tmp/remote.libpython3.11.dylib
├── arm64
│ ├── otool -arch arm64 -h {}
│ │ @@ -1,3 +1,3 @@
│ │ Mach header
│ │ magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
│ │ - 0xfeedfacf 16777228 0 0x00 6 32 4544 0x00100085
│ │ + 0xfeedfacf 16777228 0 0x00 6 32 4552 0x00100085
│ ├── otool -arch arm64 -L {}
│ │ @@ -1,8 +1,8 @@
│ │ - @rpath/libpython3.11.dylib (compatibility version 3.11.0, current version 3.11.0)
│ │ + /install/lib/libpython3.11.dylib (compatibility version 3.11.0, current version 3.11.0)
│ │ /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1336.61.1)
│ │ /usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current version 5.4.0)
│ │ /usr/lib/libpanel.5.4.dylib (compatibility version 5.4.0, current version 5.4.0)
│ │ /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 2202.0.0)
│ │ /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
│ │ /System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration (compatibility version 1.0.0, current version 1296.60.3)
```

_Originally posted by @brentleyjones in https://github.com/bazel-contrib/rules_python/issues/2089#issuecomment-3234021683_

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Start by reviewing change #2089 and the code containing the platform check for libpython.dylib, focusing on whether it reads the host or execution platform. Reproduce the local-versus-remote diffoscope comparison, then verify that multi-platform builds produce identical dylib contents regardless of the host machine.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
build-system
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
48/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.