Skip to content

fix: Add libdir to library search path#2476

Merged
aignas merged 4 commits intobazel-contrib:mainfrom
shs96c:add-libdir-to-library-path
Mar 7, 2025
Merged

fix: Add libdir to library search path#2476
aignas merged 4 commits intobazel-contrib:mainfrom
shs96c:add-libdir-to-library-path

Conversation

@shs96c
Copy link
Contributor

@shs96c shs96c commented Dec 6, 2024

We discovered when dealing with libraries such as psycopg2 that the wheel would attempt to link against libpython.a. This fix points the linker at the correct python version being used.

Copy link
Collaborator

@aignas aignas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this is gated by a feature toggle, it seems to be low risk to include.

@rickeylev
Copy link
Collaborator

Just want to respond to something the comment says:

# [calling the python interpreter in repo-phase]
# is super hacky, but working out something nice is tricky.
# This is in particular needed for psycopg2 which attempts to link libpython.a,
# in order to point the linker at the correct python intepreter.

It's not possible to reliably get the correct Python interpreter. This is because the repo phase doesn't know, and can't know, what the build phase is going to do (i.e. what python interpreter will be used). The basic change in this PR is somewhat an improvement, but yeah -- just wanted to point out it'll still be prone to issues. To really fix this, the sdist building needs to move into the build phase.

@aignas
Copy link
Collaborator

aignas commented Dec 8, 2024

I'll add some ideas about this in #2410.

@shs96c
Copy link
Contributor Author

shs96c commented Dec 19, 2024

Is there anything else you'd like me to do for this PR?

@aignas aignas enabled auto-merge March 7, 2025 04:56
@aignas aignas added this pull request to the merge queue Mar 7, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Mar 7, 2025
@aignas aignas added this pull request to the merge queue Mar 7, 2025
Merged via the queue into bazel-contrib:main with commit e7d2f09 Mar 7, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants