|
| 1 | +Prompt: |
| 2 | +The build completed and released. I tried to run the Linux app, but the app doesn't run on my Ubuntu machine. I get the following error: |
| 3 | +[PYI-1418557:ERROR] Failed to extract libX11.so.6: decompression resulted in return code -3! |
| 4 | +[PYI-1418557:ERROR] Failed to extract entry: libX11.so.6. |
| 5 | + |
| 6 | +Response: |
| 7 | +You have officially hit the final boss of cross-platform Python development: **Linux system library compatibility**. |
| 8 | + |
| 9 | +This `decompression resulted in return code -3` error involving `libX11` is incredibly common when distributing Linux binaries. Here is exactly why it happens and how to fix it. |
| 10 | + |
| 11 | +### The Problem: Forward vs. Backward Compatibility |
| 12 | + |
| 13 | +When you tell GitHub Actions to build on `ubuntu-latest`, it uses a very recent version of Ubuntu (currently either 22.04 or 24.04). |
| 14 | + |
| 15 | +PyInstaller bundles your game along with the core system libraries (like `glibc` and `libX11`) present on that GitHub server. The golden rule of Linux binaries is: **They are forward-compatible, but rarely backward-compatible.** If the Ubuntu machine you are testing the game on is older than the GitHub server that built it, your system doesn't know how to decompress or read those newer library files, causing it to crash immediately upon extraction. PyInstaller can also be a bit too aggressive in bundling host system libraries that it really should just leave alone. |
| 16 | + |
| 17 | +### The Fix: Build on an Older Ubuntu Version |
| 18 | + |
| 19 | +The standard industry fix for distributing standalone Linux apps is to build them on the **oldest supported version** of the OS you can. An app built on Ubuntu 20.04 will run perfectly fine on Ubuntu 22.04, 24.04, and most modern Linux distributions (Mint, Fedora, etc.). |
| 20 | + |
| 21 | +All you need to do is change one line in your `build.yml` file. |
| 22 | + |
| 23 | +**Step 1: Update your Matrix Strategy** |
| 24 | +Find the `matrix:` block under your `build` job and change `ubuntu-latest` to `ubuntu-20.04`. |
| 25 | + |
| 26 | +```yaml |
| 27 | + strategy: |
| 28 | + matrix: |
| 29 | + # Change ubuntu-latest to ubuntu-20.04 |
| 30 | + os: [ubuntu-20.04, windows-latest, macos-latest] |
| 31 | + |
| 32 | +``` |
| 33 | + |
| 34 | +**Step 2: Commit, Tag, and Push** |
| 35 | +Save the file, commit it, and push a new tag to trigger the build. |
| 36 | + |
| 37 | +```bash |
| 38 | +git commit -am "Downgrade Ubuntu runner to 20.04 for broader Linux compatibility" |
| 39 | +git push |
| 40 | +git tag v1.0.4 |
| 41 | +git push origin v1.0.4 |
| 42 | + |
| 43 | +``` |
| 44 | + |
| 45 | +### A Quick Note on the Artifact Name |
| 46 | + |
| 47 | +Because we changed the matrix name, the downloaded zip file for Linux on your Releases page will now be named `MyPygameApp-ubuntu-20.04` instead of `MyPygameApp-ubuntu-latest`. This is actually helpful, as it clearly indicates to users what baseline system it was built for! |
| 48 | + |
| 49 | +Try that downgraded runner and see if the resulting binary successfully executes on your local machine. It resolves this specific PyInstaller decompression crash the vast majority of the time. |
0 commit comments