Skip to content

Commit

Permalink
Fix Linux RPATH issue with python (#250)
Browse files Browse the repository at this point in the history
Fix bad RPATH set for python caused by trying to use a string to print
and evaluate at the same time.
Root Cause:
Setting the command line string to configure causes an expansion of
`\$$ORIGIN` too early, and ends up evaluating to `` since there is no
$ORIGIN set.

Signed-off-by: Steve Pham <[email protected]>
  • Loading branch information
spham-amzn authored Mar 13, 2024
1 parent 30e7001 commit 8397920
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
5 changes: 3 additions & 2 deletions package-system/python/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,14 @@ ENV DOWNLOADED_PACKAGE_FOLDERS=$INPUT_DEPENDENT_PACKAGE_FOLDERS
WORKDIR $WORKSPACE

# Initilize apt cache
RUN apt-get clean && apt-get update
RUN apt-get clean && apt-get update && apt upgrade -y

# Setup time zone and locale data (necessary for SSL and HTTPS packages)
RUN DEBIAN_FRONTEND="noninteractive" apt-get -y install tzdata locales keyboard-configuration


# Install the development packages needed to build python
RUN apt-get install -y autoconf \
RUN DEBIAN_FRONTEND="noninteractive" apt-get install -y autoconf \
build-essential \
cmake \
git \
Expand Down
4 changes: 2 additions & 2 deletions package-system/python/build_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"git_url":"https://github.com/python/cpython.git",
"git_tag":"v3.10.13",
"package_name":"python",
"package_version":"3.10.13-rev1",
"package_version":"3.10.13-rev2",
"package_url":"https://python.org",
"package_license":"PSF-2.0",
"package_license_file":"LICENSE",
Expand All @@ -17,7 +17,7 @@
],
"custom_build_cmd": [
"./build-linux.sh",
"python_3_10_5",
"python_3_10_13",
"20.04",
"x86_64"
],
Expand Down
5 changes: 1 addition & 4 deletions package-system/python/docker_build_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,11 @@ echo ""
pushd ${SRC_PATH}

# Build from the source with optimizations and shared libs enabled , and override the RPATH and bzip include/lib paths
CMD="\
./configure --prefix=${BUILD_FOLDER}/python\
--enable-optimizations\
--with-openssl=${OPENSSL_BASE}\
--enable-shared LDFLAGS='-Wl,-rpath=\$$ORIGIN:\$$ORIGIN/../lib:\$$ORIGIN/../.. -L../ffi_lib/lib -L'${SQLITE_BASE}'/lib'\
CPPFLAGS='-I../ffi_lib/include -I'${SQLITE_BASE}'' CFLAGS='-I../ffi_lib/include -I'${SQLITE_BASE}''"
echo $CMD
eval $CMD
CPPFLAGS='-I../ffi_lib/include -I'${SQLITE_BASE}'' CFLAGS='-I../ffi_lib/include -I'${SQLITE_BASE}''
if [ $? -ne 0 ]
then
echo "'configure' failed for cpython at ${SRC_PATH}"
Expand Down
4 changes: 2 additions & 2 deletions package_build_list_host_linux-aarch64.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"png-1.6.37-rev2-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/libpng --platform-name Linux-aarch64 --clean",
"poly2tri-7f0487a-rev1-linux-aarch64": "package-system/poly2tri/build_package_image.py --platform-name linux-aarch64",
"pyside2-5.15.2.1-py3.10-rev4-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/pyside2 --platform-name Linux-aarch64 --clean",
"python-3.10.13-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/python --platform-name Linux-aarch64 --clean",
"python-3.10.13-rev2-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/python --platform-name Linux-aarch64 --clean",
"qt-5.15.2-rev9-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/Qt --platform-name Linux-aarch64 --clean",
"sdformat-13.5.0-rev2-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/sdformat --platform-name Linux-aarch64 --clean",
"SPIRVCross-1.3.275.0-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/SPIRVCross --platform-name Linux-aarch64 --clean",
Expand Down Expand Up @@ -74,7 +74,7 @@
"png-1.6.37-rev2-linux-aarch64": "package-system/libpng/temp/png-linux-aarch64",
"poly2tri-7f0487a-rev1-linux-aarch64": "package-system/poly2tri-linux-aarch64",
"pyside2-5.15.2.1-py3.10-rev4-linux-aarch64": "package-system/pyside2/temp/pyside2-linux-aarch64",
"python-3.10.13-rev1-linux-aarch64": "package-system/python/temp/python-linux-aarch64",
"python-3.10.13-rev2-linux-aarch64": "package-system/python/temp/python-linux-aarch64",
"qt-5.15.2-rev9-linux-aarch64": "package-system/Qt/temp/qt-linux-aarch64",
"sdformat-13.5.0-rev2-linux-aarch64": "package-system/sdformat/temp/sdformat-linux-aarch64",
"SPIRVCross-1.3.275.0-rev1-linux-aarch64": "package-system/SPIRVCross/temp/SPIRVCross-linux-aarch64",
Expand Down
8 changes: 4 additions & 4 deletions package_build_list_host_linux.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
"DirectXShaderCompilerDxc-1.7.2308-o3de-rev1-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/DirectXShaderCompiler --platform-name Linux --package-root ../../package-system --clean",
"azslc-1.8.19-rev1-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/azslc --platform-name Linux --package-root ../../package-system/azslc/temp --clean",
"tiff-4.2.0.15-rev3-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/tiff --platform-name Linux --package-root ../../package-system --clean",
"python-3.10.13-rev1-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/python --platform-name Linux --clean",
"python-3.10.13-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/python --platform-name Linux-aarch64 --clean",
"python-3.10.13-rev2-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/python --platform-name Linux --clean",
"python-3.10.13-rev2-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/python --platform-name Linux-aarch64 --clean",
"mikkelsen-1.0.0.4-linux": "package-system/mikkelsen/build_package_image.py",
"qt-5.15.2-rev9-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/Qt --platform-name Linux --package-root ../../package-system/Qt/temp --clean",
"zlib-1.2.11-rev5-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/zlib --platform-name Linux --package-root ../../package-system --clean",
Expand Down Expand Up @@ -82,8 +82,8 @@
"DirectXShaderCompilerDxc-1.7.2308-o3de-rev1-linux": "package-system/DirectXShaderCompilerDxc-linux",
"azslc-1.8.19-rev1-linux": "package-system/azslc/temp/azslc-linux",
"tiff-4.2.0.15-rev3-linux": "package-system/tiff-linux",
"python-3.10.13-rev1-linux": "package-system/python/temp/python-linux",
"python-3.10.13-rev1-linux-aarch64": "package-system/python/temp/python-linux-aarch64",
"python-3.10.13-rev2-linux": "package-system/python/temp/python-linux",
"python-3.10.13-rev2-linux-aarch64": "package-system/python/temp/python-linux-aarch64",
"PhysX-4.1.2.29882248-rev8-linux": "package-system/PhysX-linux",
"PhysX-5.1.1-rev4-linux": "package-system/PhysX5/temp/PhysX5-linux",
"NvCloth-v1.1.6-4-gd243404-pr58-rev1-linux": "package-system/NvCloth-linux",
Expand Down

0 comments on commit 8397920

Please sign in to comment.