Loading ...
Sorry, an error occurred while loading the content.

Re: Test 86 fails with statis Python

Expand Messages
  • ZyX
    ... From the `man gcc` it seems that `-fPIC` or at least `-fpic` is a must when compiling shared libraries. Should not the issue be then directed to Ubuntu
    Message 1 of 16 , Jun 20, 2013
    • 0 Attachment
      On Wednesday, June 19, 2013 8:19:35 PM UTC+4, Yukihiro Nakadaira wrote:
      > On Ubuntu 13.04, adding -fPIC to CFLAGS make it work.

      From the `man gcc` it seems that `-fPIC` or at least `-fpic` is a must when compiling shared libraries. Should not the issue be then directed to Ubuntu developers?

      --
      --
      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 vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Yukihiro Nakadaira
      ... I think so too. Maybe python requires explicit -fPIC flag for configure option. On Ubuntu 13.04 $ python -c import distutils.sysconfig;
      Message 2 of 16 , Jun 21, 2013
      • 0 Attachment
        On Fri, Jun 21, 2013 at 2:25 AM, ZyX <zyx.vim@...> wrote:
        On Wednesday, June 19, 2013 8:19:35 PM UTC+4, Yukihiro Nakadaira wrote:
        > On Ubuntu 13.04, adding -fPIC to CFLAGS make it work.

        From the `man gcc` it seems that `-fPIC` or at least `-fpic` is a must when compiling shared libraries. Should not the issue be then directed to Ubuntu developers?

        I think so too.
        Maybe python requires explicit -fPIC flag for configure option.

        On Ubuntu 13.04
        $ python -c 'import distutils.sysconfig; print(distutils.sysconfig.get_config_var("CONFIG_ARGS"))'
        '--enable-shared' '--prefix=/usr' '--enable-ipv6' '--enable-unicode=ucs4' '--with-dbmliborder=bdb:gdbm' '--with-system-expat' '--with-system-ffi' '--with-fpectl' 'CC=x86_64-linux-gnu-gcc' 'CFLAGS=-D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security ' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro'

        On Fedora 18
        $ python -c 'import distutils.sysconfig; print(distutils.sysconfig.get_config_var("CONFIG_ARGS"))'
        '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--program-prefix=' '--disable-dependency-tracking' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--enable-ipv6' '--enable-shared' '--enable-unicode=ucs4' '--with-dbmliborder=gdbm:ndbm:bdb' '--with-system-expat' '--with-system-ffi' '--with-dtrace' '--with-tapset-install-dir=/usr/share/systemtap/tapset' '--with-valgrind' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'CC=gcc' 'CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4  -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv  ' 'LDFLAGS=-Wl,-z,relro   ' 'CPPFLAGS=-I/usr/lib64/libffi-3.0.10/include  '

        --
        Yukihiro Nakadaira - yukihiro.nakadaira@...

        --
        --
        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 vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
         
         
      • Yukihiro Nakadaira
        On Sat, Jun 22, 2013 at 1:56 AM, Yukihiro Nakadaira
        Message 3 of 16 , Jun 21, 2013
        • 0 Attachment
          On Sat, Jun 22, 2013 at 1:56 AM, Yukihiro Nakadaira <yukihiro.nakadaira@...> wrote:
          Maybe python requires explicit -fPIC flag for configure option.

          This assumption was wrong...

          --
          Yukihiro Nakadaira - yukihiro.nakadaira@...

          --
          --
          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 vim_dev+unsubscribe@....
          For more options, visit https://groups.google.com/groups/opt_out.
           
           
        • Zulox4
          ... Hello, For Linux Xubuntu 13, the ./configure --enable-shared for the last pyhton release 2.7.5 works, but the fPython 3.1.1 does not work :
          Message 4 of 16 , Jun 21, 2013
          • 0 Attachment
            On Thursday, June 20, 2013 7:25:19 PM UTC+2, ZyX wrote:
            > On Wednesday, June 19, 2013 8:19:35 PM UTC+4, Yukihiro Nakadaira wrote:
            > > On Ubuntu 13.04, adding -fPIC to CFLAGS make it work.
            >
            > From the `man gcc` it seems that `-fPIC` or at least `-fpic` is a must when compiling shared libraries. Should not the issue be then directed to Ubuntu developers?

            Hello,

            For Linux Xubuntu 13, the ./configure --enable-shared for the last pyhton release 2.7.5 works, but the fPython 3.1.1 does not work :

            http://stackoverflow.com/questions/1547310/python-3-1-1-with-enable-shared-will-not-build-any-extensions

            Best regards!

            --
            --
            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 vim_dev+unsubscribe@....
            For more options, visit https://groups.google.com/groups/opt_out.
          • Yukihiro Nakadaira
            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
            Message 5 of 16 , Jun 23, 2013
            • 0 Attachment
              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 - yukihiro.nakadaira@...

              --
              --
              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 vim_dev+unsubscribe@....
              For more options, visit https://groups.google.com/groups/opt_out.
               
               
            • ZyX
              ... 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
              Message 6 of 16 , Jun 29, 2013
              • 0 Attachment
                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 - yukihiro....@...

                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 vim_dev+unsubscribe@....
                For more options, visit https://groups.google.com/groups/opt_out.
              Your message has been successfully submitted and would be delivered to recipients shortly.