Subject: Re: [Dorsal-dev] [DOLFIN-dev] Installing on OS X

From: Stig Larsson <[email-masked]>
Date: Sat, 21 Feb 2009 19:33:26 +0100

Thanks, Harish.   I found the solution in your hint no 1.  The  
solution is

Add 2 lines to ~/.profile
export LC_ALL=en_EN.UTF-8
export LANG=en_EN.UTF-8

(By this I learned that I should have googled 'ValueError: unknown  
locale: UTF-8' myself. )

Following instructions in leopard.platform I  have also done
# cd /usr/include
# sudo ln -s malloc/malloc.h malloc.h

Anyway:  now I have compiled all of Fenics.  Correctly, it seems.    
But when I run

python demo.py

in   Work/FEniCS/dolfin-0.9.0/demo/fem/simple/python I get

python(792) malloc: *** error for object 0xa04e36d8: Non-aligned  
pointer being freed
*** set a breakpoint in malloc_error_break to debug

which finally ends in Segmentation fault.   See the attached file for  
the complete listing.

I googled 'Non-aligned pointer being freed'  but did not understand  
what I found there.

After this I tried to do  'sudo scons install'  in folder  
dolfin-0.9.0  It made no difference, but it revealed a warning:

...
Checking for ufc-1... no (pkg-config file not found)
  Trying to generate pkg-config file for ufc-1... failed
Checking for umfpack... yes
Checking for mtl4... yes
...
Checking for libxml-2.0... yes
Resolving compiler... The Python site-packages directory for Trilinos  
is not
in your PYTHONPATH, consider adding
/Users/stig/Work/FEniCS/build/lib/python2.5/site-packages
to PYTHONPATH in your environment. You will probably need to adjust
LD_LIBRARY_PATH/DYLD_LIBRARY_PATH as well.

done
Warning: Unknown dependency package: ufc-1

( I do have a folder ufc-1.1 in Work/FEniCS/ )

Regards.   /stig

On Feb 18, 2009, at 14:18 , Harish Narayanan wrote:

> Stig Larsson wrote:
>> Dear Harish,  Thanks for your help.   I followed your advice (removed
>> the whole Fenics folder and ran dorsal again) and made some  
>> progress but
>> I am not there yet.  This time it stopped at ufl:
>>
>> copying ufc-1.pc -> /Users/stig/Work/FEniCS/build/lib/pkgconfig
>> running install_egg_info
>> Writing
>> /Users/stig/Work/FEniCS/build/lib/python2.5/site-packages/UFC-1.1- 
>> py2.5.egg-info
>>
>> Fetching ufl
>> Traceback (most recent call last):
>>  File "/sw/bin/hg", line 18, in <module>
>>    mercurial.util.set_binary(fp)
>>  File "/sw/lib/python2.5/site-packages/mercurial/demandimport.py",  
>> line
>> 74, in __getattribute__
>>    self._load()
>>  File "/sw/lib/python2.5/site-packages/mercurial/demandimport.py",  
>> line
>> 46, in _load
>>    mod = _origimport(head, globals, locals)
>>  File "/sw/lib/python2.5/site-packages/mercurial/util.py", line 33,  
>> in
>> <module>
>>    _encoding = locale.getlocale()[1]
>>  File "/sw/lib/python2.5/locale.py", line 462, in getlocale
>>    return _parse_localename(localename)
>>  File "/sw/lib/python2.5/locale.py", line 375, in _parse_localename
>>    raise ValueError, 'unknown locale: %s' % localename
>> ValueError: unknown locale: UTF-8
>> Failure with exit status: 1
>> Exit message: Error fetching ufl.
>
> 1. This looks very strange and I have not seen this error. The easiest
> thing to try appears to be this web page:
> http://tierseven.net/denizens/marc/blog/2008/03/12/mercurial-error-valueerror-unknown-locale-utf-8-on-macos-105/
>
> 2. (If the above fails,) Are you running a recent (1.0.2) version of
> mercurial via fink? If not, try 'fink selfupdate && fink update-all'  
> to
> upgrade your fink packages.
>
> Retry running ./dorsal (after removing the fenics folder) after 1  
> and/or
> 2 have been completed.
>
> Harish

---

From: Harish Narayanan <[email-masked]>
Date: Sat, 21 Feb 2009 19:43:10 +0100

Stig Larsson wrote:
> Thanks, Harish.   I found the solution in your hint no 1.  The solution is
> 

Good!

> Anyway:  now I have compiled all of Fenics.  Correctly, it seems.   But
> when I run
> 
> python demo.py
> 
> python(792) malloc: *** error for object 0xa04e36d8: Non-aligned pointer
> being freed

These are two separate things:

1. Use ipython (instead of python, after a 'fink install ipython') to
make this malloc error go away.

2. There appears to be some problem with MPI and Petsc (and Viper, I
think), and I know of one solution to make this go away. Add the
following to the python demo you wish to run:

dolfin_set("linear algebra backend", "uBLAS")

This will remove the MPI, Petsc errors and the resulting segfault.

> After this I tried to do  'sudo scons install'  in folder dolfin-0.9.0 
> It made no difference, but it revealed a warning:
> 
> ...
> Resolving compiler... The Python site-packages directory for Trilinos is
> not

You shouldn't (need to) do this. I've tried to construct things so that
you only write FEniCS files and their dependencies into a local folder
where you have write exist as a regular user. You shouldn't sudo anything.

Also, running things via dorsal sets up the appropriate paths before the
'scons install' so that error will not manifest itself. If you want to
do so manually 'source ~/Work/FEniCS/dolfin-0.9.0/dolfin.conf' then
retry the 'scons install'. (You don't need to.)

Harish

---

From: Harish Narayanan <[email-masked]>
Date: Sat, 21 Feb 2009 19:45:26 +0100

> where you have write exist as a regular user. You shouldn't sudo anything.

That's write *access*.

Harish

---

From: Stig Larsson <[email-masked]>
Date: Sun, 22 Feb 2009 13:09:34 +0100

Thanks again, Harish!    It worked.  So now I have successfully run a  
couple of demos and I can start learning how to use dolfin in my  
research.

But I wonder if there is something unusual (or wrong) in my system  
since I had to do these last changes.  I mean:  ipython  and  
'dolfin_set("linear algebra backend", "uBLAS")' are not mentioned in  
the installation instructions.  Are other (more experienced) OS X  
users running FEniCS without them?    I am just trying to learn and I  
want do things right.

Regards.  /stig

On Feb 21, 2009, at 19:43 , Harish Narayanan wrote:

>> But
>> pointer
>> dolfin-0.9.0

---

From: Harish Narayanan <[email-masked]>
Date: Sun, 22 Feb 2009 13:21:56 +0100

> users running FEniCS without them?    I am just trying to learn and I  

I don't think there are. I also don't know why ipython does one thing
and python does another when (as far as I know) they both call the same
python. I think there is a memory leak somewhere that one the pythons is
more strict about.

The MPI error I think is a bug in PyDOLFIN+PyTrilinos. It shows up
sometimes on other platforms as well, not just Mac OS X. A thread from
the past[1] suggests that compiling Trilinos without MPI support[2]
should remove the error.

[1] http://www.mail-archive.com/[email-masked]/msg03712.html
[2] i.e., Replacing '--enable-mpi --with-mpi-compilers' with
'--disable-mpi' in CONFOPTS in dorsal/packages/trilinos.package

Harish

---

From: Harish Narayanan <[email-masked]>
Date: Sun, 22 Feb 2009 15:05:10 +0100

> the past[1] suggests that compiling Trilinos without MPI support[2]

For now, disabling the build of trilinos (comment out trilinos in the
list of packages in dorsal/platforms/leopard.platform solves both these
problems. You can then use either ipython or python, and don't need to
use dolfin_set to use uBLAS.

I will fix trilinos support later (but soon, as I need it for something
I am working on right now).

Harish