pythonflu210 and SWIG2.0

Help
2012-05-23
2012-12-21
  • Hon Fai Choi
    Hon Fai Choi
    2012-05-23

    Hi,

    will pythonflu210 be ported to swig 2.0 anytime soon? I have installed pythonflu210 on an ubuntu oneiric (11.10) system, but now I can't install other packages (such as Fenics, http://fenicsproject.org/) which depend on swig 2.0 without having to remove swig1.3 and pythonflu210. Does anyone know how to install both swig versions next to each other on ubuntu 11.10?

    thanks,
    Hon Fai Choi

     
  • Alexey Petrov
    Alexey Petrov
    2012-05-24

    Hi Hon Fai,

    On account of the pythonFlu dependency from the SWIG product - it is not a run-time dependency. We were a little bit lazy to define separate packages - run-time and development ones. So, if you are not going to compile something on top pythonFlu wrapping, but use its Python API only  - you can ignore this dependency from the SWIG.

    We have checked for a possible solution - "removing some package dependencies, without removing the target package" and found out that it is rather problematic. So, as a temporal solution we could suggest you to compile pythonFlu from sources by using locally installed swig (all the necessary instructions can be found at corresponding INSTALL file).

    Best regards,
    Alexey

     
  • Hon Fai Choi
    Hon Fai Choi
    2012-05-24

    Hi Alexey,

    thanks for the info. I tried compiling against SWIG 2.0 (using the pythonflu library from github), but that failed. Here is an excerpt from the make output:

    g++ -m32 -Dlinux -DWM_DP -Wno-unused-parameter -O3 -DNoRepository -ftemplate-depth-100 -fPIC  -I/opt/managedflu210-1.0-1/src/OpenFOAM/lnInclude  -I/opt/openfoam210/src/OpenFOAM/lnInclude -I/opt/openfoam210/src -I/opt/openfoam210/src/OSspecific/POSIX/lnInclude -D__FOAM_VERSION__=020100   -I/usr/include/python2.7  -I/opt/managedflu210-1.0-1/src -I/opt/managedflu210-1.0-1/src/managedFlu/lnInclude -I/home/user/software_builds/pythonFlu210-git-23May2012 -I/usr/include -I/usr/include/c++  -ftemplate-depth-40 "-D DIRECTOR_INCLUDE=</home/user/software_builds/pythonFlu210-git-23May2012/Foam/src/OpenFOAM/fields/Fields/primitiveFields.h>" -c /home/user/software_builds/pythonFlu210-git-23May2012/Foam/src/OpenFOAM/fields/Fields/primitiveFields.cc -o /home/user/software_builds/pythonFlu210-git-23May2012/Foam/src/OpenFOAM/fields/Fields/primitiveFields.o
    /home/user/software_builds/pythonFlu210-git-23May2012/Foam/src/OpenFOAM/fields/Fields/primitiveFields.cc: In function ‘PyObject* _wrap_tmp_scalarField___len__(PyObject*, PyObject*)’:
    /home/user/software_builds/pythonFlu210-git-23May2012/Foam/src/OpenFOAM/fields/Fields/primitiveFields.cc:26355:106: error: ‘Foam_UList_Sl_Foam_scalar_Sg____len__’ was not declared in this scope
    /home/user/software_builds/pythonFlu210-git-23May2012/Foam/src/OpenFOAM/fields/Fields/primitiveFields.cc: In function ‘PyObject* _wrap_tmp_scalarField___iter__(PyObject*, PyObject*)’:

    I am not sure what the problem is, but after going through some forums, I think that swig 2.0 has some issues with nested templates.

    As an alternative, I downloaded the source of swig 1.3 and compiled and installed it manually. I then compiled pythonflu210 against swig1.3, which went ok. I haven't tested it fully yet, but I could import some classes from Foam, so it seems to work.

    Do you have any suggestions regarding this error with swig 2.0? Maybe I did something wrong (again) :-) …

    many thanks,
    Hon Fai

     
  • Alexey Petrov
    Alexey Petrov
    2012-05-24

    Hi Hon Fai,

    Ye, we know about the pythonFlu incompatibility with SWIG 2.x. More over, we know the reason and the way to fix these limitation. But, unfortunately,  we have no budget to do it for now. So, you were completely right when stated to compile pythonFlu using an older version of SWIG - 1.3.X.

    I am sure there will be no problems to interact with other libraries that were built with SWIG 2.X. As I said, SWIG is used at the code generation time. Once we have the binary results of the swigging procedure, there is no dependencies from SWIG.

    Enjoy,
    Alexey