-
-
Notifications
You must be signed in to change notification settings - Fork 217
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
[Bug] ELF load command address/offset not properly aligned #1048
Comments
Desktop (please complete the following information):
|
Here !
|
I looked at your example, over the top, I don't have time to test it now. However, I see that you use a version of python compiled from sources, so I believe that some configuration options are missing (line 15 of the Dockerfile). Use: |
Do you have success? |
I cant solve it.. I try it like below. ...
RUN tar xJvf Python-3.9.5.tar.xz \
&& cd Python-3.9.5 \
&& ./configure --enable-shared --enable-ipv6
RUN cd Python-3.9.5 \
&& LDFLAGS_NODIST="-Wl,-rpath,/usr/local/lib" make \
&& make altinstall
... sh-4.2# build_test
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/cx_Freeze/initscripts/__startup__.py", line 81, in run
module.run()
File "/usr/local/lib/python3.9/site-packages/cx_Freeze/initscripts/Console.py", line 36, in run
exec(code, m.__dict__)
File "build_test/__main__.py", line 1, in <module>
from build_test.hello import hello
File "<frozen zipimport>", line 259, in load_module
File "/code/build/bdist.linux-x86_64/rpm/BUILD/build_test-0.0.1/build_test/hello.py", line 1, in <module>
File "<frozen zipimport>", line 259, in load_module
File "/usr/local/lib/python3.9/site-packages/paramiko/__init__.py", line 22, in <module>
from paramiko.transport import SecurityOptions, Transport
File "<frozen zipimport>", line 259, in load_module
File "/usr/local/lib/python3.9/site-packages/paramiko/transport.py", line 89, in <module>
from paramiko.dsskey import DSSKey
File "<frozen zipimport>", line 259, in load_module
File "/usr/local/lib/python3.9/site-packages/paramiko/dsskey.py", line 37, in <module>
from paramiko.pkey import PKey
File "<frozen zipimport>", line 259, in load_module
File "/usr/local/lib/python3.9/site-packages/paramiko/pkey.py", line 31, in <module>
import bcrypt
File "<frozen zipimport>", line 259, in load_module
File "/usr/local/lib/python3.9/site-packages/bcrypt/__init__.py", line 25, in <module>
from . import _bcrypt # type: ignore
ImportError: /usr/local/lib/build_test-0.0.1/lib/_cffi_backend.cpython-39-x86_64-linux-gnu.so: ELF load command address/offset not properly aligned |
|
Do you get this project running in this image? There are some issues to run a py39 in centos7. I had preliminary work with manylinux2010 (centos6) but you can adapt to use manylinux2014 (centos7). |
I use CentOS 7(+python3.9) on-premise server in production. I try it, then i get an error. # https://github.com/pypa/manylinux
FROM quay.io/pypa/manylinux2014_x86_64
COPY requirements.txt requirements.txt python3.9 -m install -r requirements.txtInstalling collected packages: cx-freeze
Running setup.py install for cx-freeze ... error
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-_bkrfu6z/cx-freeze_c851ee3ebfbb4cabad3e02bae3465dcb/setup.py'"'"'; __file__='"'"'/tmp/pip-install-_bkrfu6z/cx-freeze_c851ee3ebfbb4cabad3e02bae3465dcb/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-7duxfrih/install-record.txt --single-version-externally-managed --compile --install-headers /opt/_internal/cpython-3.9.5/include/python3.9/cx-freeze
cwd: /tmp/pip-install-_bkrfu6z/cx-freeze_c851ee3ebfbb4cabad3e02bae3465dcb/
Complete output (40 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.9
creating build/lib.linux-x86_64-3.9/cx_Freeze
copying cx_Freeze/finder.py -> build/lib.linux-x86_64-3.9/cx_Freeze
copying cx_Freeze/cli.py -> build/lib.linux-x86_64-3.9/cx_Freeze
copying cx_Freeze/macdist.py -> build/lib.linux-x86_64-3.9/cx_Freeze
copying cx_Freeze/__main__.py -> build/lib.linux-x86_64-3.9/cx_Freeze
copying cx_Freeze/setupwriter.py -> build/lib.linux-x86_64-3.9/cx_Freeze
copying cx_Freeze/common.py -> build/lib.linux-x86_64-3.9/cx_Freeze
copying cx_Freeze/windist.py -> build/lib.linux-x86_64-3.9/cx_Freeze
copying cx_Freeze/darwintools.py -> build/lib.linux-x86_64-3.9/cx_Freeze
copying cx_Freeze/dist.py -> build/lib.linux-x86_64-3.9/cx_Freeze
copying cx_Freeze/freezer.py -> build/lib.linux-x86_64-3.9/cx_Freeze
copying cx_Freeze/__init__.py -> build/lib.linux-x86_64-3.9/cx_Freeze
copying cx_Freeze/executable.py -> build/lib.linux-x86_64-3.9/cx_Freeze
copying cx_Freeze/winversioninfo.py -> build/lib.linux-x86_64-3.9/cx_Freeze
copying cx_Freeze/winmsvcr.py -> build/lib.linux-x86_64-3.9/cx_Freeze
copying cx_Freeze/exception.py -> build/lib.linux-x86_64-3.9/cx_Freeze
copying cx_Freeze/patchelf.py -> build/lib.linux-x86_64-3.9/cx_Freeze
copying cx_Freeze/module.py -> build/lib.linux-x86_64-3.9/cx_Freeze
copying cx_Freeze/hooks.py -> build/lib.linux-x86_64-3.9/cx_Freeze
creating build/lib.linux-x86_64-3.9/cx_Freeze/initscripts
copying cx_Freeze/initscripts/ConsoleSetLibPath.py -> build/lib.linux-x86_64-3.9/cx_Freeze/initscripts
copying cx_Freeze/initscripts/SharedLib.py -> build/lib.linux-x86_64-3.9/cx_Freeze/initscripts
copying cx_Freeze/initscripts/__startup__.py -> build/lib.linux-x86_64-3.9/cx_Freeze/initscripts
copying cx_Freeze/initscripts/SharedLibSource.py -> build/lib.linux-x86_64-3.9/cx_Freeze/initscripts
copying cx_Freeze/initscripts/Console.py -> build/lib.linux-x86_64-3.9/cx_Freeze/initscripts
running build_ext
creating build/temp.linux-x86_64-3.9
creating build/temp.linux-x86_64-3.9/source
creating build/temp.linux-x86_64-3.9/source/bases
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/opt/_internal/cpython-3.9.5/include/python3.9 -c source/bases/Console.c -o build/temp.linux-x86_64-3.9/source/bases/Console.o
creating build/lib.linux-x86_64-3.9/cx_Freeze/bases
gcc -pthread build/temp.linux-x86_64-3.9/source/bases/Console.o -L/opt/_internal/cpython-3.9.5/lib/python3.9/config-3.9-x86_64-linux-gnu -lpython3.9 -o build/lib.linux-x86_64-3.9/cx_Freeze/bases/Console -Xlinker -export-dynamic -lcrypt -lpthread -ldl -lutil -lm -lm -s -Wl,-rpath,$ORIGIN/lib -Wl,-rpath,$ORIGIN/../lib
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld: cannot find -lpython3.9
collect2: error: ld returned 1 exit status
error: command '/opt/rh/devtoolset-9/root/usr/bin/gcc' failed with exit code 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-_bkrfu6z/cx-freeze_c851ee3ebfbb4cabad3e02bae3465dcb/setup.py'"'"'; __file__='"'"'/tmp/pip-install-_bkrfu6z/cx-freeze_c851ee3ebfbb4cabad3e02bae3465dcb/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-7duxfrih/install-record.txt --single-version-externally-managed --compile --install-headers /opt/_internal/cpython-3.9.5/include/python3.9/cx-freeze Check the logs for full command output. |
Like I said.
The reserved space for open source is github registry for instance is 500MB. The image is about 900MB. But you can produce it. Install docker with buildx Clone manylinux Dockerfile:
|
Thank you kindful explain! but I get an error. # centos 7
drwxr-xr-x 2 root root 4096 Jun 1 01:56 .
drwxr-xr-x 12 root root 4096 Nov 13 2020 ..
-rw-r--r-- 1 root root 3469 Jun 1 01:56 build_test-0.0.1-1.src.rpm
-rw-r--r-- 1 root root 10330108 Jun 1 01:56 build_test-0.0.1-1.x86_64.rpm
-rw-r--r-- 1 root root 1284 Jun 1 01:56 build_test-0.0.1.tar.gz
-rw-r--r-- 1 root root 1461436 Jun 1 01:56 build_test-debuginfo-0.0.1-1.x86_64.rpm
[root@3d94eacf9197 src]# rpm -ivh *.rpm
error: Failed dependencies:
libffi.so.5()(64bit) is needed by build_test-0.0.1-1.x86_64
liblzma.so.0()(64bit) is needed by build_test-0.0.1-1.x86_64
Updating / installing...
1:build_test-0.0.1-1 ################################# [100%]
[root@3d94eacf9197 src]# # manylinux2010_x86_64
$ exec /opt/_internal/cpython-3.9.5/bin/build_test
ImportError: /opt/_internal/cpython-3.9.5/lib/build_test-0.0.1/lib/_cffi_backend.cpython-39-x86_64-linux-gnu.so: ELF load command address/offset not properly aligned |
I get it running with more changes:
|
Deo, I get success without changing the setup and requirements.
Dockerfile:
|
Awesome! It's works! Unfortunately, I was faced with other problems... pip install ldap3
log => ERROR [stage-1 8/8] RUN /opt/_internal/cpython-3.9.5/lib/build_test-0.0.1/build_test 1.0s
------
> [stage-1 8/8] RUN /opt/_internal/cpython-3.9.5/lib/build_test-0.0.1/build_test:
#27 0.922 Traceback (most recent call last):
#27 0.922 File "/opt/_internal/cpython-3.9.5/lib/python3.9/site-packages/cx_Freeze/initscripts/__startup__.py", line 81, in run
#27 0.924 File "/opt/_internal/cpython-3.9.5/lib/python3.9/site-packages/cx_Freeze/initscripts/Console.py", line 36, in run
#27 0.924 File "build_test/__main__.py", line 1, in <module>
#27 0.924 File "<frozen zipimport>", line 259, in load_module
#27 0.924 File "/code/build/bdist.linux-x86_64/rpm/BUILD/build_test-0.0.1/build_test/hello.py", line 2, in <module>
#27 0.925 File "<frozen zipimport>", line 259, in load_module
#27 0.925 File "/opt/_internal/cpython-3.9.5/lib/python3.9/site-packages/ldap3/__init__.py", line 141, in <module>
#27 0.925 File "<frozen zipimport>", line 259, in load_module
#27 0.925 File "/opt/_internal/cpython-3.9.5/lib/python3.9/site-packages/ldap3/core/connection.py", line 38, in <module>
#27 0.925 File "<frozen zipimport>", line 259, in load_module
#27 0.925 File "/opt/_internal/cpython-3.9.5/lib/python3.9/site-packages/ldap3/extend/__init__.py", line 29, in <module>
#27 0.925 File "<frozen zipimport>", line 259, in load_module
#27 0.925 File "/opt/_internal/cpython-3.9.5/lib/python3.9/site-packages/ldap3/extend/microsoft/dirSync.py", line 27, in <module>
#27 0.925 File "<frozen zipimport>", line 259, in load_module
#27 0.925 File "/opt/_internal/cpython-3.9.5/lib/python3.9/site-packages/ldap3/protocol/microsoft.py", line 26, in <module>
#27 0.925 File "<frozen zipimport>", line 259, in load_module
#27 0.925 File "/opt/_internal/cpython-3.9.5/lib/python3.9/ctypes/__init__.py", line 8, in <module>
#27 0.925 ImportError: libffi.so.5: cannot open shared object file: No such file or directory |
In this specific case, use "bin_includes": "libffi.so.5"
|
Thank you. It's works! |
cx_Freeze 6.7 has just been released. |
I install pacakage after bdist_rpm.
example project: https://github.com/mcauto/cx-freeze-bdist-rpm-example
Then occur error message below.
because of
paramiko
The text was updated successfully, but these errors were encountered: