Closed shmilee closed 4 years ago
Thanks for the bug report.
What distro are you running? I've never seen /lib64/ld-linux-x86-64.so.2
symlinked before.
Anyway, this is a bug. Currently, this regex assumes that each line will be either:
/lib64/ld-linux-x86-64.so.2
)=>
absolute path (e.g. libc.so.6 => /usr/lib64/libc.so.6
)Here we have an absolute path with a symlink, and I never considered that. The regex (and potentially the subsequent logic in parse()
) need to be updated to handle this.
The distro is Arch.
@shmilee Can you try the branch in #118? It should fix your error. Also, what version of Arch are you running?
same error on my ArchLinux system
staticx dist/systeminfos dist_static/systeminfos
staticx: Unexpected line in ldd output: /lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f480501c000)
installing the branch via pip is not working for me.
@frankenstein91 Can you be more explicit? What is not working?
$ virtualenv -p python3 venv
Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /home/jreinhart/gitrepos/staticx/venv/bin/python3
Also creating executable in /home/jreinhart/gitrepos/staticx/venv/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.
$ . venv/bin/activate
$ git checkout 116-ld-linux-symlink
Switched to branch '116-ld-linux-symlink'
$ pip install .
Processing /home/jreinhart/gitrepos/staticx
Collecting pyelftools
Using cached pyelftools-0.26-py2.py3-none-any.whl (136 kB)
Building wheels for collected packages: staticx
Building wheel for staticx (setup.py) ... done
Created wheel for staticx: filename=staticx-0.9.0+5.g7e84cd7-py2.py3-none-any.whl size=840898 sha256=31071ab8740f422db786a8429d4790329fbeef0a2c067b070601759bd7dfe751
Stored in directory: /tmp/pip-ephem-wheel-cache-mun_6re0/wheels/bb/0d/73/dfdd715e269503b8d8dd3bd70aee70123a7dc9d1bae7a9ac0d
Successfully built staticx
Installing collected packages: pyelftools, staticx
Successfully installed pyelftools-0.26 staticx-0.9.0+5.g7e84cd7
$ staticx --version
staticx 0.9.0+5.g7e84cd7
I have used this line from a pip howto:
pip install git+https://github.com/JonathonReinhart/staticx@7e84cd7f9eec94672b04b678f89f8fecb1e4c793
I have tried your way of install. I get the same error.
pip install .
Processing /home/MyUsername/Downloads/staticx
Requirement already satisfied: pyelftools in /home/MyUsername/MyIDE/MyProject/venv/lib/python3.8/site-packages (from staticx==0.9.0+5.g7e84cd7) (0.26)
Installing collected packages: staticx
Attempting uninstall: staticx
Found existing installation: staticx 0.9.0
Uninstalling staticx-0.9.0:
Successfully uninstalled staticx-0.9.0
Running setup.py install for staticx ... error
ERROR: Command errored out with exit status 1:
command: /home/MyUsername/MyIDE/MyProject/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-v7f5n6dd/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-v7f5n6dd/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-xbplejbf/install-record.txt --single-version-externally-managed --compile --install-headers /home/MyUsername/MyIDE/MyProject/venv/include/site/python3.8/staticx
cwd: /tmp/pip-req-build-v7f5n6dd/
Complete output (84 lines):
/home/MyUsername/MyIDE/MyProject/venv/lib/python3.8/site-packages/setuptools/dist.py:473: UserWarning: Normalizing '0.9.0+5-g7e84cd7' to '0.9.0+5.g7e84cd7'
warnings.warn(
running install
running build
running build_bootloader
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
gcc -o scons_build/debug/bootloader/error.o -c -std=gnu99 -Wall -Werror -Wmissing-prototypes -Wstrict-prototypes -static -g -DDEBUG=1 -DSTATICX_VERSION=\"0.9.0+5-g7e84cd7\" -Ilibtar -Ilibxz bootloader/error.c
gcc -o scons_build/debug/bootloader/elfutil.o -c -std=gnu99 -Wall -Werror -Wmissing-prototypes -Wstrict-prototypes -static -g -DDEBUG=1 -DSTATICX_VERSION=\"0.9.0+5-g7e84cd7\" -Ilibtar -Ilibxz bootloader/elfutil.c
gcc -o scons_build/debug/bootloader/extract.o -c -std=gnu99 -Wall -Werror -Wmissing-prototypes -Wstrict-prototypes -static -g -DDEBUG=1 -DSTATICX_VERSION=\"0.9.0+5-g7e84cd7\" -Ilibtar -Ilibxz bootloader/extract.c
gcc -o scons_build/debug/bootloader/main.o -c -std=gnu99 -Wall -Werror -Wmissing-prototypes -Wstrict-prototypes -static -g -DDEBUG=1 -DSTATICX_VERSION=\"0.9.0+5-g7e84cd7\" -Ilibtar -Ilibxz bootloader/main.c
gcc -o scons_build/debug/bootloader/mmap.o -c -std=gnu99 -Wall -Werror -Wmissing-prototypes -Wstrict-prototypes -static -g -DDEBUG=1 -DSTATICX_VERSION=\"0.9.0+5-g7e84cd7\" -Ilibtar -Ilibxz bootloader/mmap.c
gcc -o scons_build/debug/bootloader/util.o -c -std=gnu99 -Wall -Werror -Wmissing-prototypes -Wstrict-prototypes -static -g -DDEBUG=1 -DSTATICX_VERSION=\"0.9.0+5-g7e84cd7\" -Ilibtar -Ilibxz bootloader/util.c
gcc -o scons_build/debug/libtar/block.o -c -std=gnu99 -Wall -Werror -Wmissing-prototypes -Wstrict-prototypes -g -DPACKAGE_VERSION=\"1.2.20\" -Ilibtar -Ilibxz -Iscons_build/debug/libtar/compat -Ilibtar/compat libtar/block.c
gcc -o scons_build/debug/libtar/decode.o -c -std=gnu99 -Wall -Werror -Wmissing-prototypes -Wstrict-prototypes -g -DPACKAGE_VERSION=\"1.2.20\" -Ilibtar -Ilibxz -Iscons_build/debug/libtar/compat -Ilibtar/compat libtar/decode.c
gcc -o scons_build/debug/libtar/extract.o -c -std=gnu99 -Wall -Werror -Wmissing-prototypes -Wstrict-prototypes -g -DPACKAGE_VERSION=\"1.2.20\" -Ilibtar -Ilibxz -Iscons_build/debug/libtar/compat -Ilibtar/compat libtar/extract.c
gcc -o scons_build/debug/libtar/handle.o -c -std=gnu99 -Wall -Werror -Wmissing-prototypes -Wstrict-prototypes -g -DPACKAGE_VERSION=\"1.2.20\" -Ilibtar -Ilibxz -Iscons_build/debug/libtar/compat -Ilibtar/compat libtar/handle.c
gcc -o scons_build/debug/libtar/output.o -c -std=gnu99 -Wall -Werror -Wmissing-prototypes -Wstrict-prototypes -g -DPACKAGE_VERSION=\"1.2.20\" -Ilibtar -Ilibxz -Iscons_build/debug/libtar/compat -Ilibtar/compat libtar/output.c
gcc -o scons_build/debug/libtar/util.o -c -std=gnu99 -Wall -Werror -Wmissing-prototypes -Wstrict-prototypes -g -DPACKAGE_VERSION=\"1.2.20\" -Ilibtar -Ilibxz -Iscons_build/debug/libtar/compat -Ilibtar/compat libtar/util.c
gcc -o scons_build/debug/libtar/compat/strlcpy.o -c -std=gnu99 -Wall -Werror -Wmissing-prototypes -Wstrict-prototypes -g -DPACKAGE_VERSION=\"1.2.20\" -Ilibtar -Ilibxz -Iscons_build/debug/libtar/compat -Ilibtar/compat libtar/compat/strlcpy.c
gcc -o scons_build/debug/libtar/compat/strmode.o -c -std=gnu99 -Wall -Werror -Wmissing-prototypes -Wstrict-prototypes -g -DPACKAGE_VERSION=\"1.2.20\" -Ilibtar -Ilibxz -Iscons_build/debug/libtar/compat -Ilibtar/compat libtar/compat/strmode.c
ar rc scons_build/debug/libtar/libtar.a scons_build/debug/libtar/block.o scons_build/debug/libtar/decode.o scons_build/debug/libtar/extract.o scons_build/debug/libtar/handle.o scons_build/debug/libtar/output.o scons_build/debug/libtar/util.o scons_build/debug/libtar/compat/strlcpy.o scons_build/debug/libtar/compat/strmode.o
ranlib scons_build/debug/libtar/libtar.a
Install file: "scons_build/debug/libtar/libtar.a" as "scons_build/debug/lib/libtar.a"
gcc -o scons_build/debug/libxz/xz_crc32.o -c -std=gnu99 -Wall -Werror -Wmissing-prototypes -Wstrict-prototypes -g -DDEBUG=1 -DXZ_DEC_X86=1 -Ilibtar -Ilibxz libxz/xz_crc32.c
gcc -o scons_build/debug/libxz/xz_dec_lzma2.o -c -std=gnu99 -Wall -Werror -Wmissing-prototypes -Wstrict-prototypes -g -DDEBUG=1 -DXZ_DEC_X86=1 -Ilibtar -Ilibxz libxz/xz_dec_lzma2.c
gcc -o scons_build/debug/libxz/xz_dec_stream.o -c -std=gnu99 -Wall -Werror -Wmissing-prototypes -Wstrict-prototypes -g -DDEBUG=1 -DXZ_DEC_X86=1 -Ilibtar -Ilibxz libxz/xz_dec_stream.c
gcc -o scons_build/debug/libxz/xz_dec_bcj.o -c -std=gnu99 -Wall -Werror -Wmissing-prototypes -Wstrict-prototypes -g -DDEBUG=1 -DXZ_DEC_X86=1 -Ilibtar -Ilibxz libxz/xz_dec_bcj.c
ar rc scons_build/debug/libxz/libxz.a scons_build/debug/libxz/xz_crc32.o scons_build/debug/libxz/xz_dec_lzma2.o scons_build/debug/libxz/xz_dec_stream.o scons_build/debug/libxz/xz_dec_bcj.o
ranlib scons_build/debug/libxz/libxz.a
Install file: "scons_build/debug/libxz/libxz.a" as "scons_build/debug/lib/libxz.a"
gcc -o scons_build/debug/bootloader/bootloader -static scons_build/debug/bootloader/error.o scons_build/debug/bootloader/elfutil.o scons_build/debug/bootloader/extract.o scons_build/debug/bootloader/main.o scons_build/debug/bootloader/mmap.o scons_build/debug/bootloader/util.o -Lscons_build/debug/lib -ltar -lxz
/bin/ld: scons_build/debug/lib/libtar.a(output.o): in function `th_print_long_ls':
/tmp/pip-req-build-v7f5n6dd/libtar/output.c:59: warning: Using 'getgrgid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/bin/ld: scons_build/debug/lib/libtar.a(decode.o): in function `th_get_gid':
/tmp/pip-req-build-v7f5n6dd/libtar/decode.c:65: warning: Using 'getgrnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/bin/ld: scons_build/debug/lib/libtar.a(decode.o): in function `th_get_uid':
/tmp/pip-req-build-v7f5n6dd/libtar/decode.c:49: warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/bin/ld: scons_build/debug/lib/libtar.a(output.o): in function `th_print_long_ls':
/tmp/pip-req-build-v7f5n6dd/libtar/output.c:52: warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
gcc -o scons_build/release/bootloader/error.o -c -std=gnu99 -Wall -Werror -Wmissing-prototypes -Wstrict-prototypes -static -Os -DNDEBUG=1 -DSTATICX_VERSION=\"0.9.0+5-g7e84cd7\" -Ilibtar -Ilibxz bootloader/error.c
gcc -o scons_build/release/bootloader/elfutil.o -c -std=gnu99 -Wall -Werror -Wmissing-prototypes -Wstrict-prototypes -static -Os -DNDEBUG=1 -DSTATICX_VERSION=\"0.9.0+5-g7e84cd7\" -Ilibtar -Ilibxz bootloader/elfutil.c
gcc -o scons_build/release/bootloader/extract.o -c -std=gnu99 -Wall -Werror -Wmissing-prototypes -Wstrict-prototypes -static -Os -DNDEBUG=1 -DSTATICX_VERSION=\"0.9.0+5-g7e84cd7\" -Ilibtar -Ilibxz bootloader/extract.c
gcc -o scons_build/release/bootloader/main.o -c -std=gnu99 -Wall -Werror -Wmissing-prototypes -Wstrict-prototypes -static -Os -DNDEBUG=1 -DSTATICX_VERSION=\"0.9.0+5-g7e84cd7\" -Ilibtar -Ilibxz bootloader/main.c
In function 'create_tmpdir',
inlined from 'main' at bootloader/main.c:393:20:
bootloader/main.c:211:9: error: '%s' directive argument is null [-Werror=format-overflow=]
211 | error(2, errno, "Failed to create temporary directory: %s", tmpdir);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
scons: *** [scons_build/release/bootloader/main.o] Error 1
scons: building terminated because of errors.
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-req-build-v7f5n6dd/setup.py", line 46, in <module>
setup(
File "/home/MyUsername/MyIDE/MyProject/venv/lib/python3.8/site-packages/setuptools/__init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.8/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.8/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/MyUsername/MyIDE/MyProject/venv/lib/python3.8/site-packages/setuptools/command/install.py", line 61, in run
return orig.install.run(self)
File "/usr/lib/python3.8/distutils/command/install.py", line 545, in run
self.run_command('build')
File "/usr/lib/python3.8/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/tmp/pip-req-build-v7f5n6dd/setup.py", line 34, in run
self.run_command('build_bootloader')
File "/usr/lib/python3.8/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/tmp/pip-req-build-v7f5n6dd/setup.py", line 29, in run
check_call(args)
File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['scons']' returned non-zero exit status 2.
----------------------------------------
Rolling back uninstall of staticx
Moving to /home/MyUsername/MyIDE/MyProject/venv/bin/staticx
from /tmp/pip-uninstall-2llzichm/staticx
Moving to /home/MyUsername/MyIDE/MyProject/venv/lib/python3.8/site-packages/staticx-0.9.0.dist-info/
from /home/MyUsername/MyIDE/MyProject/venv/lib/python3.8/site-packages/~taticx-0.9.0.dist-info
Moving to /home/MyUsername/MyIDE/MyProject/venv/lib/python3.8/site-packages/staticx/
from /home/MyUsername/MyIDE/MyProject/venv/lib/python3.8/site-packages/~taticx
ERROR: Command errored out with exit status 1: /home/MyUsername/MyIDE/MyProject/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-v7f5n6dd/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-v7f5n6dd/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-xbplejbf/install-record.txt --single-version-externally-managed --compile --install-headers /home/MyUsername/MyIDE/MyProject/venv/include/site/python3.8/staticx Check the logs for full command output.
pip freeze
altgraph==0.17
cached-property==1.5.1
chardet==3.0.4
distro==1.4.0
patchelf-wrapper==1.1.0
pycrypto==2.6.1
pyelftools==0.26
PyInstaller==3.6
pylspci==0.3.1
pyusb==1.0.2
scons==3.1.2
staticx==0.9.0
@frankenstein91 I opened #119 to track that issue. Can you please comment there and indicate the output of gcc --version
?
As a quick workaround so we can test this fix, you can hack out -Werror
from SConstruct
.
I fixed #119 and rebased this branch onto latest master
. Please try again.
it is working... but with a lot of warnings.
I have sent the bin file generated to an Ubuntu VM and get a Segmentation fault error there. Don't know why. On the system where i have created the file, it is working.
@frankenstein91 Can you open an issue with details for a minimally reproducing example?
@frankenstein91 Can you open an issue with details for a minimally reproducing example?
it is one import... could take a while.... "hallo world" has no problem
Error info:
pull https://github.com/JonathonReinhart/staticx/pull/102,
staticx/elf.py
line 147-149fix: