Re: Building Clearsilver under LTIB

Brandon Long <[email protected]> Tue, 5 May 2009 14:00:52 -0700
Newsgroups gmane.text.clearsilver.general
Organization Fiction L Networks
Message-ID <20090505210052.GD22915@bl1>
So, if you can run programs built for the board on your local box, its
probably fairly straight-forward.

If not, things get more complicated, but what I think you need to do is
add a named argument to the Extension class that's built in setup.py as
part of setup_args and pass an empty extra_compile_args argument, ie:
    'ext_modules': [Extension(
      name="neo_cgi",
      sources=["neo_cgi.c", "neo_cs.c", "neo_util.c"],
      include_dirs=INC_DIRS,
      library_dirs=LIB_DIRS,
      libraries=LIBRARIES,
      extra_compile_args='',
      )]

You may also need an extra_link_args if there are things passed to the linker
you don't want.  And it may not be empty.

I think distutils loads these by default from the
/usr/lib/python2.x/config/Makefile or something like that.

Brandon

On 05/05/09 Rick Walsh uttered the following other thing:
>    I agree.  The cross-compile does work for my C/CPP files but the Python
>    stuff does not.  Brandon is correct about setup.py -- it's not friendly
>    with the cross-compiler.  However it seems like its just a couple options
>    that are hanging it up.  If I can get it to omit "-march=i586 -mtune=i686"
>    from the command, I think the darn thing would work.  Admittedly, I'm a
>    novice when it comes to setup.py, so if someone has a suggestion... 
> 
>    I guess as a fallback I can always manually compile it using the command
>    line setup.py gives me.
> 
>    make[1]: Leaving directory
>    `/home/rwalsh05/LTIB/cmn100/rpm/BUILD/clearsilver-0.10.5/cs'
>    make[1]: Entering directory
>    `/home/rwalsh05/LTIB/cmn100/rpm/BUILD/clearsilver-0.10.5/cgi'
>    make[1]: Nothing to be done for `everything'.
>    make[1]: Leaving directory
>    `/home/rwalsh05/LTIB/cmn100/rpm/BUILD/clearsilver-0.10.5/cgi'
>    make[1]: Entering directory
>    `/home/rwalsh05/LTIB/cmn100/rpm/BUILD/clearsilver-0.10.5/python'
>    rm -f neo_cgi.so
>    CC="gcc" LDSHARED="gcc -shared -fPIC" /usr/bin/python setup.py build_ext
>    --inplace
>    adding lib_path $(LIB_DIR)
>    adding lib z
>    Overriding setup's CC from gcc -pthread to gcc
>    running build_ext
>    building 'neo_cgi' extension
>    gcc -fno-strict-aliasing -DNDEBUG -O2 -march=i586 -mtune=i686
>    -fmessage-length=0 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -g -fwrapv
>    -fPIC -I../ -I/usr/include/python2.5 -c neo_cgi.c -o
>    build/temp.linux-i686-2.5/neo_cgi.o
>    cc1: error: unrecognized command line option "-march=i586"
>    neo_cgi.c:1: error: bad value (i686) for -mtune= switch
>    error: command 'gcc' failed with exit status 1
>    make[1]: *** [neo_cgi.so] Error 1
>    make[1]: Leaving directory
>    `/home/rwalsh05/LTIB/cmn100/rpm/BUILD/clearsilver-0.10.5/python'
>    make: *** [cs] Error 2
>    error: Bad exit status from /home/rwalsh05/LTIB/cmn100/tmp/rpm-tmp.53647
>    (%build)
> 
>    On Tue, May 5, 2009 at 4:34 AM, Mario Gliewe <[email protected]> wrote:
> 
>      Hello,
> 
>      cross compiling clearsilver is working fine, one has to remove
>      the 'test' target in cs/makefile by hand though.
> 
>      this is what i'm doing on my linux-host to cross-compile using mingw
>      (excerpt from my Makefile):
> 
>      -snip-
> 
>      MINGW=i586-mingw32msvc
> 
>      windows/clearsilver/rules.mk:
>         CC=${MINGW}-gcc \
>         AR=${MINGW}ar \
>         CXX=${MINGW}-g++ \
>         RANLIB=${MINGW}-ranlib \
>             cd windows/clearsilver; \
>             ./configure --host=${MINGW} --target=${MINGW} \
>                         --disable-perl --disable-python
>      build-win-clearsilver:
>             make -C windows/clearsilver
> 
>      -snap-
> 
>      greets
>      mario
> 
>      (brandon: sorry for double-post, wrong button /-)
> 
>    --
>    Regards,
>    Rick Walsh
>    [email protected]

-- 
 "The most merciful thing in the world is the inability of the human
  mind to correlate all its contents." -- H. P. Lovecraft
                                           http://www.fiction.net/blong/