Skip to content

Commit 99f8157

Browse files
Fix shared libraries load error (#2)
* List files * Enable shared * Add name to test workflow * Add LDFLAGS * Remove optimizations * Cleanup * Add links * Add enable shared * Add monitoring for the list of installed binaries * Setup pre-requisites separately * Add linking to shared libraries * Re enable optimizations * Updating contributing documentation * Remove --enable-optimizations to speed up builds
1 parent f3b5e0d commit 99f8157

File tree

4 files changed

+22
-11
lines changed

4 files changed

+22
-11
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
name: Test
2+
13
on: [ push ]
24

35
jobs:

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Contributing
2+
13
## Context
24

35
This action is built as a composite action, for more details kindly refer

action.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 'Setup python amazon linux'
1+
name: 'Setup python on amazon linux'
22
description: 'Adds support to install python in amazon linux'
33
inputs:
44
python-version:
@@ -11,6 +11,13 @@ inputs:
1111
runs:
1212
using: "composite"
1313
steps:
14+
- name: Ensure dependencies of python are installed
15+
shell: bash
16+
run: |
17+
sudo yum groupinstall -y "Development Tools"
18+
sudo yum install -y gcc openssl-devel bzip2-devel libffi-devel
19+
sudo yum install -y tar gzip wget
20+
1421
- name: Find exact python version
1522
id: find-exact-python-version
1623
shell: bash
@@ -47,7 +54,14 @@ runs:
4754
shell: bash
4855
run: |
4956
installation_directory=${{ steps.set-installation-directory.outputs.installation_directory }}
50-
echo "${installation_directory}/bin" >> ${GITHUB_PATH}
57+
echo "${installation_directory}/bin" >> "${GITHUB_PATH}"
58+
59+
echo "The following python binaries are now available in the PATH"
60+
ls "${installation_directory}/bin"
61+
62+
echo "Linking python libraries.."
63+
ls "${installation_directory}/lib"
64+
ldconfig "${installation_directory}/lib"
5165
5266
branding:
5367
icon: 'code'

install-python.sh

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@ set -euo pipefail
44

55
# Follows the guidelines from https://realpython.com/installing-python/#how-to-build-python-from-source-code
66

7-
function setup_build_prerequisites() {
8-
sudo yum groupinstall -y "Development Tools"
9-
sudo yum install -y tar gzip wget
10-
sudo yum install -y gcc openssl-devel bzip2-devel libffi-devel
11-
}
12-
137
function set_aliases() {
148
ln -sf "${python_installation_dir}/bin/python3" "${python_installation_dir}/bin/python"
159
ln -sf "${python_installation_dir}/bin/pip3" "${python_installation_dir}/bin/pip"
@@ -19,15 +13,14 @@ function setup_python() {
1913
python_version="$1"
2014
python_installation_dir="$2"
2115

22-
setup_build_prerequisites
23-
2416
mkdir -p "${python_installation_dir}"
2517
temp_dir=$(mktemp -d)
2618
pushd "${temp_dir}" >/dev/null
2719
wget "https://www.python.org/ftp/python/${python_version}/Python-${python_version}.tgz"
2820
tar -zxf "Python-${python_version}.tgz"
2921
pushd "Python-${python_version}" >/dev/null
30-
./configure --enable-optimizations --prefix="${python_installation_dir}"
22+
# Have not added --enable-optimizations flag because that shoots up the build time by ~5 minutes
23+
./configure --prefix="${python_installation_dir}" --enable-shared
3124
make -j 8
3225
make install
3326
popd >/dev/null

0 commit comments

Comments
 (0)