Snow Leopard demos fail with Swig 2.0.4

Bug #799513 reported by Garth Wells
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
DOLFIN
Won't Fix
High
Johan Hake

Bug Description

I'm on Snow Leopard, and build FEniCS with dorsal-0.8.2. Dependencies installed with macports, on a fresh OS X install.

Everything I run results in the error below. Other people who have had this problem seemed to resolved it by running instant-clean, which appears to run successfully, but I still get the same error.

rob@cosmo python $ python demo.py
Calling FFC just-in-time (JIT) compiler, this may take some time.
Traceback (most recent call last):
  File "demo.py", line 22, in <module>
    V = VectorFunctionSpace(mesh, "CG", 2)
  File "/Users/rob/Development/FEniCS/lib/python2.7/site-packages/dolfin/function/functionspace.py", line 321, in __init__
    restriction=restriction)]
  File "/Users/rob/Development/FEniCS/lib/python2.7/site-packages/dolfin/function/functionspace.py", line 237, in __init__
    FunctionSpaceBase.__init__(self, mesh, element)
  File "/Users/rob/Development/FEniCS/lib/python2.7/site-packages/dolfin/function/functionspace.py", line 47, in __init__
    self._dolfin_element = cpp.FiniteElement(ufc_element)
  File "/Users/rob/Development/FEniCS/lib/python2.7/site-packages/dolfin/cpp.py", line 14561, in __init__
    _cpp.FiniteElement_swiginit(self,_cpp.new_FiniteElement(*args))
TypeError: in method 'new_FiniteElement', argument 1 of type 'boost::shared_ptr< ufc::finite_element const >'

Any advice is much appreciated!

Revision history for this message
Garth Wells (garth-wells) wrote :
Changed in dolfin:
milestone: none → 0.9.12
Revision history for this message
Johannes Ring (johannr) wrote :

I updated the MacPort packages on the Mac buildbot and I got the same error with SWIG 2.0.4:

http://fenicsproject.org:8080/builders/dolfin-mac-osx/builds/1537/steps/dolfin%20check/logs/stdio

Changed in dolfin:
status: New → Confirmed
Revision history for this message
Johan Hake (johan-hake) wrote :

SWIG 2.0.X works on a 64bit linux computeter.

The svn version (2.0.5) does not...

A lot of random havoc is generated.

Revision history for this message
Anders Logg (logg) wrote :

Mac users should revert to SWIG 2.0.3 for now. Let's hope this clears up with a new SWIG release.

Changed in dolfin:
milestone: 1.0-beta → 1.0-rc1
Changed in dolfin:
importance: Undecided → High
Revision history for this message
Garth Wells (garth-wells) wrote :

Could someone with OSX look at this again? It could just be a case of a missing

    %include "boost_shared_ptr.i"

or something.

Revision history for this message
Johannes Ring (johannr) wrote :

I'm still getting the same error with the latest dolfin-dev and it seems that boost_shared_ptr.i is already included in dolfin/swig/shared_ptr_classes.i. Any idea what I should do?

Revision history for this message
Johan Hake (johan-hake) wrote : Re: [Bug 799513] Re: Snow Leopard demos fail with Swig 2.0.4

Have you tried the development version of SWIG?

Johan

On Sep 13, 2011, at 4:14, Johannes Ring <email address hidden> wrote:

> I'm still getting the same error with the latest dolfin-dev and it seems
> that boost_shared_ptr.i is already included in
> dolfin/swig/shared_ptr_classes.i. Any idea what I should do?
>
> --
> You received this bug notification because you are a member of DOLFIN
> Core Team, which is subscribed to DOLFIN.
> https://bugs.launchpad.net/bugs/799513
>
> Title:
> Snow Leopard demos fail with Swig 2.0.4
>
> Status in DOLFIN:
> Confirmed
>
> Bug description:
> I'm on Snow Leopard, and build FEniCS with dorsal-0.8.2. Dependencies
> installed with macports, on a fresh OS X install.
>
> Everything I run results in the error below. Other people who have had
> this problem seemed to resolved it by running instant-clean, which
> appears to run successfully, but I still get the same error.
>
> rob@cosmo python $ python demo.py
> Calling FFC just-in-time (JIT) compiler, this may take some time.
> Traceback (most recent call last):
> File "demo.py", line 22, in <module>
> V = VectorFunctionSpace(mesh, "CG", 2)
> File "/Users/rob/Development/FEniCS/lib/python2.7/site-packages/dolfin/function/functionspace.py", line 321, in __init__
> restriction=restriction)]
> File "/Users/rob/Development/FEniCS/lib/python2.7/site-packages/dolfin/function/functionspace.py", line 237, in __init__
> FunctionSpaceBase.__init__(self, mesh, element)
> File "/Users/rob/Development/FEniCS/lib/python2.7/site-packages/dolfin/function/functionspace.py", line 47, in __init__
> self._dolfin_element = cpp.FiniteElement(ufc_element)
> File "/Users/rob/Development/FEniCS/lib/python2.7/site-packages/dolfin/cpp.py", line 14561, in __init__
> _cpp.FiniteElement_swiginit(self,_cpp.new_FiniteElement(*args))
> TypeError: in method 'new_FiniteElement', argument 1 of type 'boost::shared_ptr< ufc::finite_element const >'
>
>
> Any advice is much appreciated!
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/dolfin/+bug/799513/+subscriptions

Revision history for this message
Johannes Ring (johannr) wrote :

I get the same error with the development version of SWIG.

Revision history for this message
Johan Hake (johan-hake) wrote :

On Wednesday September 14 2011 01:06:53 Johannes Ring wrote:
> I get the same error with the development version of SWIG.

Could you add these print statements:

=== modified file 'site-packages/dolfin/functions/functionspace.py'
--- site-packages/dolfin/functions/functionspace.py 2011-09-09 13:48:18
+0000
+++ site-packages/dolfin/functions/functionspace.py 2011-09-14 15:54:08
+0000
@@ -72,6 +72,11 @@
         ufc_element, ufc_dofmap = jit(self._ufl_element)

         # Instantiate DOLFIN FiniteElement and DofMap
+ print ufc_element
+ print
+ print ufc_element.__class__
+ print
+ print ufc_element.__class__.__bases__
         self._dolfin_element = cpp.FiniteElement(ufc_element)
         dolfin_dofmap = cpp.DofMap(ufc_dofmap, mesh)

And run demo_poisson.py and report the output?

I get:

<e53cbae4a6d3a1b3b1083d8ac6088d0a4418b916.e53cbae4a6d3a1b3b1083d8ac6088d0a4418b916.ffc_form_e53cbae4a6d3a1b3b1083d8ac6088d0a4418b916_finite_element_0;
proxy of <Swig Object of type 'boost::shared_ptr<
ffc_form_e53cbae4a6d3a1b3b1083d8ac6088d0a4418b916_finite_element_0 > *' at
0x347c3c0> >

<class
'e53cbae4a6d3a1b3b1083d8ac6088d0a4418b916.e53cbae4a6d3a1b3b1083d8ac6088d0a4418b916.ffc_form_e53cbae4a6d3a1b3b1083d8ac6088d0a4418b916_finite_element_0'>

(<class 'ufc.ufc.finite_element'>,)

Which indidacates it is a shared_ptr version of a ufc::finite_element.

Hopefully you get something different...

Johan

Revision history for this message
Johannes Ring (johannr) wrote :

Here is the output:

<instant_module_c5abadc746a65d4a016ef8e442ca649fe8cef6db.ffc_form_1d168de18d6ae1d669b93b0ea352a559808fcd3c_finite_element_0; proxy of <Swig Object of type 'boost::shared_ptr< ffc_form_1d168de18d6ae1d669b93b0ea352a559808fcd3c_finite_element_0 > *' at 0x104465510> >

<class 'instant_module_c5abadc746a65d4a016ef8e442ca649fe8cef6db.ffc_form_1d168de18d6ae1d669b93b0ea352a559808fcd3c_finite_element_0'>

(<class 'ufc.ufc.finite_element'>,)

Looks pretty similar to me.

Revision history for this message
Johan Hake (johan-hake) wrote :

On Wednesday September 14 2011 10:04:54 Johannes Ring wrote:
> Here is the output:
>
> <instant_module_c5abadc746a65d4a016ef8e442ca649fe8cef6db.ffc_form_1d168de18
> d6ae1d669b93b0ea352a559808fcd3c_finite_element_0; proxy of <Swig Object of
> type 'boost::shared_ptr<
> ffc_form_1d168de18d6ae1d669b93b0ea352a559808fcd3c_finite_element_0 > *'
> at 0x104465510> >
>
> <class
> 'instant_module_c5abadc746a65d4a016ef8e442ca649fe8cef6db.ffc_form_1d168de18
> d6ae1d669b93b0ea352a559808fcd3c_finite_element_0'>
>
> (<class 'ufc.ufc.finite_element'>,)
>
> Looks pretty similar to me.

Too bad.

Then we need to go into the generated SWIG code! How does the code for
_wrap_new_FiniteElement look like. Can you dump that for both SWIG versions?
Or if you can ship me a macbook with FEniCS pre installed, so I can do it
myself?

Johan

Revision history for this message
Johannes Ring (johannr) wrote :

Here is the code for _wrap_new_FiniteElement when using the development version of SWIG:

  http://paste.ubuntu.com/689751/

If you want, I can give you access to the Mac buildbot. I'll give you the details in private.

Revision history for this message
Johan Hake (johan-hake) wrote :

On Wednesday September 14 2011 23:52:31 Johannes Ring wrote:
> Here is the code for _wrap_new_FiniteElement when using the development
> version of SWIG:
>
> http://paste.ubuntu.com/689751/
>
> If you want, I can give you access to the Mac buildbot. I'll give you
> the details in private.

There are no differences in the generated code for that function in SWIG 2.0.3
and SWIG 2.0.4. But I see some differences in the function which is called
from within _wrap_new_FiniteElement. I can see if changing back the code for
that particular function helps...

Johan

Revision history for this message
Anders Logg (logg) wrote :

Any progress on this issue? Things seem to be working fine wrt SWIG on the Mac buildbot.

Changed in dolfin:
assignee: nobody → Johan Hake (johan-hake)
Revision history for this message
Garth Wells (garth-wells) wrote :

On 17 November 2011 14:31, Anders Logg <email address hidden> wrote:
> Any progress on this issue? Things seem to be working fine wrt SWIG on
> the Mac buildbot.
>

I recall that SWIG on the buildbot downgraded to avoid this bug.

Garth

> ** Changed in: dolfin
>     Assignee: (unassigned) => Johan Hake (johan-hake)
>
> --
> You received this bug notification because you are a member of DOLFIN
> Core Team, which is subscribed to DOLFIN.
> https://bugs.launchpad.net/bugs/799513
>
> Title:
>  Snow Leopard demos fail with Swig 2.0.4
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/dolfin/+bug/799513/+subscriptions
>

Revision history for this message
Johannes Ring (johannr) wrote :

Yes, it is SWIG 2.0.3 on the Mac buildbot.

Revision history for this message
Anders Logg (logg) wrote :

On Thu, Nov 17, 2011 at 04:25:33PM -0000, Johannes Ring wrote:
> Yes, it is SWIG 2.0.3 on the Mac buildbot.

Since we handle this issue both in Dorsal (which installs 2.0.3
manually and does not use the package from MacPorts) and in the binary
packages (which I assume Johannes builds with SWIG 2.0.3), I don't
consider this a bug that needs to be fixed for 1.0.0.

So I will unmark this bug for 1.0.x and we can just hope the issue
resolves itself with new versions of SWIG coming out.

--
Anders

Changed in dolfin:
milestone: 1.0-rc1 → trunk
Revision history for this message
Johan Hake (johan-hake) wrote :

On Thursday November 17 2011 09:07:03 Anders Logg wrote:
> On Thu, Nov 17, 2011 at 04:25:33PM -0000, Johannes Ring wrote:
> > Yes, it is SWIG 2.0.3 on the Mac buildbot.
>
> Since we handle this issue both in Dorsal (which installs 2.0.3
> manually and does not use the package from MacPorts) and in the binary
> packages (which I assume Johannes builds with SWIG 2.0.3), I don't
> consider this a bug that needs to be fixed for 1.0.0.
>
> So I will unmark this bug for 1.0.x and we can just hope the issue
> resolves itself with new versions of SWIG coming out.

I have not been able to file an upstream bug report on this one, as I need a
Mac to do that. Might be able to look into it when I return to Simula, where
Macs with FEniCS are more common than in San Diego...

Johan

>
> --
> Anders
>
>
> ** Changed in: dolfin
> Milestone: 1.0-rc1 => trunk

Revision history for this message
Anders Logg (logg) wrote :

On Thu, Nov 17, 2011 at 06:38:33PM -0000, Johan Hake wrote:
> On Thursday November 17 2011 09:07:03 Anders Logg wrote:
> > On Thu, Nov 17, 2011 at 04:25:33PM -0000, Johannes Ring wrote:
> > > Yes, it is SWIG 2.0.3 on the Mac buildbot.
> >
> > Since we handle this issue both in Dorsal (which installs 2.0.3
> > manually and does not use the package from MacPorts) and in the binary
> > packages (which I assume Johannes builds with SWIG 2.0.3), I don't
> > consider this a bug that needs to be fixed for 1.0.0.
> >
> > So I will unmark this bug for 1.0.x and we can just hope the issue
> > resolves itself with new versions of SWIG coming out.
>
> I have not been able to file an upstream bug report on this one, as I need a
> Mac to do that. Might be able to look into it when I return to Simula, where
> Macs with FEniCS are more common than in San Diego...

If you ask Johannes, he can let you login to the Mac buildbot. I did
that earlier today to debug the Dirichlet BC issue.

--
Anders

Revision history for this message
Johan Hake (johan-hake) wrote :

On Thursday November 17 2011 10:48:44 Anders Logg wrote:
> On Thu, Nov 17, 2011 at 06:38:33PM -0000, Johan Hake wrote:
> > On Thursday November 17 2011 09:07:03 Anders Logg wrote:
> > > On Thu, Nov 17, 2011 at 04:25:33PM -0000, Johannes Ring wrote:
> > > > Yes, it is SWIG 2.0.3 on the Mac buildbot.
> > >
> > > Since we handle this issue both in Dorsal (which installs 2.0.3
> > > manually and does not use the package from MacPorts) and in the binary
> > > packages (which I assume Johannes builds with SWIG 2.0.3), I don't
> > > consider this a bug that needs to be fixed for 1.0.0.
> > >
> > > So I will unmark this bug for 1.0.x and we can just hope the issue
> > > resolves itself with new versions of SWIG coming out.
> >
> > I have not been able to file an upstream bug report on this one, as I
> > need a Mac to do that. Might be able to look into it when I return to
> > Simula, where Macs with FEniCS are more common than in San Diego...
>
> If you ask Johannes, he can let you login to the Mac buildbot. I did
> that earlier today to debug the Dirichlet BC issue.

I have done that. Cannot remember exactly what did not work when I did it.

Johan

> --
> Anders

Revision history for this message
Johan Hake (johan-hake) wrote :

Swig 2.0.5 is out now. Should try that.

Revision history for this message
Johannes Ring (johannr) wrote :

SWIG 2.0.5 works for me on OS X Lion. I will try on Snow Leopard now.

Revision history for this message
Johannes Ring (johannr) wrote :

The problem is still there on Snow Leopard with SWIG 2.0.5.

Revision history for this message
Garth Wells (garth-wells) wrote :

Could someone try SWIG 2.0.6.? From the SWIG 2.0.6 ChangeLog, which might help:

2012-04-28: wsfulton
            [Python] Fix compilation errors when wrapping STL containers on Mac OSX and possibly other systems.

Revision history for this message
Johannes Ring (johannr) wrote :

I get the same error with SWIG 2.0.6:

johannr@buildbotmac:python$ python demo_poisson.py
DOLFIN_NOPLOT set, plotting disabled.
Calling FFC just-in-time (JIT) compiler, this may take some time.
<beb23b112d19455912a74d0b3512b2576a219e63.ffc_form_beb23b112d19455912a74d0b3512b2576a219e63_finite_element_0; proxy of <Swig Object of type 'boost::shared_ptr< ffc_form_beb23b112d19455912a74d0b3512b2576a219e63_finite_element_0 > *' at 0x108ee7ab0> >

<class 'beb23b112d19455912a74d0b3512b2576a219e63.ffc_form_beb23b112d19455912a74d0b3512b2576a219e63_finite_element_0'>

(<class 'ufc.ufc.finite_element'>,)
Traceback (most recent call last):
  File "demo_poisson.py", line 41, in <module>
    V = FunctionSpace(mesh, "Lagrange", 1)
  File "/Users/johannr/tmp/dorsal/Work/FEniCS/lib/python2.7/site-packages/dolfin/functions/functionspace.py", line 386, in __init__
    FunctionSpaceBase.__init__(self, mesh, element)
  File "/Users/johannr/tmp/dorsal/Work/FEniCS/lib/python2.7/site-packages/dolfin/functions/functionspace.py", line 86, in __init__
    self._dolfin_element = cpp.FiniteElement(ufc_element)
  File "/Users/johannr/tmp/dorsal/Work/FEniCS/lib/python2.7/site-packages/dolfin/cpp/fem.py", line 973, in __init__
    _fem.FiniteElement_swiginit(self,_fem.new_FiniteElement(*args))
TypeError: in method 'new_FiniteElement', argument 1 of type 'boost::shared_ptr< ufc::finite_element const >'

Revision history for this message
Johan Hake (johan-hake) wrote :

Is JIT using the same C++ compiler that dolfin was compiled with? It should be possible to tell distutils to use a particular C++ compiler by setting CXX

Revision history for this message
Johannes Ring (johannr) wrote :

I tried to set CC and CXX and rebuild everything but got the same error.

Revision history for this message
Garth Wells (garth-wells) wrote :

I've just seen this with Swig 2.0.8 on Snow Leopard, but it appears to work fine with Mountain Lion (with Swig from Macports in both cases).

Revision history for this message
Garth Wells (garth-wells) wrote :

Replace 'Snow Leopard' with 'Lion above.

Revision history for this message
Garth Wells (garth-wells) wrote :

Works with recent OSX, Xcode and SWIG, so I'm going to mark this as 'won't fix''

Changed in dolfin:
status: Confirmed → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.