Compile error about Setup.local

Hi Robin,
Again about the static link of wxPython to Python2.6, according http://lists.osafoundation.org/pipermail/chandler-dev/2003-May/000665.html. Sorry bother you , really need your help…
My steps are as below,

  1. Build wxWidgets according http://www.wxpython.org/BUILD.html
  1. …/configure --prefix=/opt/wx/2.8
    –with-gtk
    –with-gnomeprint
    –with-opengl
    –enable-debug
    –enable-debug_gdb
    –enable-geometry
    –enable-graphics_ctx
    –enable-sound --with-sdl
    –enable-mediactrl
    –enable-display
    –disable-shared \

just add --disable-shared

  1. vim .make file, add
    make $*
    && make -C contrib/src/gizmos $*
    && make -C contrib/src/stc $*

then,

  1. .make
  1. run make_static_setup.py

python make_static_setup.py build_ext --inplace --debug BUILD_GLCANVAS=0 BUILD_GIZMOS=0 WX_CONFIG=/root/dev/wxPython-src-2.8.11.0/bld/wx-config > ~/dev/Python-2.6.5/Modules/Setup.local

I attached the Setup.local, pleae check it.

  1. Configure and build Python

./configure

There is an error:
creating Modules/Setup.local creating Makefile bad word -pthread in core

blablabla, and the configure is exit.

So, I change the line “-pthread -g -O0” to “-lpthread -O0” in Setup.local and the configure is successful,

  1. make
    There are many warnings like
    cc1plus: warning: command line option “-Wstrict-prototypes” is valid for Ada/C/ObjC but not for C++

And,
/root/dev/wxPython-src-2.8.11.0/wxPython/src/gtk/_misc_wrap.cpp:4977: warning: ‘wxGetElapsedTime’ is deprecated (declared at /root/dev/wxPython-src-2.8.11.0/include/wx/stopwatch.h:77)
/root/dev/wxPython-src-2.8.11.0/wxPython/src/gtk/_misc_wrap.cpp:4977: warning: ‘wxGetElapsedTime’ is deprecated (declared at /root/dev/wxPython-src-2.8.11.0/include/wx/stopwatch

Final errors are:
/root/dev/wxPython-src-2.8.11.0/bld/lib/libwx_gtk2d_stc-2.8.a(stclib_DocumentAccessor.o):(.eh_frame+0x11): undefined reference to __gxx_personality_v0' /root/dev/wxPython-src-2.8.11.0/bld/lib/libwx_gtk2d_stc-2.8.a(stclib_Style.o):(.eh_frame+0x12): undefined reference to__gxx_personality_v0’ collect2: ld returned 1 exit status make: *** [python] Error 1

This is the entire build process I executed.
Seems there are some errors about compile c source files and cpp source files meantime.
For Configure and build Python, I tried ./configure CC=gcc CXX=g++, the compile errors keep same…

I used Python-2.6.5.tar.bz2 and wxPython-src-2.8.11.0.tar.bz2, downloaded form www.python.org and www.wxpython.org. The platform is Redhat Linux Server release 5.4

Robin, any idea?
I feel I am approaching to the final success…But need your help, please give me your guidance for me to fix these errors.

Thanks in advance.

Setup.local (30.1 KB)

Final errors are:
/root/dev/wxPython-src-2.8.11.0/bld/lib/libwx_gtk2d_stc-2.8.a(stclib_DocumentAccessor.o):(.eh_frame+0x11):
undefined reference to `__gxx_personality_v0'
/root/dev/wxPython-src-2.8.11.0/bld/lib/libwx_gtk2d_stc-2.8.a(stclib_Style.o):(.eh_frame+0x12):
undefined reference to `__gxx_personality_v0' collect2: ld returned 1
exit status make: *** [python] Error 1

Robin, any idea?

Google found this:

Since you will be linking in C++ code to Python then you need to link it with the libs or flags that will tell it to also link the C++ runtime. IIRC there is a configure option for Python to tell it to do this automatically, or setting CC=g++ in the environment would probably do it too.

I feel I am approaching to the final success...But need your help,
please give me your guidance for me to fix these errors.

Like I said in the other message, I haven't attempted this in many many years, and I'm fairly certain that in almost all cases on relatively modern OS and hardware that it does not provide enough benefit to be worth it.

···

On 6/14/10 2:51 AM, 朱重八 wrote:

--
Robin Dunn
Software Craftsman

Robin,
I really appreciate your help and suggestion, it is very useful for me, especially, for a starter.
I have tried CC=g++, but also failed. Seems that there are still some issues in the Makefile auto generated.

I am debugging it. If I can not resolve this problem, I will simply use the dynamic link.

Thanks so much.

···

2010/6/15 Robin Dunn robin@alldunn.com

On 6/14/10 2:51 AM, 朱重八 wrote:

Final errors are:

/root/dev/wxPython-src-2.8.11.0/bld/lib/libwx_gtk2d_stc-2.8.a(stclib_DocumentAccessor.o):(.eh_frame+0x11):

undefined reference to `__gxx_personality_v0’

/root/dev/wxPython-src-2.8.11.0/bld/lib/libwx_gtk2d_stc-2.8.a(stclib_Style.o):(.eh_frame+0x12):

undefined reference to `__gxx_personality_v0’ collect2: ld returned 1

exit status make: *** [python] Error 1

Robin, any idea?

Google found this:

http://bytes.com/topic/c/answers/433942-undefined-reference-__gxx_personality_v0

Since you will be linking in C++ code to Python then you need to link it with the libs or flags that will tell it to also link the C++ runtime. IIRC there is a configure option for Python to tell it to do this automatically, or setting CC=g++ in the environment would probably do it too.

I feel I am approaching to the final success…But need your help,

please give me your guidance for me to fix these errors.

Like I said in the other message, I haven’t attempted this in many many years, and I’m fairly certain that in almost all cases on relatively modern OS and hardware that it does not provide enough benefit to be worth it.

在 2010年6月19日 上午1:47,朱重八 88pigs@gmail.com写道:

···

2010/6/15 Robin Dunn robin@alldunn.com

On 6/14/10 2:51 AM, 朱重八 wrote:

Final errors are:

/root/dev/wxPython-src-2.8.11.0/bld/lib/libwx_gtk2d_stc-2.8.a(stclib_DocumentAccessor.o):(.eh_frame+0x11):

undefined reference to `__gxx_personality_v0’

/root/dev/wxPython-src-2.8.11.0/bld/lib/libwx_gtk2d_stc-2.8.a(stclib_Style.o):(.eh_frame+0x12):

undefined reference to `__gxx_personality_v0’ collect2: ld returned 1

exit status make: *** [python] Error 1

Robin, any idea?

Google found this:

http://bytes.com/topic/c/answers/433942-undefined-reference-__gxx_personality_v0

Since you will be linking in C++ code to Python then you need to link it with the libs or flags that will tell it to also link the C++ runtime. IIRC there is a configure option for Python to tell it to do this automatically, or setting CC=g++ in the environment would probably do it too.

I feel I am approaching to the final success…But need your help,

please give me your guidance for me to fix these errors.

Like I said in the other message, I haven’t attempted this in many many years, and I’m fairly certain that in almost all cases on relatively modern OS and hardware that it does not provide enough benefit to be worth it.

Robin,
I really appreciate your help and suggestion, it is very useful for me, especially, for a starter.
I have tried CC=g++, but also failed. Seems that there are still some issues in the Makefile auto generated.

I am debugging it. If I can not resolve this problem, I will simply use the dynamic link.

Thanks so much.

Hi Robin,

Finally, I finished the static link of wxPython to Python. But it seems that there are still something wrong.

When I import wx from python prompt, I got Segmentation fault error. Then I tried import core, import gdi, import windows, etc. Only core can be imported successfully, others are all Segmentation fault…

Do you know what happened and how to fix?

Thanks Robin.

Do you have a backtrace from gdb?

There is some code that facilitates the export of a structure of function pointers from _core_ for use by the other modules. You may be running in to a problem dealing with that, since the other modules are no longer dynamically loaded, or something like that.

···

On 6/20/10 10:50 AM, 朱重八 wrote:

在 2010年6月19日 上午1:47,朱重八 <88pigs@gmail.com
<mailto:88pigs@gmail.com>>写道:

    2010/6/15 Robin Dunn <robin@alldunn.com <mailto:robin@alldunn.com>>

        On 6/14/10 2:51 AM, 朱重八 wrote:

            Final errors are:
            /root/dev/wxPython-src-2.8.11.0/bld/lib/libwx_gtk2d_stc-2.8.a(stclib_DocumentAccessor.o):(.eh_frame+0x11):
            undefined reference to `__gxx_personality_v0'
            /root/dev/wxPython-src-2.8.11.0/bld/lib/libwx_gtk2d_stc-2.8.a(stclib_Style.o):(.eh_frame+0x12):
            undefined reference to `__gxx_personality_v0' collect2: ld
            returned 1
            exit status make: *** [python] Error 1

            Robin, any idea?

        Google found this:

        undefined reference to '__gxx_personality_v0' - Post.Byes

        Since you will be linking in C++ code to Python then you need to
        link it with the libs or flags that will tell it to also link
        the C++ runtime. IIRC there is a configure option for Python to
        tell it to do this automatically, or setting CC=g++ in the
        environment would probably do it too.

            I feel I am approaching to the final success...But need your
            help,
            please give me your guidance for me to fix these errors.

        Like I said in the other message, I haven't attempted this in
        many many years, and I'm fairly certain that in almost all cases
        on relatively modern OS and hardware that it does not provide
        enough benefit to be worth it.

    Robin,
    I really appreciate your help and suggestion, it is very useful for
    me, especially, for a starter.
    I have tried CC=g++, but also failed. Seems that there are still
    some issues in the Makefile auto generated.
    I am debugging it. If I can not resolve this problem, I will simply
    use the dynamic link.

    Thanks so much.

Hi Robin,
Finally, I finished the static link of wxPython to Python. But it seems
that there are still something wrong.
When I import wx from python prompt, I got Segmentation fault error.
Then I tried import _core_, import _gdi_, import _windows_, etc. Only
_core_ can be imported successfully, others are all Segmentation fault...
Do you know what happened and how to fix?

--
Robin Dunn
Software Craftsman

Hi Robin,
I attached the core file.
import core , no Segmentation fault error, then import gdi, this error occurred. And the core file generated. Please check it attached.

Thanks.

gdi.zip (1.67 MB)

···

2010/6/23 Robin Dunn robin@alldunn.com

On 6/20/10 10:50 AM, 朱重八 wrote:

在 2010年6月19日 上午1:47,朱重八 <88pigs@gmail.com

mailto:88pigs@gmail.com>写道:

2010/6/15 Robin Dunn <robin@alldunn.com <mailto:robin@alldunn.com>>
    On 6/14/10 2:51 AM, 朱重八 wrote:





        Final errors are:

        /root/dev/wxPython-src-2.8.11.0/bld/lib/libwx_gtk2d_stc-2.8.a(stclib_DocumentAccessor.o):(.eh_frame+0x11):

        undefined reference to `__gxx_personality_v0'

        /root/dev/wxPython-src-2.8.11.0/bld/lib/libwx_gtk2d_stc-2.8.a(stclib_Style.o):(.eh_frame+0x12):

        undefined reference to `__gxx_personality_v0' collect2: ld

        returned 1

        exit status make: *** [python] Error 1







        Robin, any idea?





    Google found this:



    [http://bytes.com/topic/c/answers/433942-undefined-reference-__gxx_personality_v0](http://bytes.com/topic/c/answers/433942-undefined-reference-__gxx_personality_v0)



    Since you will be linking in C++ code to Python then you need to

    link it with the libs or flags that will tell it to also link

    the C++ runtime. IIRC there is a configure option for Python to

    tell it to do this automatically, or setting CC=g++ in the

    environment would probably do it too.







        I feel I am approaching to the final success...But need your

        help,

        please give me your guidance for me to fix these errors.





    Like I said in the other message, I haven't attempted this in

    many many years, and I'm fairly certain that in almost all cases

    on relatively modern OS and hardware that it does not provide

    enough benefit to be worth it.



Robin,

I really appreciate your help and suggestion, it is very useful for

me, especially, for a starter.

I have tried CC=g++, but also failed. Seems that there are still

some issues in the Makefile auto generated.

I am debugging it. If I can not resolve this problem, I will simply

use the dynamic link.



Thanks so much.

Hi Robin,

Finally, I finished the static link of wxPython to Python. But it seems

that there are still something wrong.

When I import wx from python prompt, I got Segmentation fault error.

Then I tried import core, import gdi, import windows, etc. Only

core can be imported successfully, others are all Segmentation fault…

Do you know what happened and how to fix?

Do you have a backtrace from gdb?

There is some code that facilitates the export of a structure of function pointers from core for use by the other modules. You may be running in to a problem dealing with that, since the other modules are no longer dynamically loaded, or something like that.

在 2010年6月24日 下午1:00,朱重八 88pigs@gmail.com写道:

backtrace.txt (7.99 KB)

···

2010/6/23 Robin Dunn robin@alldunn.com

On 6/20/10 10:50 AM, 朱重八 wrote:

在 2010年6月19日 上午1:47,朱重八 <88pigs@gmail.com

mailto:88pigs@gmail.com>写道:

2010/6/15 Robin Dunn <robin@alldunn.com <mailto:robin@alldunn.com>>
    On 6/14/10 2:51 AM, 朱重八 wrote:





        Final errors are:

        /root/dev/wxPython-src-2.8.11.0/bld/lib/libwx_gtk2d_stc-2.8.a(stclib_DocumentAccessor.o):(.eh_frame+0x11):

        undefined reference to `__gxx_personality_v0'

        /root/dev/wxPython-src-2.8.11.0/bld/lib/libwx_gtk2d_stc-2.8.a(stclib_Style.o):(.eh_frame+0x12):

        undefined reference to `__gxx_personality_v0' collect2: ld

        returned 1

        exit status make: *** [python] Error 1







        Robin, any idea?





    Google found this:



    [http://bytes.com/topic/c/answers/433942-undefined-reference-__gxx_personality_v0](http://bytes.com/topic/c/answers/433942-undefined-reference-__gxx_personality_v0)



    Since you will be linking in C++ code to Python then you need to

    link it with the libs or flags that will tell it to also link

    the C++ runtime. IIRC there is a configure option for Python to

    tell it to do this automatically, or setting CC=g++ in the

    environment would probably do it too.







        I feel I am approaching to the final success...But need your

        help,

        please give me your guidance for me to fix these errors.





    Like I said in the other message, I haven't attempted this in

    many many years, and I'm fairly certain that in almost all cases

    on relatively modern OS and hardware that it does not provide

    enough benefit to be worth it.



Robin,

I really appreciate your help and suggestion, it is very useful for

me, especially, for a starter.

I have tried CC=g++, but also failed. Seems that there are still

some issues in the Makefile auto generated.

I am debugging it. If I can not resolve this problem, I will simply

use the dynamic link.



Thanks so much.

Hi Robin,

Finally, I finished the static link of wxPython to Python. But it seems

that there are still something wrong.

When I import wx from python prompt, I got Segmentation fault error.

Then I tried import core, import gdi, import windows, etc. Only

core can be imported successfully, others are all Segmentation fault…

Do you know what happened and how to fix?

Do you have a backtrace from gdb?

There is some code that facilitates the export of a structure of function pointers from core for use by the other modules. You may be running in to a problem dealing with that, since the other modules are no longer dynamically loaded, or something like that.

Hi Robin,
I attached the core file.
import core , no Segmentation fault error, then import gdi, this error occurred. And the core file generated. Please check it attached.

Thanks.

I tried to generate a backtrace, please also check the backtrace.txt attached.

Thanks.

在 2010年6月24日 下午1:14,朱重八 88pigs@gmail.com写道:

在 2010年6月24日 下午1:00,朱重八 88pigs@gmail.com写道:

在 2010年6月19日 上午1:47,朱重八 <88pigs@gmail.com

mailto:88pigs@gmail.com>写道:

2010/6/15 Robin Dunn <robin@alldunn.com <mailto:robin@alldunn.com>>
        Final errors are:

        /root/dev/wxPython-src-2.8.11.0/bld/lib/libwx_gtk2d_stc-2.8.a(stclib_DocumentAccessor.o):(.eh_frame+0x11):

        undefined reference to `__gxx_personality_v0'

        /root/dev/wxPython-src-2.8.11.0/bld/lib/libwx_gtk2d_stc-2.8.a(stclib_Style.o):(.eh_frame+0x12):

        undefined reference to `__gxx_personality_v0' collect2: ld

        returned 1

        exit status make: *** [python] Error 1







        Robin, any idea?





    Google found this:



    [http://bytes.com/topic/c/answers/433942-undefined-reference-__gxx_personality_v0](http://bytes.com/topic/c/answers/433942-undefined-reference-__gxx_personality_v0)



    Since you will be linking in C++ code to Python then you need to

    link it with the libs or flags that will tell it to also link

    the C++ runtime. IIRC there is a configure option for Python to

    tell it to do this automatically, or setting CC=g++ in the

    environment would probably do it too.







        I feel I am approaching to the final success...But need your

        help,

        please give me your guidance for me to fix these errors.





    Like I said in the other message, I haven't attempted this in

    many many years, and I'm fairly certain that in almost all cases

    on relatively modern OS and hardware that it does not provide

    enough benefit to be worth it.



Robin,

I really appreciate your help and suggestion, it is very useful for

me, especially, for a starter.

I have tried CC=g++, but also failed. Seems that there are still

some issues in the Makefile auto generated.

I am debugging it. If I can not resolve this problem, I will simply

use the dynamic link.



Thanks so much.

Hi Robin,

Finally, I finished the static link of wxPython to Python. But it seems

that there are still something wrong.

When I import wx from python prompt, I got Segmentation fault error.

Then I tried import core, import gdi, import windows, etc. Only

core can be imported successfully, others are all Segmentation fault…

Do you know what happened and how to fix?

Do you have a backtrace from gdb?

There is some code that facilitates the export of a structure of function pointers from core for use by the other modules. You may be running in to a problem dealing with that, since the other modules are no longer dynamically loaded, or something like that.

Hi Robin,
I attached the core file.
import core , no Segmentation fault error, then import gdi, this error occurred. And the core file generated. Please check it attached.

Thanks.

I tried to generate a backtrace, please also check the backtrace.txt attached.

Thanks.
Hi Robin,

Any idea about the backtrace?

···

2010/6/23 Robin Dunn robin@alldunn.com

On 6/20/10 10:50 AM, 朱重八 wrote:

    On 6/14/10 2:51 AM, 朱重八 wrote:

It appears that my prior guess is at least in the right ballpark.
wxPyPtrTypeMap_Add is actually a macro that evaluates to:

    (wxPyGetCoreAPIPtr()->p_wxPyPtrTypeMap_Add(a, b))

The wxPyGetCoreAPIPtr function will attempt to import the wxPython C API
structure I mentioned before, if it hasn't been imported already, and
will return a pointer to it. The segfault is most likely caused by
Python not being able to find that module and so the returned value is
NULL, and so when the line above tries to dereference that NULL pointer
to be able to call the function then it segfaults and dumps core.

The import is done in wx/wxPython/wxPython.h and looks like this:

    wxPyCoreAPIPtr = (wxPyCoreAPI*)PyCObject_Import("wx._core_",
"_wxPyCoreAPI");

Since the _core_ module in your build is no longer in the wx package
then I suppose that if you remove the "wx." above it may work, at least
until you run in to the next problem. When you make the change make
sure that *all* of the wxPython C++ source files are rebuilt so they can
all pick up the new implementation of that inline function.

···

On 6/26/10 9:54 AM, 朱重八 wrote:

Hi Robin,
Any idea about the backtrace?

Program terminated with signal 11, Segmentation fault.
[New process 5948]
#0 0x083f356d in init_gdi_ () at /root/dev/wxPython-src-2.8.11.0/wxPython/src/gtk/_gdi_wrap.cpp:42474
42474 wxPyPtrTypeMap_Add("wxFontEnumerator", "wxPyFontEnumerator");

--
Robin Dunn
Software Craftsman

OK. Thanks Robin. I will continue to try to build it. Hope the problem is not difficult to me:)
Thanks again.

···

2010/6/29 Robin Dunn robin@alldunn.com

On 6/26/10 9:54 AM, 朱重八 wrote:

Hi Robin,

Any idea about the backtrace?

Program terminated with signal 11, Segmentation fault.

[New process 5948]

#0 0x083f356d in init_gdi_ () at /root/dev/wxPython-src-2.8.11.0/wxPython/src/gtk/_gdi_wrap.cpp:42474

42474 wxPyPtrTypeMap_Add(“wxFontEnumerator”, “wxPyFontEnumerator”);

It appears that my prior guess is at least in the right ballpark.

wxPyPtrTypeMap_Add is actually a macro that evaluates to:

(wxPyGetCoreAPIPtr()->p_wxPyPtrTypeMap_Add(a, b))

The wxPyGetCoreAPIPtr function will attempt to import the wxPython C API

structure I mentioned before, if it hasn’t been imported already, and

will return a pointer to it. The segfault is most likely caused by

Python not being able to find that module and so the returned value is

NULL, and so when the line above tries to dereference that NULL pointer

to be able to call the function then it segfaults and dumps core.

The import is done in wx/wxPython/wxPython.h and looks like this:

wxPyCoreAPIPtr = (wxPyCoreAPI*)PyCObject_Import("wx._core_",

“_wxPyCoreAPI”);

Since the core module in your build is no longer in the wx package

then I suppose that if you remove the “wx.” above it may work, at least

until you run in to the next problem. When you make the change make

sure that all of the wxPython C++ source files are rebuilt so they can

all pick up the new implementation of that inline function.