[SciPy-dev] Argh!! Still the same error after 1 year

eric jones eric at enthought.com
Sat Dec 7 14:05:48 CST 2002


Hey Rob,

> I can't believe you haven't fixed the FreeBSD problem that I pointed
out
> a year ago.  

Heh.  Perhaps you're aware of how ludicrous this sounds to me?  The
beauty of open source is that if I don't solve your problem, you can.

Judging by the notes in the code (see below), it works most places and
is just waiting for a FreeBSD user (not me) to fix it on their platform
(without breaking others).    

Long story short: Make a patch and send it in.
 
> My website will be in IEEE A&P Magazine in December I
> wanted to update the Weave section and promote SciPy.  

Congrats on the article.

> But I'm still getting the same error message I got a year ago on
FreeBSD:
> 
> Traceback (most recent call last):
>   File "/home/rob/published/xyzfdtd-weave/xyzfdtd-weave.py", line 672,
> in ?
>     weave.blitz(field1)
>   File "/usr/local/lib/python2.2/site-packages/weave/blitz_tools.py",
> line 99, in blitz
>     type_factories = blitz_type_factories,
>   File "/usr/local/lib/python2.2/site-packages/weave/inline_tools.py",
> line 432, in compile_function
>     exec 'import ' + module_name
>   File "<string>", line 1, in ?
> ImportError:
>
/crypt/robcrypt/.python22_compiled/sc_5918489f47ec98f2673bc089fb5704cb1.
so
> :
> Undefined symbol "cerr"
> 
> Cerr, the bane of my weave attempts.  In the past I had to hack my
Weave
> source code to inlcude std++ library to get rid of this.

This is not a general solution and breaks other platforms.  We have
fixed the issue on a majority of platforms by searching the link line in
distutils. If 'gcc' is found, in the string, it is replace by 'g++'.

Here is the code you need to fix (note the FreeBSD comment):

def _init_posix():
    old_init_posix()
    ld = distutils.sysconfig._config_vars['LDSHARED']
    #distutils.sysconfig._config_vars['LDSHARED'] =
ld.replace('gcc','g++')
    # FreeBSD names gcc as cc, so the above find and replace doesn't
work.    
    # So, assume first entry in ld is the name of the linker -- gcc or
cc or 
    # whatever.  This is a sane assumption, correct?
    # If the linker is gcc, set it to g++
    link_cmds = ld.split()    
    if gcc_exists(link_cmds[0]):
        link_cmds[0] = 'g++'
        ld = ' '.join(link_cmds)
        distutils.sysconfig._config_vars['LDSHARED'] = ld   

Throwing a 'stdc++' in when 'cc' is found would cause other systems
(even FreeBSD systems) that have 'cc' pointing at a different compiler
than 'gcc' to break.  You can run some diagnostics with system calls on
the link_cmds[0] to see if it is really 'gcc' -- if so replace it with
'g++'.  That should solve your problem.

> Please fix it, 

Send in your patch to the list.  A SciPy developer will apply it when
they have time.

> so  I can include Blitz'd code on my web site.

Regards,
Eric




More information about the Scipy-dev mailing list