s-will / LocARNA

Alignment of RNAs
https://s-will.github.io/LocARNA
GNU General Public License v3.0
24 stars 4 forks source link

Undefined references to ViennaRNA symbols #7

Closed rekado closed 8 years ago

rekado commented 8 years ago

I'm trying to package LocARNA for Guix but it seems that the libraries are not linked properly. I'm getting errors like this:

./.libs/libLocARNA-1.5.a(rna_ensemble.o): In function `LocARNA::RnaEnsembleImpl::ptype_of_admissible_basepair(unsigned long, unsigned long) const':
/tmp/guix-build-locarna-1.8.10.drv-0/LocARNA-1.8.10/src/LocARNA/rna_ensemble.cc:592: undefined reference to `no_closingGU'
./.libs/libLocARNA-1.5.a(rna_ensemble.o): In function `LocARNA::RnaEnsembleImpl::unpaired_in_loop_prob_ali(unsigned long, unsigned long, unsigned long) const':
/tmp/guix-build-locarna-1.8.10.drv-0/LocARNA-1.8.10/src/LocARNA/rna_ensemble.cc:745: undefined reference to `no_closingGU'
/tmp/guix-build-locarna-1.8.10.drv-0/LocARNA-1.8.10/src/LocARNA/rna_ensemble.cc:767: undefined reference to `no_closingGU'
./.libs/libLocARNA-1.5.a(rna_ensemble.o): In function `LocARNA::RnaEnsembleImpl::unpaired_in_loop_prob_noali(unsigned long, unsigned long, unsigned long) const':
/gnu/store/39yi0d07qcfhv312lv7bkc60wl5pzpyb-viennarna-2.2.8/include/ViennaRNA/interior_loops.h:361: undefined reference to `no_closingGU'
/gnu/store/39yi0d07qcfhv312lv7bkc60wl5pzpyb-viennarna-2.2.8/include/ViennaRNA/interior_loops.h:361: undefined reference to `no_closingGU'
./.libs/libLocARNA-1.5.a(rna_ensemble.o):/gnu/store/39yi0d07qcfhv312lv7bkc60wl5pzpyb-viennarna-2.2.8/include/ViennaRNA/interior_loops.h:359: more undefined references to `no_closingGU' follow
./.libs/libLocARNA-1.5.a(rna_ensemble.o): In function `LocARNA::RnaEnsemble::arc_external_prob(unsigned long, unsigned long) const':
/tmp/guix-build-locarna-1.8.10.drv-0/LocARNA-1.8.10/src/LocARNA/rna_ensemble.cc:1217: undefined reference to `exp_E_ExtLoop'
/tmp/guix-build-locarna-1.8.10.drv-0/LocARNA-1.8.10/src/LocARNA/rna_ensemble.cc:1231: undefined reference to `exp_E_ExtLoop'
./.libs/libLocARNA-1.5.a(rna_ensemble.o): In function `LocARNA::RnaEnsembleImpl::compute_Qm2_ali()':
/tmp/guix-build-locarna-1.8.10.drv-0/LocARNA-1.8.10/src/LocARNA/rna_ensemble.cc:518: undefined reference to `fold_constrained'
...

These symbols appear to be defined in ViennaRNA's libRNA. I've tried to build with ViennaRNA 2.2.7 and 2.2.7 and with a static build of LocARNA (--enable-link-static=yes) and without. I'm not familiar with libtool, so I don't know what's going on here or how to fix this.

I even tried to patch src/Makefile.am before bootstrapping, adding the full path to "libRNA.a" to the LDADD line, but without success.

s-will commented 8 years ago

Great, many thanks for doing this. I think, this is due to static linking. I am trying to reproduce this and come back. -- Sebastian

On 08/03/2016 04:31 PM, rekado wrote:

I'm trying to package LocARNA for Guix but it seems that the libraries are not linked properly. I'm getting errors like this:

|./.libs/libLocARNA-1.5.a(rna_ensemble.o): In function LocARNA::RnaEnsembleImpl::ptype_of_admissible_basepair(unsigned long, unsigned long) const': /tmp/guix-build-locarna-1.8.10.drv-0/LocARNA-1.8.10/src/LocARNA/rna_ensemble.cc:592: undefined reference tono_closingGU' ./.libs/libLocARNA-1.5.a(rna_ensemble.o): In function LocARNA::RnaEnsembleImpl::unpaired_in_loop_prob_ali(unsigned long, unsigned long, unsigned long) const': /tmp/guix-build-locarna-1.8.10.drv-0/LocARNA-1.8.10/src/LocARNA/rna_ensemble.cc:745: undefined reference tono_closingGU' /tmp/guix-build-locarna-1.8.10.drv-0/LocARNA-1.8.10/src/LocARNA/rna_ensemble.cc:767: undefined reference to no_closingGU' ./.libs/libLocARNA-1.5.a(rna_ensemble.o): In function LocARNA::RnaEnsembleImpl::unpaired_in_loop_prob_noali(unsigned long, unsigned long, unsigned long) const': /gnu/store/39yi0d07qcfhv312lv7bkc60wl5pzpyb-viennarna-2.2.8/include/ViennaRNA/interior_loops.h:361: undefined reference to no_closingGU' /gnu/store/39yi0d07qcfhv312lv7bkc60wl5pzpyb-viennarna-2.2.8/include/ViennaRNA/interior_loops.h:361: undefined reference tono_closingGU' ./.libs/libLocARNA-1.5.a(rna_ensemble.o):/gnu/store/39yi0d07qcfhv312lv7bkc60wl5pzpyb-viennarna-2.2.8/include/ViennaRNA/interior_loops.h:359: more undefined references to no_closingGU' follow ./.libs/libLocARNA-1.5.a(rna_ensemble.o): In function LocARNA::RnaEnsemble::arc_external_prob(unsigned long, unsigned long) const': /tmp/guix-build-locarna-1.8.10.drv-0/LocARNA-1.8.10/src/LocARNA/rna_ensemble.cc:1217: undefined reference to exp_E_ExtLoop' /tmp/guix-build-locarna-1.8.10.drv-0/LocARNA-1.8.10/src/LocARNA/rna_ensemble.cc:1231: undefined reference toexp_E_ExtLoop' ./.libs/libLocARNA-1.5.a(rna_ensemble.o): In function LocARNA::RnaEnsembleImpl::compute_Qm2_ali()': /tmp/guix-build-locarna-1.8.10.drv-0/LocARNA-1.8.10/src/LocARNA/rna_ensemble.cc:518: undefined reference tofold_constrained' ... |

These symbols appear to be defined in ViennaRNA's libRNA. I've tried to build with ViennaRNA 2.2.7 and 2.2.7 and with a static build of LocARNA (|--enable-link-static=yes|) and without. I'm not familiar with libtool, so I don't know what's going on here or how to fix this.

I even tried to patch |src/Makefile.am| before bootstrapping, adding the full path to "libRNA.a" to the |LDADD| line, but without success.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/s-will/LocARNA/issues/7, or mute the thread https://github.com/notifications/unsubscribe-auth/ALTKrS4ut6ArMwAtPVfMyh6ihM0rUeW9ks5qcKZEgaJpZM4JbsRh.

Dr. Sebastian Will Bioinformatics/IZBI Härtelstrasse 16-18, Room 448.1 University Leipzig D-04107 Leipzig

Tel.: +49 (0) 341 97 16689

s-will commented 8 years ago

It seems like I need more information, since I cannot reproduce your problem (linking either statically or dynamically works for me).

Do you try to install the locarna release from http://www.bioinf.uni-freiburg.de/Software/LocARNA/Releases/locarna-1.8.10.tar.gz ? Which system, configure options, compiler version do you use? Did you compile the Vienna package (how?) or install from packages (which?)

On 08/03/2016 05:12 PM, Sebastian Will wrote:

Great, many thanks for doing this. I think, this is due to static linking. I am trying to reproduce this and come back. -- Sebastian

On 08/03/2016 04:31 PM, rekado wrote:

I'm trying to package LocARNA for Guix but it seems that the libraries are not linked properly. I'm getting errors like this:

|./.libs/libLocARNA-1.5.a(rna_ensemble.o): In function LocARNA::RnaEnsembleImpl::ptype_of_admissible_basepair(unsigned long, unsigned long) const': /tmp/guix-build-locarna-1.8.10.drv-0/LocARNA-1.8.10/src/LocARNA/rna_ensemble.cc:592: undefined reference tono_closingGU' ./.libs/libLocARNA-1.5.a(rna_ensemble.o): In function LocARNA::RnaEnsembleImpl::unpaired_in_loop_prob_ali(unsigned long, unsigned long, unsigned long) const': /tmp/guix-build-locarna-1.8.10.drv-0/LocARNA-1.8.10/src/LocARNA/rna_ensemble.cc:745: undefined reference tono_closingGU' /tmp/guix-build-locarna-1.8.10.drv-0/LocARNA-1.8.10/src/LocARNA/rna_ensemble.cc:767: undefined reference to no_closingGU' ./.libs/libLocARNA-1.5.a(rna_ensemble.o): In function LocARNA::RnaEnsembleImpl::unpaired_in_loop_prob_noali(unsigned long, unsigned long, unsigned long) const': /gnu/store/39yi0d07qcfhv312lv7bkc60wl5pzpyb-viennarna-2.2.8/include/ViennaRNA/interior_loops.h:361: undefined reference to no_closingGU' /gnu/store/39yi0d07qcfhv312lv7bkc60wl5pzpyb-viennarna-2.2.8/include/ViennaRNA/interior_loops.h:361: undefined reference tono_closingGU' ./.libs/libLocARNA-1.5.a(rna_ensemble.o):/gnu/store/39yi0d07qcfhv312lv7bkc60wl5pzpyb-viennarna-2.2.8/include/ViennaRNA/interior_loops.h:359: more undefined references to no_closingGU' follow ./.libs/libLocARNA-1.5.a(rna_ensemble.o): In function LocARNA::RnaEnsemble::arc_external_prob(unsigned long, unsigned long) const': /tmp/guix-build-locarna-1.8.10.drv-0/LocARNA-1.8.10/src/LocARNA/rna_ensemble.cc:1217: undefined reference to exp_E_ExtLoop' /tmp/guix-build-locarna-1.8.10.drv-0/LocARNA-1.8.10/src/LocARNA/rna_ensemble.cc:1231: undefined reference toexp_E_ExtLoop' ./.libs/libLocARNA-1.5.a(rna_ensemble.o): In function LocARNA::RnaEnsembleImpl::compute_Qm2_ali()': /tmp/guix-build-locarna-1.8.10.drv-0/LocARNA-1.8.10/src/LocARNA/rna_ensemble.cc:518: undefined reference tofold_constrained' ... |

These symbols appear to be defined in ViennaRNA's libRNA. I've tried to build with ViennaRNA 2.2.7 and 2.2.7 and with a static build of LocARNA (|--enable-link-static=yes|) and without. I'm not familiar with libtool, so I don't know what's going on here or how to fix this.

I even tried to patch |src/Makefile.am| before bootstrapping, adding the full path to "libRNA.a" to the |LDADD| line, but without success.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/s-will/LocARNA/issues/7, or mute the thread https://github.com/notifications/unsubscribe-auth/ALTKrS4ut6ArMwAtPVfMyh6ihM0rUeW9ks5qcKZEgaJpZM4JbsRh.

Dr. Sebastian Will Bioinformatics/IZBI Härtelstrasse 16-18, Room 448.1 University Leipzig D-04107 Leipzig

Tel.: +49 (0) 341 97 16689

rekado commented 8 years ago

I tried the release tarball on Github as well as the tarball on uni-freiburg.de. I get the same results in both cases.

I'm building on x86_64 with the following versions:

I packaged ViennaRNA for Guix. The package recipe for my ViennaRNA package as well as the package recipe for locARNA is available in the wip-locarna branch of my guix-bimsb repository:

https://github.com/BIMSBbioinfo/guix-bimsb/blob/wip-locarna/bimsb/packages/bioinformatics-nonfree.scm#L591

If you have Guix and a clone of "guix-bimsb" you should be able to reproduce this with

export GUIX_PACKAGE_PATH=$HOME/code/guix-bimsb
guix build locarna

Guix builds packages in a limited chroot in which only declared packages are available, which allows for reproducibility.

s-will commented 8 years ago

Hi again. It seems that Guix has problems to use the static lib of ViennaRNA together with link time optimization (lto). Maybe you can find out how to configure this correctly. For the moment, as a workaround, I suggest to disable lto for ViennaRNA (looking at a few example, I couldn't see any significant performance difference; it would be interesting to benchmark this properly). Otherwise, the undefined references seem to be a typical problem, if the build system is not 100% correctly configured for lto (e.g. wrong ar). Maybe Ronny (@RaumZeit) has some more ideas how to fix the RNAlib-lto problem.

To test compilation without lto, I modified your package description. This worked for me.

--- a/bimsb/packages/bioinformatics-nonfree.scm
+++ b/bimsb/packages/bioinformatics-nonfree.scm
@@ -34,7 +34,7 @@
   #:use-module (gnu packages bioinformatics)
   #:use-module (gnu packages boost)
   #:use-module (gnu packages compression)
-  #:use-module (gnu packages doxygen)
+  #:use-module (gnu packages documentation)
   #:use-module (gnu packages file)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages ghostscript)
@@ -601,6 +601,8 @@ including SNPS, microsatellites, RFLPs and AFLPs.")
                (base32
                 "0b9h3rrndxjvj3r2wyixf095fghpspgiwx3acbd8hlv3lj6hpi1h"))))
     (build-system gnu-build-system)
+    (arguments
+     `(#:configure-flags `("--disable-lto")))
     (inputs
      `(("perl" ,perl)
        ("python" ,python)))
rekado commented 8 years ago

Thank you for your patience and with coming up with a work-around! I'll bring the lto problems up in the Guix community. Maybe there's something we can do about this.

(I'll only be able to test the fix in about a week.)

RaumZeit commented 8 years ago

I think what might be the issue is that static libraries compiled with LTO support are treated incorrectly by '/usr/bin/strip', resulting in destroyed symbol tables. This is at least an issue for the binary packages we provide for the ViennaRNA Packages. I'll test your scm and see what I can contribute to fix this problem, but for now, disabling LTO support seems to be the most easy fix.

RaumZeit commented 8 years ago

Update: The problem is exactly what I assumed previously. The ViennaRNA Package build is stripped with /usr/bin/strip, which destroys the static library when build with LTO. There are two options to solve this issue: 1. disable stripping for libRNA.a and 2. convince /usr/bin/strip to load a plugin for LTO binaries. However, I haven't figured out how to do 2. yet, that is why we usually explicitly disable stripping of libRNA.a in our prebuild Linux packages.

rekado commented 8 years ago

Thank you, @RaumZeit, for this explanation. I've built ViennaRNA without LTO (I could have also removed the "strip" phase) and LocARNA built out just fine.

Thanks a lot for the assistance, @s-will and @RaumZeit!