Tecnativa / Tecnativa/docker-postgres-autoconf
Illegal instruction (SIGILL) error when loading pgvector extension
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10
- Forks
- 39
- PR merge metrics
- No merged PRs in 30d
Description
Fix Illegal instruction (SIGILL) error when loading pgvector extension
Problem
By default, the pgvector makefile implicitly applies host-specific CPU optimizations (often translating to -march=native) when compiling the extension from source. While this creates a highly optimized binary for the machine where the Docker image is built, it breaks portability. If the resulting Docker image is executed on a different host with a less capable or different CPU architecture (missing specific instructions like AVX-512 or AVX2), PostgreSQL immediately crashes with a signal 4: Illegal instruction error when attempting to run CREATE EXTENSION vector;.
Solution
This commit overrides the default behavior by passing OPTFLAGS="" directly to the make and make install commands. This disables hardware-specific compiler optimizations, ensuring that the generated pgvector binary remains generic and safely portable across any standard CPU architecture supported by the base image.
Replace line 27 & 28 with:
&& make OPTFLAGS="" PG_CONFIG=/usr/local/bin/pg_config
&& make install OPTFLAGS="" PG_CONFIG=/usr/local/bin/pg_config; \
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Inspect the Docker image build commands at lines 27–28, focusing on how pgvector is compiled and installed. Rebuild the image, run CREATE EXTENSION vector; in a less capable environment, and verify that the extension loads without an illegal-instruction crash.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, postgresql
- Domain
- databases, devops
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100