Skip to content

Commit 5b17cad

Browse files
asheshvdpage
authored andcommitted
fix(pkg/linux): pin psycopg-c build to x86-64 v1 baseline (pgadmin-org#10017)
1 parent 4dd5cdd commit 5b17cad

2 files changed

Lines changed: 23 additions & 2 deletions

File tree

docs/en_US/release_notes_9_16.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,4 @@ Bug fixes
3030

3131
| `Issue #9892 <https://github.com/pgadmin-org/pgadmin4/issues/9892>`_ - Fix blank difference counts on the top-level group rows in Schema Diff.
3232
| `Issue #9896 <https://github.com/pgadmin-org/pgadmin4/issues/9896>`_ - Fix invalid DDL reconstruction for SERIAL columns in Schema Diff and the generated SQL/CREATE Script so the output round-trips on a clean target.
33+
| `Issue #9935 <https://github.com/pgadmin-org/pgadmin4/issues/9935>`_ - Fix "Illegal instruction" crash on startup of the Linux DEB and RPM packages on older x86_64 CPUs by pinning the psycopg C extension build to the x86-64 baseline.

pkg/linux/build-functions.sh

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,28 @@ _create_python_virtualenv() {
7777
pip3 install --upgrade pip
7878
pip3 install wheel
7979

80-
# Install the requirements
81-
pip3 install --force-reinstall --no-cache-dir --no-binary psycopg -r "${SOURCEDIR}/requirements.txt"
80+
# Install the requirements.
81+
#
82+
# psycopg is built from source against the system libpq (see
83+
# --no-binary psycopg). Pin the C extension to the x86-64 v1
84+
# baseline so the resulting .so runs on every x86_64 CPU we
85+
# claim to support. Without this, gcc on a modern build host
86+
# may emit AVX2/BMI2/FMA instructions that SIGILL on older
87+
# CPUs (Ivy Bridge and earlier) and on default Proxmox kvm64
88+
# VMs at psycopg_c.pq module-load time. Issue #9935.
89+
#
90+
# The flags are scoped to this pip invocation so they don't
91+
# leak into any other build steps in the same shell. Other
92+
# arches build with their distro defaults.
93+
if [ "$(uname -m)" = "x86_64" ]; then
94+
CFLAGS="${CFLAGS:-} -O2 -march=x86-64 -mtune=generic" \
95+
CXXFLAGS="${CXXFLAGS:-} -O2 -march=x86-64 -mtune=generic" \
96+
pip3 install --force-reinstall --no-cache-dir \
97+
--no-binary psycopg -r "${SOURCEDIR}/requirements.txt"
98+
else
99+
pip3 install --force-reinstall --no-cache-dir \
100+
--no-binary psycopg -r "${SOURCEDIR}/requirements.txt"
101+
fi
82102

83103
# Fixup the paths in the venv activation scripts
84104
sed -i 's/VIRTUAL_ENV=.*/VIRTUAL_ENV="\/usr\/pgadmin4\/venv"/g' venv/bin/activate

0 commit comments

Comments
 (0)