Hello all! I've been using Cython now for a couple years and it has been a great help. I recently, however, ran into a bit of a snag when I tried compiling some bindings I had used in the past on a new server. It works fine on my home laptop and on our cluster, just not this partilcular server, which leads me to believe something is missing or configured incorrectly.
The error I get is "/usr/bin/ld: cannot find -lRNA" . In the setup_pyfold.py file, the ext_module line is:
Now, I had thought that the libraries option didn't really matter unless you were linking to a system library (obviously I was wrong), but having "libraries=['RNA']" in that bit of code has never mattered before.
Any thoughts as to what might be going on?
Cheers,
Thomas
Here is the full output when I try compiling the cython module.
[2003] lja485@Anu $ python setup_pyfold.py build_ext -i
running build_ext
cythoning pyfold.pyx to pyfold.c
building 'pyfold' extension
creating build
creating build/temp.linux-x86_64-2.7
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall
-Wstrict-prototypes -fPIC -I/home/lja485/ViennaRNA-1.8.
5/H
-I/usr/lib/pymodules/python2.7/numpy/core/include
-I/usr/include/python2.7 -c pyfold.c -o
build/temp.linux-x86_64-2.7/pyfold.o
/usr/lib/pymodules/python2.7/numpy/core/include/numpy/__multiarray_api.h:11 87:
warning: ‘_import_array’ defined but not used
/usr/lib/pymodules/python2.7/numpy/core/include/numpy/__ufunc_api.h:196:
warning: ‘_import_umath’ defined but not used
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions
-Wl,-Bsymbolic-functions build/temp.linux-x86_64-2.7/pyfold.o
-L/home/lja485/ViennaRNA-1.8.5/lib -lRNA -o /home/lja485/dir/pyfold.so
/usr/bin/ld: cannot find -lRNA
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
<thomas.e.kel...@gmail.com> wrote:
> Hello all! I've been using Cython now for a couple years and it has been a
> great help. I recently, however, ran into a bit of a snag when I tried
> compiling some bindings I had used in the past on a new server. It works
> fine on my home laptop and on our cluster, just not this partilcular server,
> which leads me to believe something is missing or configured incorrectly.
> The error I get is "/usr/bin/ld: cannot find -lRNA" . In the setup_pyfold.py
> file, the ext_module line is:
> Now, I had thought that the libraries option didn't really matter unless you
> were linking to a system library (obviously I was wrong), but having
> "libraries=['RNA']" in that bit of code has never mattered before.
> Any thoughts as to what might be going on?
> Cheers,
> Thomas
> Here is the full output when I try compiling the cython module.
> [2003] lja485@Anu $ python setup_pyfold.py build_ext -i
> running build_ext
> cythoning pyfold.pyx to pyfold.c
> building 'pyfold' extension
> creating build
> creating build/temp.linux-x86_64-2.7
> gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall
> -Wstrict-prototypes -fPIC -I/home/lja485/ViennaRNA-1.8.
> 5/H
> -I/usr/lib/pymodules/python2.7/numpy/core/include
> -I/usr/include/python2.7 -c pyfold.c -o
> build/temp.linux-x86_64-2.7/pyfold.o
> /usr/lib/pymodules/python2.7/numpy/core/include/numpy/__multiarray_api.h:11 87:
> warning: ‘_import_array’ defined but not used
> /usr/lib/pymodules/python2.7/numpy/core/include/numpy/__ufunc_api.h:196:
> warning: ‘_import_umath’ defined but not used
> gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions
> -Wl,-Bsymbolic-functions build/temp.linux-x86_64-2.7/pyfold.o
> -L/home/lja485/ViennaRNA-1.8.5/lib -lRNA -o /home/lja485/dir/pyfold.so
> /usr/bin/ld: cannot find -lRNA
> collect2: ld returned 1 exit status
> error: command 'gcc' failed with exit status 1
It can't find your library. What is the contents of
/home/thomas/ViennaRNA-1.7/lib? Are you sure your library is in there
and named appropriately and the right architecture?
Ah, I think I see what the problem is. So I should be using the libraries option to specify the exact libraries that the .pyx files uses, correct? For instance, it uses functions/etc from the stdlib, libRNA_a-fold, libRNA_a-cofold, libRNA_a-fold_vars, libRNA_a-part_func, and libRNA_a-inverse libraries. Thus, the libraries option should be "libraries=['stdlib','libRNA_a-fold',..etc]", correct?
I still have no idea why it worked fine on the other computers, as there's not even a library called RNA in that directory. Anyway, thanks!
On Saturday, June 16, 2012 1:14:30 PM UTC-5, Robert Bradshaw wrote:
> On Fri, Jun 15, 2012 at 10:54 AM, Thomas Keller > <thomas.e.kel...@gmail.com> wrote: > > Hello all! I've been using Cython now for a couple years and it has been > a > > great help. I recently, however, ran into a bit of a snag when I tried ,
> > compiling some bindings I had used in the past on a new server. It works > > fine on my home laptop and on our cluster, just not this partilcular > server, > > which leads me to believe something is missing or configured > incorrectly.
> > The error I get is "/usr/bin/ld: cannot find -lRNA" . In the > setup_pyfold.py > > file, the ext_module line is:
> > Now, I had thought that the libraries option didn't really matter unless > you > > were linking to a system library (obviously I was wrong), but having > > "libraries=['RNA']" in that bit of code has never mattered before.
> > Any thoughts as to what might be going on?
> > Cheers, > > Thomas
> > Here is the full output when I try compiling the cython module.
> > warning: ‘_import_array’ defined but not used > > /usr/lib/pymodules/python2.7/numpy/core/include/numpy/__ufunc_api.h:196: > > warning: ‘_import_umath’ defined but not used > > gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions > > -Wl,-Bsymbolic-functions build/temp.linux-x86_64-2.7/pyfold.o > > -L/home/lja485/ViennaRNA-1.8.5/lib -lRNA -o /home/lja485/dir/pyfold.so > > /usr/bin/ld: cannot find -lRNA > > collect2: ld returned 1 exit status > > error: command 'gcc' failed with exit status 1
> It can't find your library. What is the contents of > /home/thomas/ViennaRNA-1.7/lib? Are you sure your library is in there > and named appropriately and the right architecture?
> On Saturday, June 16, 2012 1:14:30 PM UTC-5, Robert Bradshaw wrote:
>> On Fri, Jun 15, 2012 at 10:54 AM, Thomas Keller wrote: >>> Hello all! I've been using Cython now for a couple years and it has been >>> a great help. I recently, however, ran into a bit of a snag when I tried,
>>> compiling some bindings I had used in the past on a new server. It works >>> fine on my home laptop and on our cluster, just not this partilcular >>> server, which leads me to believe something is missing or configured >>> incorrectly.
>>> The error I get is "/usr/bin/ld: cannot find -lRNA" . In the >>> setup_pyfold.py file, the ext_module line is:
>>> Now, I had thought that the libraries option didn't really matter unless >>> you were linking to a system library (obviously I was wrong), but having >>> "libraries=['RNA']" in that bit of code has never mattered before.
>>> Any thoughts as to what might be going on?
>> It can't find your library. What is the contents of >> /home/thomas/ViennaRNA-1.7/lib? Are you sure your library is in there >> and named appropriately and the right architecture?
> Ah, I think I see what the problem is. So I should be using the libraries > option to specify the exact libraries that the .pyx files uses, correct?
Yes.
> For instance, it uses functions/etc from the stdlib, libRNA_a-fold, > libRNA_a-cofold, libRNA_a-fold_vars, libRNA_a-part_func, and > libRNA_a-inverse libraries. Thus, the libraries option should be > "libraries=['stdlib','libRNA_a-fold',..etc]", correct?
No. The C compiler knows the "lib" prefix. It also knows that stdlib is in
libc, no need to link against that. But it won't magically know about the
"part_func" etc. bits.
Also, the "_a" bit looks like a static library, but maybe I'm mistaken.
> I still have no idea why it worked fine on the other computers, as there's > not even a library called RNA in that directory. Anyway, thanks!
Maybe it found it somewhere else? Finding that out will likely help you in
understanding what goes wrong on the failing side.