[Numpy-discussion] building numpy with atlas on ubuntu edgy

Robert Kern robert.kern at gmail.com
Wed Apr 18 23:25:58 EDT 2007


David Cournapeau wrote:
> Robert Kern wrote:
>> Charles R Harris wrote:
>>> I'm wondering if the static libraries could simply be compiled with the
>>> -fPIC flag and linked with the program to produce the dynamic library.
>>> The static libraries are just collections of *.o files, so I don't see
>>> why that shouldn't work.
>> I don't think there is a reason why it *wouldn't* work; it's just that one needs
>> to do "gcc -shared" to make a .so and that flag also tells the linker to choose
>> .so's over .a's for the libraries that get linked into the target .so.
>>
> Ok, I found it much faster than I expected: you should use the option 
> -Bdynamic of the *linker*, that is, for example:
> 
> gcc -shared -o c_gaussd.mexglx c_gaussd.o mex_alloc.o 
> -L/usr/local/matlab/bin/glnx86  -L/usr/media/boulot/local/lib 
> -L/usr/lib/atlas -Wl,-Bstatic,-lem_full -llapack_atlas -latlas 
> -Wl,-Bdynamic,-lmx -lmex
> 
> will build a shared "library" c_gaussd.mexglx from c_gaussd.o and 
> mex_alloc.o, statically link libem_full, lapack_atlas and atlas, and 
> dynamically everything else. This was working, as otherwise, matlab 
> would have picked up atlas symbols from its existing, already linked own 
> atlas, and not from the atlas installed on my system (which was crashing 
> matlab and was the reason why I went through this pain in the first place).

Thank you! That's good information to know.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco



More information about the NumPy-Discussion mailing list