On Sunday, June 23, 2013 3:25:52 PM UTC+4, Yukihiro Nakadaira wrote:
> Cause of this problem is that ubuntu's python is built with 
> -Bsymbolic-functions flag.
> With this flag, libpython and vim see different function address for same 
> function.
> 
> Test:
> $ cat foo.c
> 
> void *foo() { return &foo; }
> $ cat main.c
> #include <stdio.h>
> void *foo();
> int main() {
>     printf("foo=%p main=%p\n", foo(), &foo);
>     return 0;
> }
> $ cc -shared -fPIC -o libfoo.so foo.c -Wl,-Bsymbolic-functions
> 
> $ cc main.c -L. -lfoo
> $ LD_LIBRARY_PATH=. ./a.out
> foo=0x7eff0cafe770 main=0x4005e0
> 
> 
> -- 
> Yukihiro Nakadaira - [email protected]

Just filed a bug report: 
https://bugs.launchpad.net/ubuntu/+source/python2.7/+bug/1196047. Let’s look, 
maybe we won’t have to do anything.

As an alternative I can suggest one of the following:

1. Detect -Wl,-Bsymbolic-functions flag in configure and fail or switch to 
=dynamic build. (I would really prefer failing.)
2. Add #if Py_UBUNTU_WORKAROUND macros guarding

        #define _PyObject_NextNotImplemented dll__PyObject_NextNotImplemented
        static iternextfunc dll__PyObject_NextNotImplemented;

   at the top (in the #else branch of #if defined(DYNAMIC_PYTHON) || 
defined(PROTO)) and something like

        PyObject *aobj;
        PyRun_SimpleString("class A(object): pass");
        if (PyErr_Occurred())
            return -1;
        if (!(aobj = PyRun_String("A", Py_eval_input, globals, globals)))
            return -1;
        dll__PyObject_NextNotImplemented = aobj->tp_iternext;
        Py_DECREF(aobj);

  after main python initialization. Macros should be added to CFLAGS by 
configure script if -Wl,\S*-Bsymbolic-functions is found in python LDFLAGS. 
This will workaround our problem as this way we get 
_PyObject_NextNotImplemented that is really used by python.

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Raspunde prin e-mail lui