Problems compiling shared libraries [message #47750] |
Thu, 02 March 2006 07:55  |
johnpeterkelly@gmail.
Messages: 6 Registered: March 2006
|
Junior Member |
|
|
I'm having a consistent problem compiling shared libraries for use with
the call_external() command. I've tried using the make_dll function as
well as compiling the code manually with cc or gcc. Here's what I do:
in idl:
make_dll, 'tester', 'simple_return'
Where tester.c is the name of my file, and simple_return is the name of
a function that just returns a number.
or at the command prompt:
cc -c -fPIC tester.c
cc -shared tester.o -o tester.so
When I try in IDL:
x = call_external('tester.so', 'simple_return')
I get:
% CALL_EXTERNAL: Error loading sharable executable.
Symbol: simple_return, File = tester.so
tester.so: cannot open shared object file: No such
file or directory
It would seem IDL can't find the .so file. What really confuses me is
that I have another library file that I downloaded to run some LAPACK
routines on older version of IDL (note: not compiled on my computer)
which is sitting the same directory as tester.so. When I run:
x = call_external('liblidl.so', 'c_eigen_all', matrix, 3l, e_vec,e_val)
It works fine. This leads me to the conclusion that it's not that it
can't find the file, but rather it doesn't recognize it as a library.
If it helps, I'm running IDL 6.2 and my machine has a 64 bit processor
(this has led to some completely different problems, but it might be
relevant).
Thanks in advance for your help.
--John
|
|
|
Re: Problems compiling shared libraries [message #47837 is a reply to message #47750] |
Fri, 03 March 2006 04:27  |
Nigel Wade
Messages: 286 Registered: March 1998
|
Senior Member |
|
|
johnpeterkelly wrote:
> Okay, I figured out something that will work. I simply added "-m32" to
> my compile commands. I think this switches the compiler to 32-bit mode
> and then the libraries become readable by IDL. I imagine I can fix the
> make_dll program by using -m32 as one of the compiler commands.
The default for IDL 6.2 on 64bit platforms (at least for Linux AMD64 and IRIX)
is to run the 64bit version of IDL.
What processor/OS/architecture are you running?
--
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : nmw@ion.le.ac.uk
Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555
|
|
|
Re: Problems compiling shared libraries [message #47841 is a reply to message #47750] |
Thu, 02 March 2006 10:57  |
johnpeterkelly@gmail.
Messages: 6 Registered: March 2006
|
Junior Member |
|
|
Okay, I figured out something that will work. I simply added "-m32" to
my compile commands. I think this switches the compiler to 32-bit mode
and then the libraries become readable by IDL. I imagine I can fix the
make_dll program by using -m32 as one of the compiler commands.
|
|
|