actions / setup-python

Set up your GitHub Actions workflow with a specific version of Python
MIT License
1.74k stars 551 forks source link

provide python without RUNPATH for staticx-support #325

Open Andrwe opened 2 years ago

Andrwe commented 2 years ago

Description: I want to use this project as GH action to generate a statically linked python binary using staticx.

While implementing the workflow I ran into https://github.com/JonathonReinhart/staticx/issues/188 due to the usage DT_RUNPATH.

It would be nice to have a setup-python version which does not use RUNPATH for use-cases like this.

Justification: I understand that using RUNPATH simplifies the process of provinding a self-contained and reusable venv. Unfortunately for running staticx that is bad because the generated binary will check the path defined by RUNPATH on the system running it and not be fully self-contained.

Are you willing to submit a PR? Yes, but unfortunately I don't know TypeScript and cannot grasp the work required.

MaksimZhukov commented 2 years ago

Hello @Andrwe! Thank you for the report. We'll investigate it

joaompinto commented 1 year ago

@MaksimZhukov , this is a major blocker to the Python community which is currently unable to build universal (static binaries) using the standard setup-python action.

Is there something we can do to try to prioritize the work on this ? (I am also not a typescript developer).

Thanks

MaksimZhukov commented 1 year ago

Thank you for letting us know about the issue importance! We will prioritise this issue and get back to you with the results of the investigation!

joaompinto commented 1 year ago

Thanks for the quick update.

Meanwhile I will try to find some stamina to build and maintain alternative action so that we can use more specifically for staticx builds.

th3w1zard1 commented 8 months ago

+1

building python from source is always an option. Since this issue is over a year old with no update, I figure I should provide my fellow googlers with my solution.

Here's the job step I use in my workflow:

    - name: Set up Python ${{ matrix.python-version }} Linux
      if: ${{ runner.os == 'Linux' }}
      run: |
        sudo apt-get update
        sudo apt-get install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev libbz2-dev tk-dev -y
        $pyVersion = switch ("${{ matrix.python-version }}") {
          "3.7" { "3.7.17" }
          "3.8" { "3.8.18" }
          "3.9" { "3.9.18" }
          "3.10" { "3.10.13" }
          "3.11" { "3.11.8" }
          "3.12" { "3.12.2" }
        }
        Write-Output "Downloading python '$pyVersion'..."
        Invoke-WebRequest -Uri https://www.python.org/ftp/python/$pyVersion/Python-$pyVersion.tgz -OutFile Python-$pyVersion.tgz
        tar -xvf Python-$pyVersion.tgz
        $current_working_dir = (Get-Location).Path
        Set-Location -LiteralPath "Python-$pyVersion" -ErrorAction Stop
        $env:LDFLAGS="-Wl,-rpath=/usr/local/lib"
        sudo ./configure --enable-optimizations --with-ensurepip=install --enable-shared --disable-new-dtags
        sudo make -j $(nproc)
        sudo make altinstall
        Set-Location -LiteralPath $current_working_dir
      shell: pwsh