New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fcntl extension fails to build on AIX 6.1 #48276
Comments
After hacking the configure script to work around the issues http://bugs.python.org/issue4025 and http://bugs.python.org/issue1633863 building 'fcntl' extension (Full transcript attached) I'm mystified and I can't log in to the AIX box right now. This does not appear to be the same as http://bugs.python.org/issue1756343 and http://bugs.python.org/issue1694442 which both appear to be the same, |
This occurs because it must link with -lbsd on AIX 6.1. If you hand If you build the prerequisites for the _tkinter module on AIX 6.1, you Notice that the modules ignore these two libraries when they are passed I will eventually figure out how to modify setup.py so that these two |
This also happens with Python 2.5.2 (not the latest 2.5 series, I know) |
I have now confirmed that the fix described here1 works as desired. I |
This very same problem happens (with Python-2.6.2) on AIX5.3 now too, after upgrading to: Unlike before (comparing with old build logs), this AIX5.3 now provides flock() in <sys/file.h> and libbsd.a[shr.o] like AIX6.1. Interesting enough, /usr/lib/libbsd.a contains 32bit shared objects only, so -lbsd does not help in 64bit mode (don't know if python actually supports 64bit on AIX). I don't have an AIX6.1 to check this. Because of this, upgrading "checking for flock" from compile- to link-check (eventually trying -lbsd a second time) might help? |
Ohw, looking on another machine, being AIX5.3 TL6: Here flock() is provided in libbsd.a(shr.o) (32bit only) too, but it isn't declared in any header-file. So that recent AIX5.3 patchset just adds the flock() declaration, not the function itself (is already there). |
Hi, Here is a patch that solves this problem. It was tested with Python 2.6.6 on AIX 6.1. The same problem applies to Python 2.7 and 3.x, but since the syntax has been changed in configure.in for Python 2.7 and 3.x, I need to adapt a little bit my patch (coming soon). regards |
Here is the version of the patch for Python 2.7. The syntax in configure.in is the same between Python 2.7 and the trunk. It is also the same between Python 2.6.6 and Python 3.1.2. So this patch can be applied on the trunk and the patch Python-2.6.6_flock_AIX.diff can be applied on Python 3.1.2. |
While I've not tested these patches myself, I do think there still is an unhandled case: building a 64bit python. |
[rant: grrr, AIX is really a crappy platform; no consistency between releases; there are dozens of obvious bugs like that... anyway...] The fact that there is no 64 bits objects in libbsd.a on AIX 6.1 is a documented bug: They recommend to install patch APAR IZ45155. I suppose there is nothing more we can do if the function is not available on the system. Maybe we could display a warning or error message and suggest to upgrade to a more recent patchlevel if we are on AIX and flock cannot be found? Though if the installation is relatively up to date, there should be no problem. |
Well, I suppose if flock needs libbsd on AIX (which is quite weird in itself), and AIX fails to ship libbsd for some executable formats, then it's AIX's problem. |
While I do agree this being an AIX bug, it is not a blocker here: |
Here is a new test for flock. HAVE_FLOCK is defined if we can link a C application calling flock, or if flock is defined in libbsd. AC_MSG_CHECKING(for flock)
have_flock=no
AC_TRY_LINK([
#include "confdefs.h"
#include <sys/file.h>
], [void* p = flock; flock(0, 0)],
[AC_CHECK_LIB(bsd,flock, [
AC_DEFINE(FLOCK_NEEDS_LIBBSD, 1, Define if flock needs to be linked with bsd library.)
have_flock=yes
])],
[have_flock=yes]
)
if test "$have_flock" = yes ; then
AC_DEFINE(HAVE_FLOCK, 1, Define if you have the 'flock' function.)
fi
AC_MSG_RESULT($have_flock) I think that this new test would also cover your case with a broken AIX libbsd? [I haven't actually tried to compile it yet, if the behavior is OK I will test it in both autoconf formats and provide some new patches tomorrow] |
I've just merged Sébastien's patches in r84584 (3.x), r84585 (2.7) and r84586 (3.1). If you'd like to improve the fixes (as per your latest message), please say so, otherwise I'll close the issue. (and thanks for your contributions!) |
Sorry to be pedantic - but it looks like (don't have a build environment at hand at the moment) it will fail to build as 64bit on the not-so-up-to-date AIX with missing 64bit flock implementation: |
It might be better indeed. Patches against the current SVN branches are |
Using this patch based on current py3k branch I've been able now to build the fcntl module for 32bit aix5.3 (with flock) and 64bit aix5.3 (without flock), both using an old gcc-3.3.6, as well as for 64bit linux. |
I inverted the actions in the test I proposed in msg115768 (quick note from home, should have tested at work before posting). It should be: AC_MSG_CHECKING(for flock)
have_flock=no
AC_TRY_LINK([
#include "confdefs.h"
#include <sys/file.h>
], [void* p = flock; flock(0, 0)],
[have_flock=yes],
[AC_CHECK_LIB(bsd,flock, [
AC_DEFINE(FLOCK_NEEDS_LIBBSD, 1, Define if flock needs to be linked with bsd library.)
have_flock=yes
])]
)
if test "$have_flock" = yes ; then
AC_DEFINE(HAVE_FLOCK, 1, Define if you have the 'flock' function.)
fi
AC_MSG_RESULT($have_flock) Mickael, does that new test works for you? I am not sure I follow your explanation: there is no more 'compile-check' (AC_TRY_COMPILE) in the new test I provided; just a 'link-check' (AC_TRY_LINK - which tests that compilation and link did work). In the case of broken AIX 64 bits, the link-check will fail (no flock in default C libraries); then the test to find flock in libbsd will also fail (no 64 bits objets in libbsd). So HAVE_FLOCK will be undefined, which is what you expect. m4/autoconf is quite unintuitive so I may have made a mistake, or it may be easily misunderstood. But I intend my test to define HAVE_FLOCK only if compilation _and_ linking works, like you expect. |
Sébastien, while this gives expected results on the AIX box here, it still has one subtle problem: Another minor nit is configure's output when libbsd is needed:
Anyway - I've hacked up another variant (with recent autoconf manual at hand), which really should cover all known situations now (additionally using cache-checks): AC_CACHE_CHECK([for flock declaration], [ac_cv_flock_decl], Thank you anyway! |
Thanks Michael, your new test looks fine to me. I wanted to test it on my AIX system with branch py3k but I had some other issues (bpo-9799), but I will test it tomorrow. |
I tested Michael test in msg115868 on my AIX system (AIX 6.1 with flock correctly present in libbsd) with py3k and it works fine: checking for flock declaration... yes [103/344] test_fcntl I attach it as a patch against py3k. |
Ok, thank you. The improvement has been committed in all three branches (3.2, 3.1, 2.7). |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: