unikraft / static-pie-apps

Built Linux applications (static-pie) for Unikraft binary compatibility mode
7 stars 40 forks source link

Add python static PIE example #10

Open RazorBest opened 2 years ago

RazorBest commented 2 years ago

Built python from source code to a static PIE file. Even after that, the interpreter needs some external files from running. Probably, all the needed files are in rootfs/Lib.

Although after running strace, it shows that beside Lib, it also reads from other files:

$ strace -e openat ./python

openat(AT_FDCWD, "/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache", O_RDONLY) = 3
openat(AT_FDCWD, "/home/marius/Desktop/work/unikraft-dev/static-pie-apps/python/Python-3.10.5/pyvenv.cfg", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/marius/Desktop/work/unikraft-dev/static-pie-apps/python/pyvenv.cfg", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/marius/Desktop/work/unikraft-dev/static-pie-apps/python/Python-3.10.5/pybuilddir.txt", O_RDONLY) = 3
openat(AT_FDCWD, "/etc/localtime", O_RDONLY|O_CLOEXEC) = 3
...
...