Distutils gcc error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Brian Victor

    Distutils gcc error

    I am attempting to distribute my wxPython program with the aid of
    distutils. I have one C++ module that needs to built on the user's
    machine. When I run "./setup.py build", the following appears on the
    terminal:

    gcc -DNDEBUG -DNDEBUG -g -O3 -Wall -Wstrict-prototypes
    -fno-strict-aliasing -fPIC -Isrc -I/usr/include/python2.2 -c src/bwaa.cc
    -o build/temp.linux-ppc-2.2/bwaa.o -I/usr/local/lib/wx/include/gtk-2.4
    -DGTK_NO_CHECK_C ASTS -D__WXGTK__ -D_FILE_OFFSET_B ITS=64 -D_LARGE_FILES
    [snip]
    /usr/local/include/wx/setup.h:15: #error No __WXxxx__ define set! Please
    define one of
    __WXBASE__,__WX GTK__,__WXMSW__ ,__WXMOTIF__,__ WXMAC__,__WXQT_ _,__WXPM__,__WX STUBS__

    That error message is consistent with failure to define __WXGTK__.
    However, that macro is clearly defined on the command line, and copying
    and pasting that line into the terminal causes the build to succeed.
    Why would that be?

    This is how I have the extention defined in my setup.py file:

    wxlibs = commands.getout put("wx-config --libs")
    wxcxxflags = commands.getout put("wx-config --cxxflags")

    bwaaext = Extension("bwaa scalec", ["src/bwaa.cc", "src/bwaascale.cc"],
    include_dirs=["src"],
    extra_link_args =[wxlibs],
    extra_compile_a rgs=[wxcxxflags])
    [snip]
    ext_modules=[bwaaext])

    If anyone can point me to a fix, I would appreciate it. Thanks in advance!

    --
    Brian
  • Brian Victor

    #2
    Re: Distutils gcc error

    Following up to myself for googling purposes.

    Brian Victor wrote:[color=blue]
    > wxlibs = commands.getout put("wx-config --libs")
    > wxcxxflags = commands.getout put("wx-config --cxxflags")
    >
    > bwaaext = Extension("bwaa scalec", ["src/bwaa.cc", "src/bwaascale.cc"],
    > include_dirs=["src"],
    > extra_link_args =[wxlibs],
    > extra_compile_a rgs=[wxcxxflags])[/color]

    The compiler was taking the chunk of arguments returned by wx-config as
    one large, nonsensical argument. This is solved by using:

    extra_link_args =wxlibs.split() ,
    extra_compile_a rgs=wxcxxflags. split())

    --
    Brian

    Comment

    Working...