intoli / exodus

Painless relocation of Linux binaries–and all of their dependencies–without containers.
Other
2.93k stars 71 forks source link

pyinstaller --onefile output elf does not work #48

Open cainiaocome opened 6 years ago

cainiaocome commented 6 years ago

os: ubuntu16.04 server cpu: x86-64 python: 3.6.3

"pyinstaller --onefile t.py" output an elf file, t.

exodus ./dist/t -o /tmp/t -> ok

/tmp/t -> ok

/opt/exodus/bin/t -> error

error detail:

[4092] Cannot open self /opt/exodus/bundles/3cad7d5bdde37965bddba10dea540f3609875ee80cb5215cabb459b05c5880ea/root/tmp/dist/linker-6d0bfd685a7ad6dfccae1fae70c1f06018a0f756c53de0aabb609456a10f3747 or archive /opt/exodus/bundles/3cad7d5bdde37965bddba10dea540f3609875ee80cb5215cabb459b05c5880ea/root/tmp/dist/linker-6d0bfd685a7ad6dfccae1fae70c1f06018a0f756c53de0aabb609456a10f3747.pkg

sangaline commented 6 years ago

This is most likely happening because the pyinstaller bundle is probably using readlink("/proc/self/exe") to determine its own location. That corresponds to the linker rather than the original executable in an Exodus bundle. This is also an issue for several other complex applications like Firefox. There are plans in place to preload a readlink symbol which "lies" about the executable path, but this is made difficult by the fact that different systems might have very different glibc versions.

I'm guessing that it doesn't work if you don't use --onefile either? If the pyinstaller bundle only uses /proc/self/exe to determine the directory, and then expects a specific filename within that directory for the package, it might work.