Le 27/02/2012 23:29, Robin Dunn a �crit :
Le 24/02/2012 20:01, Robin Dunn a �crit :
Hi all,
I try to build wxPython.2.8.12 (2.8.10 does the same) on Mandriva
2011.0 :
--------------------------------------
python setup.py build_ext --inplace --debug UNICODE=0
...
g++ -pthread -shared -Wl,--as-needed -Wl,--no-undefined -Wl,-z,relro
-Wl,-O1 -Wl,--build-id -Wl,--enable-new-dtags -g
build-gtk2/temp.linux-i686-2.7/src/helpers.o
build-gtk2/temp.linux-i686-2.7/src/gtk/_core_wrap.o -L/usr/X11R6/lib
-L/usr/lib -lwx_gtk2d_richtext-2.8 -lwx_gtk2d_aui-2.8
-lwx_gtk2d_xrc-2.8
-lwx_gtk2d_html-2.8 -lwx_gtk2d_adv-2.8 -lwx_gtk2d_core-2.8
-lwx_based_xml-2.8 -lwx_based_net-2.8 -lwx_based-2.8 -lpython2.7 -o
/usr/local/wxPython-src-2.8.12.1/wxPython/wx/_core_.so -pthread
build-gtk2/temp.linux-i686-2.7/src/helpers.o: In function
`wxPyGetWinHandle(wxWindow*)':
/usr/local/wxPython-src-2.8.12.1/wxPython/src/helpers.cpp:2113:
undefined reference to `g_type_check_instance_cast'
/usr/local/wxPython-src-2.8.12.1/wxPython/src/helpers.cpp:2113:
undefined reference to `gdk_x11_drawable_get_xid'
/usr/local/wxPython-src-2.8.12.1/wxPython/src/helpers.cpp:2113:
undefined reference to `gdk_x11_drawable_get_xid'
build-gtk2/temp.linux-i686-2.7/src/helpers.o: In function
`wxPyTestDisplayAvailable()':
/usr/local/wxPython-src-2.8.12.1/wxPython/src/helpers.cpp:3276:
undefined reference to `XOpenDisplay'
/usr/local/wxPython-src-2.8.12.1/wxPython/src/helpers.cpp:3279:
undefined reference to `XCloseDisplay'
collect2: ld a retourn� 1 code d'�tat d'ex�cution
error: command 'g++' failed with exit status 1
---------------------------------------
python :
Python 2.7.2 (default, Dec 19 2011, 09:56:13)
[GCC 4.6.1 20110627 (Mandriva)] on linux2
libgtk+2.0-devel-2.24.5-3-mdv2011.0.i586
It seems that the undefined references are in
/usr/include/gtk-2.0/gdk/gdkx.h
Why the compiler does not find it ?
Is there a path problem ?
Do you have the -devel packages installed for gtk2? (I'm not sure what
Mandriva calls them...) If you have the headers I would assume that
you do, but perhaps some parts were packaged separately.
What do you get when you run "pkg-config gtk+-2.0 --cflags"? Those
flags should be visible in the compile commands that wxPython uses,
but I don't see anything like "-I/usr/include/gtk-2.0" like I would
expect to be there.
The result for "pkg-config gtk+-2.0 --cflags" is :
-pthread -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include
-I/usr/include/atk-1.0 -I/usr/include/cairo
-I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
-I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12
If I compare the packages between Mandriva 2010.2 et Mandriva 2011.0, in
a first look I don't see difference.
I have the package "libgtk+2.0-devel-2.24.5-3-mdv2011.0.i586" which
contains /usr/include/gtk-2.0/gdk/gdkx.h.
So, "I give my tongue to the cat" (It's a French expression which means
I don't know the answer and help is welcome).
Thank you again for your help
"Meow"
The output of the pkg-config command should be used in the compile
command lines for the wxPython build, but I don't see those flags used
above. So my guess is that there is something going wrong in the
config.py or setup.py scripts when it is running that command, or that
the use of the flags is being suppressed somehow. You should try
debugging the setup.py script to see if you can figure out what is
happening.
Just before I can see the order :
gcc -pthread -fno-strict-aliasing -O2 -g -frecord-gcc-switches
-Wstrict-aliasing=2 -pipe -Wformat -Werror=format-security
-Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4
-fomit-frame-pointer -mtune=generic -march=i586
-fasynchronous-unwind-tables -DNDEBUG -O2 -g -frecord-gcc-switches
-Wstrict-aliasing=2 -pipe -Wformat -Werror=format-security
-Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4
-fomit-frame-pointer -mtune=generic -march=i586
-fasynchronous-unwind-tables -g -fPIC -g
-DSWIG_TYPE_TABLE=_wxPython_table -DSWIG_PYTHON_OUTPUT_TUPLE
-DWXP_USE_THREAD=1 -UNDEBUG -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES
-D__WXDEBUG__ -D__WXGTK__ -Iinclude -Isrc
-I/usr/lib/wx/include/gtk2-ansi-debug-2.8 -I/usr/include/wx-2.8
-I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0
-I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0
-I/usr/include/pango-1.0 -I/usr/include/glib-2.0
-I/usr/lib/glib-2.0/include -I/usr/include/pixman-1
-I/usr/include/freetype2 -I/usr/include/libpng12
-I/usr/include/python2.7 -c src/helpers.cpp -o
build-gtk2/temp.linux-i686-2.7/src/helpers.o -pthread -g -O0 -pthread
This part of the compilation works.
Oops, sorry for leading you down the wrong path. I hadn't realized that it was the link step we were looking at before.
It seems that the problem comes from the option "-Wl,--no-undefined",
given to g++ compiler. You can see it above in the mail.
In Mandriva 2010, there is not this option !...
That just means to pass the --no-undefined option to the linker. Do "man ld" to see what it does. I'm not sure where that option comes from however as I don't see it in my build on Ubuntu. Perhaps it is there because of some customizations to how Python was built for Mandriva.
If I try without this option, the compilation creates the file "_core_.so".
But the problem is not solved, I must confess, I am not a C programmer,
don't repeat it 
What happens in this case that makes you think it is not solved? Did you try rerunning setup.py so it can try building the rest of the modules?
Is it normal, to have all these undefined references "XOpenDisplay",
"XCloseDisplay", "g_type_check_instance_cast" and so on ... ?
No. However these symbols are in libraries that are not explicitly linked by the wxPython build, but they should be loaded implicitly due to the libraries that are linked by others. (wxGTK links with GTK libs which links with the X11 libs.)
1) Yes
I must find why this horrible compiler takes this bad option.
I have begun "man g++", but I am afraid to fall asleep only half ...
So help is welcome ...
2) No
I can try to comment all these bad lines in the sources, until the
compilation works.
I hope it will stay a few lines in the programs
If you want to go this way then there are two places you will need to change in helpers.cpp. In wxPyTestDisplayAvailable change the code inside of the "#ifdef __WXGTK__" to just "return true;" and in wxPyGetWinHandle change the code inside of "#if defined(__WXGTK__) || defined(__WXX11)" to "return 0;"
This will prevent you from being able to do anything that needs the handle of the underlying X-Window, like having some other X aware library (like dislin or vtk) draw upon your windows, but everything else should be okay.
···
On 2/29/12 7:25 AM, Hugues JEAN-BAPTISTE wrote:
On 2/27/12 1:24 AM, Hugues JEAN-BAPTISTE wrote:
On 2/24/12 5:01 AM, Hugues JEAN-BAPTISTE wrote:
--
Robin Dunn
Software Craftsman