Subject: Re: [Syfi-dev] SyFi and Instant with python problems

From: [email-masked]
Date: Sun, 30 Nov 2008 16:05:30 +0100 (CET)

> Dear developers of SyFi
>
> In hope of using the FENICS suite i am currently under way of
> configuring all the tools needed by FENICS. Because i work at university
> we do not have root access and i install mainly under my local
> /home/directory. I run into the following problems or bugs or however
> you might call this (my skills in installing libraries and components on
> linux is still small especially in troubleshooting, so i did not know
> how to mail you a patch or bugfix or something).
> Because i have CLN and GINAC under local directories i modified my
> PKG-CONFIG_PATH variable accordingly and the configure script
> successfully resolved the dependencies. Running make is fine but at the
> very end, there will be a gcc-compile command issued for the generation
> of 'SyFi_wrap.cxx' and there i loose the include-directory for the
> CLN-repository. To fix this I added an '-I/home/priesen/num/cln/include'
> in line 40 of the 'python/setup.py' -script as (after running
> 'configure' and before (re-)running make):
>
>   include_dirs=['.', '../syfi', '/home/priesen/num/syfi/include',
> '/home/priesen/num/cln/include'] + ginac_dir
>
> then, 'make' and 'make install' was successfull.
> hopefully this is enough information to resolve this problem, else
> please tell me what you need from my side to track this problem in detail.

OK, your SyFi installation should then be ok, or ?

I think the problem is that the pkg-config files in GiNaC is not correct, do
you use and old version of GiNaC?

pkg-config ginac --cflags should list all required include dirs for GiNaC
(and CLN).

>
> The other problem i encounter is that i use python2.4 and i can not
> compile the 'Instant'-package. when byte-compiling the
> 'cache.py'-routine i get the following error:
>
> byte-compiling
> /home/priesen/num/instant/lib/python2.4/site-packages/instant/cache.py
> to cache.pyc
>    File
> "/home/priesen/num/instant/lib/python2.4/site-packages/instant/cache.py",
> line 40
>      finally:
>            ^
> SyntaxError: invalid syntax
>
>
> There is no problem im compiling instant with python2.5 but as SyFi i
> have configured SyFi with python2.4 (and everething else as swiginac,
> symbolic, etc..) i would like to compile instant with python2.4.
> i also tried to install the previous release of instant (0.9.4), this
> was successfull, however not compatible with the other modules.
> Hopefully you can advise me how to compile instant-0.9.5 with python2.4,
> or else please tell me what other information you need.
>

I'm sorry to say that instant-0.9.5 requires python 2.5 or newer. What
was the problem with instant-0.9.4 ?

Kent

> Sincerely,
> Patrick Riesen

---

From: Patrick Riesen <[email-masked]>
Date: Tue, 02 Dec 2008 10:20:29 +0100

Dear Kent, cc Syfi/Instant developers

ok, yes i'm also confused that the cln/include-path gets lost although, 
the pkg-config knows about it. anyhow it could fix that with the 
workaround i described.

as sfc uses python2.5 and instant as well, i now readjusted my whole 
stuff and turned to python2.5. the other packages of fenics (fiat, ffc, 
ferari and ufc do well with python2.5)

the problems now remain with the creation of the syfi-module and the 
'just-in-time' compiling with instant.

1)
in the case of SyFi, the gcc-compiler and swig is used to build the 
"SyFi_wrap.cxx", which fails with the following output:

building '_SyFi' extension
creating build/temp.linux-x86_64-2.5
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall 
-Wstrict-prototypes -fPIC -I. -I../syfi -I/home/priesen/num/syfi/include 
-I/home/priesen/num/cln/include -I/home/priesen/num/ginac/include 
-I/usr/pack/python-2.5.2-sd/amd64-debian-linux4.0/include/python2.5 -c 
SyFi_wrap.cxx -o build/temp.linux-x86_64-2.5/SyFi_wrap.o
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for 
Ada/C/ObjC but not for C++
SyFi_wrap.cxx: In function 'int 
SWIG_Python_ConvertFunctionPtr(PyObject*, void**, swig_type_info*)':
SyFi_wrap.cxx:2051: error: invalid conversion from 'const char*' to 'char*'
SyFi_wrap.cxx: In function 'int SWIG_AsCharPtrAndSize(PyObject*, char**, 
size_t*, int*)':
SyFi_wrap.cxx:5023: error: cannot convert 'int*' to 'Py_ssize_t*' for 
argument '3' to 'int PyString_AsStringAndSize(PyObject*, char**, 
Py_ssize_t*)'
SyFi_wrap.cxx: In function 'void SWIG_Python_FixMethods(PyMethodDef*, 
swig_const_info*, swig_type_info**, swig_type_info**)':
SyFi_wrap.cxx:49895: error: invalid conversion from 'const char*' to 'char*'
error: command 'gcc' failed with exit status 1
make[2]: *** [build] Error 1
make[2]: Leaving directory `/home/priesen/softw/syfi/python'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/priesen/softw/syfi'
make: *** [all] Error 2

2) i have similar problems with instant, which i could install for 
python2.5, but when running some test examples the compiling always 
fails with e.g.

In instant.recompile: The module did not compile, see 
'/tmp/tmp7XWixt2008-12-2-10-15_instant/instant_module_5bc73bd961e29c451f59fef5a2f1ebe9ff034456/compile.log'

and in the compile.log i then find

running build_ext
building '_instant_module_5bc73bd961e29c451f59fef5a2f1ebe9ff034456' 
extension
creating build
creating build/temp.linux-x86_64-2.5
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall 
-Wstrict-prototypes -fPIC -I/usr/pack/pyt
hon-2.5.2-sd/amd64-debian-linux4.0/lib/python2.5/site-packages/numpy/core/include/numpy 
-I/usr/pa
ck/python-2.5.2-sd/amd64-debian-linux4.0/include/python2.5 -c 
instant_module_5bc73bd961e29c451f59
fef5a2f1ebe9ff034456_wrap.cxx -o 
build/temp.linux-x86_64-2.5/instant_module_5bc73bd961e29c451f59f
ef5a2f1ebe9ff034456_wrap.o -O2
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for 
Ada/C/ObjC but not for C++
instant_module_5bc73bd961e29c451f59fef5a2f1ebe9ff034456_wrap.cxx: In 
function 'int SWIG_Python_Co
nvertFunctionPtr(PyObject*, void**, swig_type_info*)':
instant_module_5bc73bd961e29c451f59fef5a2f1ebe9ff034456_wrap.cxx:2051: 
error: invalid conversion
from 'const char*' to 'char*'
instant_module_5bc73bd961e29c451f59fef5a2f1ebe9ff034456_wrap.cxx: In 
function 'void SWIG_Python_F
ixMethods(PyMethodDef*, swig_const_info*, swig_type_info**, 
swig_type_info**)':
instant_module_5bc73bd961e29c451f59fef5a2f1ebe9ff034456_wrap.cxx:3207: 
error: invalid conversion
from 'const char*' to 'char*'
error: command 'gcc' failed with exit status 1

i suppose there is a problem with swig and gcc?
what i have used for my configuration is the following:

- ginac-1.4.4 (and cln, both compiled with gcc4.2.2)
- gcc-4.2.2
- python-2.5
- swig-1.3.29

and this i do on a amd64-debian-linux4.0 (etch).

could you tell me about a possible configuration which should work in 
your view?

thanks for your help and best regards
patrick

[email-masked] wrote:
>> Dear Kent
>>
>> Thanks a lot for you quick answer!
>>
>> Yes, i think the SyFi installation is then ok.
>> I checked the pkg-config ginac --cflas output and i get the
>> include dirs for GiNaC as:
>>
>> -I/home/priesen/num/ginac/include -I/home/priesen/num/cln/include
>>
>> which is correct. This is also what gets set for the variable
>> 'ginac_flags' in the python/setup.py command after running the configure
>> script. (see the attached and modified 'setup.py'-script.
>>
> 
> strange that this was not used during compiling
> 
>> i see, so i need to compile all (syfi, ffc, ufc and instant) with
>> python2.5? otherwise i need to use earlier packages of all those?
>>
>> best regards
>>
>> patrick
> 
> 
> It should not be hard to install this packages with python 2.5.
> I'm just curious, what when wrong with instant-0.9.4 and python 2.4 ?
> 
> Kent
> 
>

---

From: [email-masked]
Date: Tue, 2 Dec 2008 10:28:22 +0100 (CET)

> thanks for your help and best regards

Sorry for all your installation problems ...

Your problem seems to be a gcc <-> swig problem, as you say. I have seen
his problem
earlier but don't remember exactly which version that fixed this. However, it
is not a problem in swig 1.3.34 (which I am currently running).

Kent

---

From: Harish Narayanan <[email-masked]>
Date: Tue, 02 Dec 2008 11:59:08 +0100

> is not a problem in swig 1.3.34 (which I am currently running).

If you're still having trouble, you could try using Dorsal
(http://fenics.org/wiki/Dorsal), a build-script I wrote to sort out
these things. It ought to work for Debian Etch.

Harish

---

From: Patrick Riesen <[email-masked]>
Date: Mon, 08 Dec 2008 09:34:13 +0100

> is not a problem in swig 1.3.34 (which I am currently running).

yes, i got (or made our admin get) the new swig 1.3.36 and now it worked 
out fine. also, dolfin with petsc was built succesfull.
Thanks for your help :-)
patrick