Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provide python without RUNPATH for staticx-support #325

Open
Andrwe opened this issue Jan 31, 2022 · 5 comments
Open

provide python without RUNPATH for staticx-support #325

Andrwe opened this issue Jan 31, 2022 · 5 comments
Labels
feature request New feature or request to improve the current logic

Comments

@Andrwe
Copy link

Andrwe commented Jan 31, 2022

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 JonathonReinhart/staticx#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.

@Andrwe Andrwe added feature request New feature or request to improve the current logic needs triage labels Jan 31, 2022
@MaksimZhukov
Copy link
Contributor

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

vbaltrusaitis-reef added a commit to vbaltrusaitis-reef/terraform-provider-b2 that referenced this issue Feb 16, 2023
setup-python GitHub action on Ubuntu is incompatible with staticx. See:
* actions/setup-python#325
* JonathonReinhart/staticx#188
* https://staticx.readthedocs.io/en/latest/rpath.html

However, deadsnakes action installs Ubuntu package from PPA and it
doesn't cause this problem. Hence, we use this action for Python setup
on Ubuntu.
@joaompinto
Copy link

@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
Copy link
Contributor

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

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.

@nikolai-laevskii nikolai-laevskii self-assigned this Jul 5, 2023
JonathonReinhart added a commit to JonathonReinhart/staticx that referenced this issue Jul 7, 2023
We use Python from the deadsnakes Ubuntu PPA because the Python from
actions/setup-python links with RUNPATH which is not compatible with
StaticX. Thanks @jmsmkn for the tip and initial implementation in #224.

https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa
actions/setup-python#325
JonathonReinhart added a commit to JonathonReinhart/staticx that referenced this issue Jul 7, 2023
We use Python from the deadsnakes Ubuntu PPA because the Python from
actions/setup-python links with RUNPATH which is not compatible with
StaticX. Thanks @jmsmkn for the tip and initial implementation in #224.

https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa
actions/setup-python#325
@nikolai-laevskii nikolai-laevskii removed their assignment Jul 11, 2023
@th3w1zard1
Copy link

+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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request to improve the current logic
Projects
None yet
Development

No branches or pull requests

5 participants