StanfordSNR / gg

The Stanford Builder

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue with running python binaries built with pyinstaller and nuitka on lambda

drunksaint opened this issue · comments

Looks like binaries built with pyinstaller also have an issue running on lambda because of missing libs.
The error I'm getting:

$ gg infer pifiletest input.txt output.txt
VVT6QIgWxow5uZy7AC9yROP30219jnslAkVB82NWD3qU00000012
Vdp0Lbxv2ptpS4llaXGFsGNlp46eo_de7DN1Ezd.Fd0A0058e210
TQdYV6nH0NF1PBNecJur6pVhDsn8ZObn4zqk6Yoq82jY00000153

$ gg force --engine lambda output.txt 
→ Loading the thunks...  done (0 ms).
↗ Uploading 2 files (5.6 MiB)... done (4296 ms).
[7] Error loading Python lib '/tmp/_MEIovTa5m/libpython3.7m.so.1.0': dlopen: /lib64/libc.so.6: version `GLIBC_2.25' not found (required by /tmp/_MEIovTa5m/libpython3.7m.so.1.0)
rmdir /tmp/thunk-execute.3QkvHd: Directory not empty
std::exception
 `TQdYV6nH0NF1PBNecJur6pVhDsn8ZObn4zqk6Yoq82jY00000153': process exited with failure status 255

gg-force: execution failed: TQdYV6nH0NF1PBNecJur6pVhDsn8ZObn4zqk6Yoq82jY00000153

$ gg force output.txt 
→ Loading the thunks...  done (0 ms).

$

My wrapper file:

#!/bin/bash
gg collect $1
gg collect pifiletest
gg create-thunk \
    --value $(gg hash $1) \
    --output $2 \
    --executable $(gg hash pifiletest) \
    --placeholder $2 \
    --link $1=$(gg hash $1) \
    --link pifiletest=$(gg hash pifiletest) \
    -- $(gg hash pifiletest) pifiletest $1 $2

I built the pyinstaller binary with pyinstaller --onefile pifiletest.py --distpath .

Hi @drunksaint,

The problem is that there's a mismatch between the glibc version on your computer and on Lambda.

This is slightly different from the issue we were having with Nuitka. Although PyInstaller has packed all the necessary libraries into the executable, it still relies on the host's glibc. The package was created on a system with glibc v2.25, but Lambda comes with v2.17.

The easiest solution, I think, is to run PyInstaller in the same runtime environment as Lambda, which typically requires starting a new EC2 instance with the proper image.

Also, take a look at the first question here. There's a second solution based on StaticX which allows you to also packet your own gblic in the binary.

--Sadjad

Ah I see, building it on ec2 with the aws linux 1 ami fixed the pyinstaller issue!