Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 209673 - dev-lang/python builds an internal copy of libffi
Summary: dev-lang/python builds an internal copy of libffi
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on: 199850 272046 287383
Blocks: bundled-libs 212178
  Show dependency tree
 
Reported: 2008-02-11 16:23 UTC by Diego Elio Pettenò (RETIRED)
Modified: 2010-01-01 18:59 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Detect standard includes instead of guessing. (python-2.5.2-standard-include.patch,1.72 KB, patch)
2008-03-20 19:59 UTC, Markus Peloquin
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Diego Elio Pettenò (RETIRED) gentoo-dev 2008-02-11 16:23:25 UTC
Symbol ffi_closure_unix64_inner@@ (64-bit UNIX System V ABI AMD x86-64 architecture) present 3 times
  /usr/lib64/python2.5/lib-dynload/_ctypes.so
  /usr/lib64/gcc/x86_64-pc-linux-gnu/4.2.2/libgcj.so.8.0.0
  /usr/lib64/gcc/x86_64-pc-linux-gnu/4.2.2/libffi.so.4.0.1
Comment 1 Tiziano Müller (RETIRED) gentoo-dev 2008-02-27 12:38:20 UTC
right, the ctypes Module seems to include a development snapshot of the 2.x
version of libffi.
Comment 2 Tiziano Müller (RETIRED) gentoo-dev 2008-02-28 16:07:26 UTC
and there is a configure-switch: --with-system-ffi
But I really want the libffi USE-flag set per default for sys-devel/gcc if we're going to enable this. And add a big fat warning that recompiling gcc without it can break portage badly.
Or am I missunderstanding something, Diego?
Comment 3 Diego Elio Pettenò (RETIRED) gentoo-dev 2008-02-28 16:51:23 UTC
Can't we get it forced on by profile? (so that when building for embedded or custom systems one can disable it by changing package.use.mask, rather than ebuild, but then the profiles will disallow "normal" users from breaking everything...)
Comment 4 Tiziano Müller (RETIRED) gentoo-dev 2008-02-28 18:23:55 UTC
That sounds good. Can you take care of this please? :-)
Comment 5 Tiziano Müller (RETIRED) gentoo-dev 2008-03-03 16:01:40 UTC
Python's detection of an available system-ffi is broken (of course).
They try to detect ffi.h and libffi.so by manually searching the paths but forget the implicit dirs "/usr/lib64/gcc/x86_64-pc-linux-gnu/4.2.3/include", resp. "/usr/lib64/gcc/x86_64-pc-linux-gnu/4.2.3" and therefore fail _silently_ (*argh*).

Appending those as include-, resp. library-dirs to CFLAGS solves the issue but then you end up with those flags for everything in python. I really don't feel comfortable with that solution...
Comment 6 Tiziano Müller (RETIRED) gentoo-dev 2008-03-03 16:27:08 UTC
with a little patch it works perfectly without messing with the CFLAGS.
Maybe someone can come up with a nice patch (like adding --with-system-ffi-{incdir,libdir} flags to configure...)

--- Python-2.5.1/setup.py       2007-02-14 13:53:41.000000000 +0100
+++ Python-2.5.1.new/setup.py   2008-03-03 17:01:08.000000000 +0100
@@ -1306,7 +1306,7 @@
         #       -lGL -lGLU -lXext -lXmu \

     def configure_ctypes(self, ext):
-        if not self.use_system_libffi:
+        if False:
             (srcdir,) = sysconfig.get_config_vars('srcdir')
             ffi_builddir = os.path.join(self.build_temp, 'libffi')
             ffi_srcdir = os.path.abspath(os.path.join(srcdir, 'Modules',
@@ -1390,6 +1390,7 @@
         ext_test = Extension('_ctypes_test',
                              sources=['_ctypes/_ctypes_test.c'])
         self.extensions.extend([ext, ext_test])
+        ext.libraries.append('ffi')

         if not '--with-system-ffi' in sysconfig.get_config_var("CONFIG_ARGS"):
             return
Comment 7 Markus Peloquin 2008-03-20 19:59:57 UTC
Created attachment 146690 [details, diff]
Detect standard includes instead of guessing.

An alternative is for setup.py to detect the standard include directories.  I made my own patch for setup.py that get's the standard C include directories by running 'cpp -v </dev/null'.  It's made against 2.5.2, but it applies on 2.5.1 as well.
Comment 8 Ryan Hill (RETIRED) gentoo-dev 2008-03-28 01:45:03 UTC
is libffi stable across GCC versions?  will something like switching from 4.3.0 to 3.3.3 with gcc-config cause problems?
Comment 9 Markus Peloquin 2008-04-12 06:41:18 UTC
I doubt switching gcc versions will cause problems.  Because of libffi's stagnant development, gcc has been using the same snapshot of libffi for ten years.  Python has been using the same version of libffi, but they're switching in their 2.6 release to libffi-3.0.4 (released 2008-02-24).

So, I don't think it's a good idea to use gcc's libffi if everything changes in the next release of python.  The only solution I see is to add the new libffi to portage and get gcc and python to use it.
Comment 10 Ali Polatel (RETIRED) gentoo-dev 2008-04-18 13:21:19 UTC
(In reply to comment #9)
> So, I don't think it's a good idea to use gcc's libffi if everything changes in
> the next release of python.  The only solution I see is to add the new libffi
> to portage and get gcc and python to use it.
> 

Agreed. /me votes for RESO LATER.
Other python devs, please comment.
Comment 11 Ryan Hill (RETIRED) gentoo-dev 2008-04-20 01:23:15 UTC
an external libffi package is what we had up until now and it rotted.  gcc will always need to use it's internal copy.  i recommend python does too.  the number of external libraries needed for both gcc and python should be kept to a bare minimum.
Comment 12 Samuli Suominen (RETIRED) gentoo-dev 2009-06-01 07:39:13 UTC
The new, and apparently maintained libffi is now unmasked and that is what other distibutions use also. It's at a KEYWORDREQ state in bug 272046.

Please make python use virtual/libffi is possible.
Comment 13 Samuli Suominen (RETIRED) gentoo-dev 2009-06-04 18:25:49 UTC
(In reply to comment #12)
> The new, and apparently maintained libffi is now unmasked and that is what
> other distibutions use also. It's at a KEYWORDREQ state in bug 272046.
> 
> Please make python use virtual/libffi is possible.
> 

And it's now also keyworded, please move forward on using virtual/libffi instead of internal copy.
Comment 14 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2009-06-12 14:19:33 UTC
(In reply to comment #13)
> And it's now also keyworded, please move forward on using virtual/libffi
> instead of internal copy.

It isn't keyworded yet on m68k, mips, sparc-fbsd and x86-fbsd.
dev-lang/python has keywords on these architectures.
Comment 15 Sergey 2009-09-16 07:06:27 UTC
(In reply to comment #14)
> (In reply to comment #13)
> > And it's now also keyworded, please move forward on using virtual/libffi
> > instead of internal copy.
> 
> It isn't keyworded yet on m68k, mips, sparc-fbsd and x86-fbsd.
> dev-lang/python has keywords on these architectures.
> 
And arch ia64 python version 2.5.4-r3, 2.6.2.-r1, 3.1.1 does't compile.
Comment 16 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2009-09-22 18:55:17 UTC
External libffi is now used on all architectures except m68k, mips, sparc-fbsd and x86-fbsd in dev-lang/python-2.6.2-r2 and dev-lang/python-3.1.1-r1.
Comment 17 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2009-10-02 17:57:45 UTC
(In reply to comment #16)
> External libffi is now used on all architectures except m68k, mips,
> sparc-fbsd and x86-fbsd in dev-lang/python-2.6.2-r2 and
> dev-lang/python-3.1.1-r1.

I have decided to remove this workaround and ask the remaining architectures for rekeywording in bug #287383.
Comment 18 Samuli Suominen (RETIRED) gentoo-dev 2009-12-13 16:47:45 UTC
The (re)keywording has been done for all arch's, closing this bug...
Comment 19 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2010-01-01 18:59:36 UTC
External libffi is now used also in dev-lang/python-2.5.4-r4.