Linking problem w. wxPython (core_wrap.o)

Continuing on my linking problem, this time I don't quite understand where the showbraker is,
or what the fix might be. Here's my Makefile's output from the start (I'm sure there must be superfluous includes and libs):

···

---------------------------------------
swig -python -c++ ./shadow/example.i
g++ -g -c ./shadow/example.cxx ./shadow/example_wrap.cxx -I/usr/local/include/python2.3 -I/q/wxPy/include -I/q/wxPy/GTKASCII/lib/wx/include/gtk2d-2.5
g++ -g -c `wx-config --cxxflags` ./src/libpy.c -I/usr/local/include/python2.3 -I/q/wxPy/include -I/q/wxPy/GTKASCII/lib/wx/include/gtk2d-2.5
g++ -g -c `wx-config --cxxflags` ./src/drawlist.cpp -I/usr/local/include/python2.3 -I/q/wxPy/include -I/q/wxPy/GTKASCII/lib/wx/include/gtk2d-2.5
g++ -g -c `wx-config --cxxflags` ./src/helpers.cpp -I/usr/local/include/python2.3 -I/q/wxPy/include -I/q/wxPy/GTKASCII/lib/wx/include/gtk2d-2.5 -D__WXDEBUG__ -Ilib/wx/include/gtk2d-2.5 -I/include -D_REENTRANT -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/pango-1.0 -I/usr/X11R6/include -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -I/usr/X11R6/include
g++ -g -c `wx-config --cxxflags` ./mygtk/calendar_wrap.cpp -I/usr/local/include/python2.3 -I/q/wxPy/include -I/q/wxPy/GTKASCII/lib/wx/include/gtk2d-2.5
g++ -g -c `wx-config --cxxflags` ./mygtk/controls_wrap.cpp -I/usr/local/include/python2.3 -I/q/wxPy/include -I/q/wxPy/GTKASCII/lib/wx/include/gtk2d-2.5
g++ -g -c `wx-config --cxxflags` ./mygtk/core_wrap.cpp -I/usr/local/include/python2.3 -I/q/wxPy/include -I/q/wxPy/GTKASCII/lib/wx/include/gtk2d-2.5
g++ -g -c `wx-config --cxxflags` ./mygtk/gdi_wrap.cpp -I/usr/local/include/python2.3 -I/q/wxPy/include -I/q/wxPy/GTKASCII/lib/wx/include/gtk2d-2.5
g++ -g -c `wx-config --cxxflags` ./mygtk/grid_wrap.cpp -I/usr/local/include/python2.3 -I/q/wxPy/include -I/q/wxPy/GTKASCII/lib/wx/include/gtk2d-2.5
g++ -g -c `wx-config --cxxflags` ./mygtk/html_wrap.cpp -I/usr/local/include/python2.3 -I/q/wxPy/include -I/q/wxPy/GTKASCII/lib/wx/include/gtk2d-2.5
g++ -g -c `wx-config --cxxflags` ./mygtk/misc_wrap.cpp -I/usr/local/include/python2.3 -I/q/wxPy/include -I/q/wxPy/GTKASCII/lib/wx/include/gtk2d-2.5
g++ -g -c `wx-config --cxxflags` ./mygtk/windows_wrap.cpp -I/usr/local/include/python2.3 -I/q/wxPy/include -I/q/wxPy/GTKASCII/lib/wx/include/gtk2d-2.5
g++ -g -c `wx-config --cxxflags` ./mygtk/wizard_wrap.cpp -I/usr/local/include/python2.3 -I/q/wxPy/include -I/q/wxPy/GTKASCII/lib/wx/include/gtk2d-2.5
g++ -g -c `wx-config --cxxflags` -I/usr/local/include/python2.3 -I/q/wxPy/include -I/q/wxPy/GTKASCII/lib/wx/include/gtk2d-2.5 -o b1.o b1.cpp
In file included from /usr/local/include/python2.3/Python.h:8,
                 from b1.cpp:25:
/usr/local/include/python2.3/pyconfig.h:844: warning: `_POSIX_C_SOURCE' redefined
/usr/include/features.h:171: warning: this is the location of the previous definition
g++ -g -o b1 b1.o example.o example_wrap.o calendar_wrap.o controls_wrap.o core_wrap.o gdi_wrap.o grid_wrap.o html_wrap.o misc_wrap.o windows_wrap.o wizard_wrap.o libpy.o helpers.o drawlist.o /usr/local/lib/python2.3/config/libpython2.3.a /q/wxPy/GTKASCII-build/lib/libwx_gtk2d-2.5.a /q/wxPy/GTKASCII-build/lib/libwx_gtk2d_gizmos-2.5.a /q/wxPy/GTKASCII-build/lib/libwx_gtk2d_gl-2.5.a /q/wxPy/GTKASCII-build/lib/libwx_gtk2d_ogl-2.5.a /q/wxPy/GTKASCII-build/lib/libwx_gtk2d_stc-2.5.a /q/wxPy/GTKASCII-build/lib/libwx_gtk2d_xrc-2.5.a /q/wxPy/GTKASCII-build/lib/libwxexpatd.a /q/wxPy/GTKASCII-build/lib/libwxjpegd.a /q/wxPy/GTKASCII-build/lib/libwxpngd.a /q/wxPy/GTKASCII-build/lib/libwxtiffd.a /q/wxPy/GTKASCII-build/lib/libwxzlibd.a -lnsl -ldl -lreadline -ltermcap -lieee -lpthread -lutil -lm `wx-config --libs`
core_wrap.o: In function `wxGetApp(void)':
/c/d/wx/wx/./mygtk/core_wrap.cpp(.text+0x23a8): multiple definition of `wxGetApp(void)'
b1.o(.text+0x3478):/c/d/wx/wx/b1.cpp: first defined here
/q/wxPy/GTKASCII-build/lib/libwx_gtk2d-2.5.a(monolib_utilsunx.o): In function `wxGetFreeMemory(void)':
monolib_utilsunx.o(.text+0x180c): multiple definition of `wxGetFreeMemory(void)'
misc_wrap.o(.text+0x18c):/c/d/wx/wx/./mygtk/misc_wrap.cpp: first defined here/usr/bin/ld: Warning: size of symbol `wxGetFreeMemory(void)' changed from 73
to 168 in /q/wxPy/GTKASCII-build/lib/libwx_gtk2d-2.5.a(monolib_utilsunx.o)
/usr/local/lib/python2.3/config/libpython2.3.a(posixmodule.o): In function `posix_tmpnam':
/z/Python-2.3/./Modules/posixmodule.c:5783: the use of `tmpnam_r' is dangerous, better use `mkstemp'
/usr/local/lib/python2.3/config/libpython2.3.a(posixmodule.o): In function `posix_tempnam':
/z/Python-2.3/./Modules/posixmodule.c:5738: the use of `tempnam' is dangerous, better use `mkstemp'
collect2: ld returned 1 exit status
make: *** [b1] Error 1
---------------------------------------

All these Python-related messages are harmless. But besides that, I'm rather clueless.

Thanks for any hint or suggestion,
Vio

Vio wrote:

Continuing on my linking problem, this time I don't quite understand where the showbraker is,
or what the fix might be. Here's my Makefile's output from the start (I'm sure there must be superfluous includes and libs):

---------------------------------------

[...]

g++ -g -c `wx-config --cxxflags` -I/usr/local/include/python2.3 -I/q/wxPy/include -I/q/wxPy/GTKASCII/lib/wx/include/gtk2d-2.5 -o b1.o b1.cpp
In file included from /usr/local/include/python2.3/Python.h:8,
                from b1.cpp:25:
/usr/local/include/python2.3/pyconfig.h:844: warning: `_POSIX_C_SOURCE' redefined
/usr/include/features.h:171: warning: this is the location of the previous definition

IIRC, this can be corrected by changing the order that things are #included in b1.cpp.

g++ -g -o b1 b1.o example.o example_wrap.o calendar_wrap.o controls_wrap.o core_wrap.o gdi_wrap.o grid_wrap.o html_wrap.o misc_wrap.o windows_wrap.o wizard_wrap.o libpy.o helpers.o drawlist.o /usr/local/lib/python2.3/config/libpython2.3.a /q/wxPy/GTKASCII-build/lib/libwx_gtk2d-2.5.a /q/wxPy/GTKASCII-build/lib/libwx_gtk2d_gizmos-2.5.a /q/wxPy/GTKASCII-build/lib/libwx_gtk2d_gl-2.5.a /q/wxPy/GTKASCII-build/lib/libwx_gtk2d_ogl-2.5.a /q/wxPy/GTKASCII-build/lib/libwx_gtk2d_stc-2.5.a /q/wxPy/GTKASCII-build/lib/libwx_gtk2d_xrc-2.5.a /q/wxPy/GTKASCII-build/lib/libwxexpatd.a /q/wxPy/GTKASCII-build/lib/libwxjpegd.a /q/wxPy/GTKASCII-build/lib/libwxpngd.a /q/wxPy/GTKASCII-build/lib/libwxtiffd.a /q/wxPy/GTKASCII-build/lib/libwxzlibd.a -lnsl -ldl -lreadline -ltermcap -lieee -lpthread -lutil -lm `wx-config --libs`
core_wrap.o: In function `wxGetApp(void)':
/c/d/wx/wx/./mygtk/core_wrap.cpp(.text+0x23a8): multiple definition of `wxGetApp(void)'

[...]

You are linking the wx libs twice. First when you specify the .a files (which means to add all the objects in the .a into your app, probably not what you want) and second when the output of `wx-config --libs` is expanded into -L and -l flags.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!