Title: find_library_file() should try to link
Type: compile error Stage: resolved
Components: Distutils Versions: Python 2.7
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: eric.araujo Nosy List: eric.araujo, jdemeyer, steve.dower, tarek
Priority: normal Keywords:

Created on 2012-06-25 13:42 by jdemeyer, last changed 2021-02-03 18:37 by steve.dower. This issue is now closed.

Messages (4)
msg163968 - (view) Author: Jeroen Demeyer (jdemeyer) * (Python triager) Date: 2012-06-25 13:42
The find_library_function() in Lib/distutils/ does a very simple-minded check to determine the existence of a library. It basically only checks that a certain .so file exists. This may lead to false positives: the mere existence of a .so file does not imply that we can actually link against that library.

In addition to (or even better: instead of) checking the existence of the file, you should try to (in the spirit of autoconf) compile a simple program using $CC -l$LIB prog.c -o prog

One particular instance of where things can go wrong is with a 32-bit/64-bit multilib installation. Python might find a 64-bit library in /usr/lib when we're actually compiling 32-bit with libraries in /usr/lib32.
msg164558 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-07-02 22:05
Hi Jeroen, thanks for the report.  Did you run into this while building a distribution or did you find it just reading the code?  Distutils is in a special state where we only fix bugs but don’t do any improvement for the sake of improvements, because many scripts rely on undocumented details.
msg181010 - (view) Author: Jeroen Demeyer (jdemeyer) * (Python triager) Date: 2013-01-31 09:34
Sorry for the late answer, but yes: I found this out using an actual compilation.  I must admit it was in a bit of an usual situation (32-bit userspace on a mixed 32/64-bit mutilib installation), but most other software packages have no problems configuring correctly in such a situation.

I can imagine that it's not a trivial change and would require some redesign.

Some more context: this was discovered when building Python as part of Sage, see for the downstream bug report.
msg386438 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2021-02-03 18:37
Distutils is now deprecated (see PEP 632) and all tagged issues are being closed. From now until removal, only release blocking issues will be considered for distutils.

If this issue does not relate to distutils, please remove the component and reopen it. If you believe it still requires a fix, most likely the issue should be re-reported at
Date User Action Args
2021-02-03 18:37:34steve.dowersetstatus: open -> closed

nosy: + steve.dower
messages: + msg386438

resolution: out of date
stage: resolved
2013-01-31 09:34:19jdemeyersetmessages: + msg181010
2012-07-02 22:05:50eric.araujosetmessages: + msg164558
2012-06-25 13:42:12jdemeyercreate