timflutre / eqtlbma

Package to detect eQTLs jointly in multiple subgroups (e.g. tissues) via Bayesian Model Averaging.
http://www.plosgenetics.org/article/info%3Adoi%2F10.1371%2Fjournal.pgen.1003486
GNU General Public License v3.0
22 stars 12 forks source link

Problem installing with GSL 2.1? #22

Closed MikeDacre closed 6 years ago

MikeDacre commented 8 years ago

I am trying to rebuild the package with GSL 2.1 and I am getting the following errors:

Making all in src/eqtlbma
make[1]: Entering directory '/home/dacre/my_packages/eqtlbma/eqtlbma/src/eqtlbma-1.3.1/src/eqtlbma'
Making all in utils
make[2]: Entering directory '/home/dacre/my_packages/eqtlbma/eqtlbma/src/eqtlbma-1.3.1/src/eqtlbma/utils'
  CXX      utils_math.lo
utils_math.cpp: In function ‘void utils::FitSingleGeneWithSingleSnp(const gsl_matrix*, const gsl_vector*, double&, double&, double&, double&, double&)’:
utils_math.cpp:185:72: error: cannot convert ‘const gsl_vector*’ to ‘gsl_multifit_linear_workspace*’ for argument ‘2’ to ‘int gsl_multifit_linear_svd(const gsl_matrix*, gsl_multifit_linear_workspace*)’
                                              Bhat, covBhat, &rss, work);
                                                                        ^
make[2]: *** [Makefile:373: utils_math.lo] Error 1
make[2]: Leaving directory '/home/dacre/my_packages/eqtlbma/eqtlbma/src/eqtlbma-1.3.1/src/eqtlbma/utils'
make[1]: *** [Makefile:535: all-recursive] Error 1
make[1]: Leaving directory '/home/dacre/my_packages/eqtlbma/eqtlbma/src/eqtlbma-1.3.1/src/eqtlbma'
make: *** [Makefile:391: all-recursive] Error 1

Is this something you have noticed or is this a bug on my end? I am just doing a simple configure, make combo the same way I always used to using version 1.3.1, but it is failing. Any thoughts?

timflutre commented 7 years ago

Hi Mike, it seems that the definition of gsl_multifit_linear_svd changed, even though I can't find mention of it anywhere in the NEWS file of the GSL. But it is clear from the GSL online manual. It looks like FitSingleGeneWithSingleSnp() from eQtlBma should now use gsl_multifit_linear. I don't have much time right now (travelling abroad). So feel free to propose a patch. Otherwise I'll try to do it when I come back.

timflutre commented 7 years ago

Using gsl_multifit_linear instead of gsl_multifit_linear_svd doesn't solve the problem as I still need the rank of the design matrix. This is now computed inside multifit_linear_solve which isn't available in the API. I am waiting for help from the GSL maintainer.

MikeDacre commented 7 years ago

Thanks for the update Tim, I have a temporary workaround for now, but it would be great to be able to use eqtlbma with the new GSL once you have a fix.

MikeDacre commented 7 years ago

Hi @timflutre, which is the last GSL that you know to work with eqtlbma?

timflutre commented 7 years ago

Hi @MikeDacre, after looking at the code from the GSL, the API break occurred between versions 1.16 and 2.0. Patrick Alken, the maintainer of the GSL, told me a few days ago on help-gsl@gnu.org that he added the function gsl_multifit_linear_rank which now returns the effective rank of the matrix (see the git log and the git commit). I would like to find a way to fix this such that it works for GSL 1.6 as well as >= 2.0, but I lack time...

MikeDacre commented 7 years ago

Thanks @timflutre. Could you help me figure out how to install with a GSL in a non-standard location? Right now I have to clobber the system gsl to get it to work.

I tried installing gsl to /example/path and then doing:

export LDFLAGS=-L/example/path/lib
export LT_SYS_LIBRARY_PATH=/example/path/lib
export LD_RUN_PATH=/example/path/lib
export CFLAGS=-I/example/path/include
export CXXFLAGS=$CFLAGS

I tried install with the standard autoreconf, configure, ... steps on the wiki, but make is failing in the linking step:

make[1]: Entering directory '/home/dacre/my_packages/eqtlbma-gsl-1.6/eqtlbma/src'
  CXX      eqtlbma_bf-eqtlbma_bf.o
  CXXLD    eqtlbma_bf
../src/eqtlbma/.libs/libeqtlbma.so: undefined reference to `__ks_insertsort_uint64_t'
../src/eqtlbma/.libs/libeqtlbma.so: undefined reference to `__ks_insertsort_offt'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:445: eqtlbma_bf] Error 1
make[1]: Leaving directory '/home/dacre/my_packages/eqtlbma-gsl-1.6/eqtlbma/src'
make: *** [Makefile:391: all-recursive] Error 1
make  20.24s user 1.48s system 88% cpu 24.664 total

I tried setting a bunch of other flags, like LD_LIB_PATH, and I looked through the Makefile variables, but I couldn't find anything.

It works fine if I install gsl to /usr, but that isn't a feasible option on our large cluster.

Thanks!

timflutre commented 7 years ago

@MikeDacre In the past, I found that I had to specifically pass LDFLAGS to configure rather than exporting it as a bash global variable:

./configure LDFLAGS=-L/example/path/lib
make

Does this work for you?

@pcarbo may be able to help you if this doesn't work (he now also has push access to this repo)

pcarbo commented 7 years ago

Mike, what operating system are you using?

MikeDacre commented 7 years ago

Arch Linux.

I haven't tried Tim's suggestion yet, as I just clobbered my system GSL for now, but I will try it shortly.

pcarbo commented 7 years ago

Mike, I was able to successfully run make check and make install on Linux (specifically, Scientific Linux 7). See here for some details on my setup.

I agree with Tim that it works well to set the environment variables in the call to configure. Here is an example (that I ran on my MacBook Pro):

./configure --prefix=/Users/pcarbo/eqtlbma \
  LDFLAGS="-L/usr/local/lib -L/usr/local/opt/zlib/lib" CXX="g++-4.8" \
  CPPFLAGS="-I/usr/local/include -I/usr/local/opt/zlib/include"
MikeDacre commented 7 years ago

That worked, thank you both.

timflutre commented 7 years ago

Hi @MikeDacre and @pcarbo, first of all, I wish you a happy new year! GSL-2.3 was released some weeks ago, with gsl_multifit_linear_rank as part of the API (as you can see at the bottom of this manual page).

If any of you has the time, it is now possible to modify FitSingleGeneWithSingleSnp (in src/eqtlbma/utils/utils_math.cpp) so that it now uses gsl_multifit_linear and gsl_multifit_linear_rank instead of gsl_multifit_linear_svd.

I think configure.ac should also be edited to check that gsl_multifit_linear_rank indeed is available in the GSL library installed on the user's computer.

pcarbo commented 7 years ago

Thanks, Tim! I'll look into this when I have a chance.

timflutre commented 7 years ago

FYI I am looking into solving this issue right now.

timflutre commented 7 years ago

I solved the issue in eQtlBma's code (see this commit on a new branch), but this package also integrates code from IRLS, suffering from a similar issue. I hence started to apply the same solution, but there it "almost" works, returning a very strange error (see this issue). I am now a bit lost, and already spent a whole day on this... so any help is appreciated.

timflutre commented 6 years ago

I updated IRLS in eQtlBma with its latest version, which fixes this issue: all tests pass for me. You can retrieve the "master" branch to see if it's working for you, too. I also updated the Installation section in the manual to show how to compile the "master" branch when the GSL is installed in the home directory:

autoreconf --install --force --symlink
./configure --prefix=$HOME CXXFLAGS="-I$HOME/include" LDFLAGS="-L$HOME/lib -Wl,-rpath -Wl,$HOME/lib"
make
make check
make install

If it's ok for you, I will make a new release: eQtlBma v1.3.2.

molpopgen commented 6 years ago

I am in the process of updating various biconda recipes to use GSL 2.4 instead of 1.16. This package is the only one that runs into the API change for gsl_multifit_fdfsolver_driver. Is 1.3.2 compatible with GSL 2.4? If so, I'll update the bioconda recipe from 1.3.1.

timflutre commented 6 years ago

Hi Kevin (@molpopgen), the latest commits I made works with GSL < 1.17 and > 2.2, that is, I won't support GSL 2.0, 2.1 and 2.2. As the GSL now is at 2.3 since December 2016 and 2.4 since June 2017, I don't think it's a problem. Just let me know if it's ok for you and I will make the 1.3.2 release of eQtlBma right away. (In fact, I was awaiting input from @MikeDacre.)

molpopgen commented 6 years ago

@timflutre -- I confirm that 2.1 results in failed unit tests and that 2.4 passes. That's ok for bioconda, but will be an issue for many Linux distro users. (Ubuntu 16.04 installs 2.1.)

A new release would be great! It may be handy to have ./configure fail if the GSL versions are in the incorrect range, though.

timflutre commented 6 years ago

Ok, perfect, I will make a new release.

I don't have the time to find how to deal with GSL 2.0, 2.1 and 2.2. The most important for me was to fix the issue with at least 2.3 and later. I also don't know how to customize configure.ac to the point where it knows how to deal with such a case, sorry!

molpopgen commented 6 years ago

Give me an hour and I'll see if I can do it via a PR. It isn't too hard.

timflutre commented 6 years ago

I just made the release 1.3.3: https://github.com/timflutre/eqtlbma/releases/latest

I also updated the Installation section of the wiki.

I now consider this issue close. But if someone wants to implement the support for GSL 2.0, 2.1 and 2.2, feel free to reopen it.

timflutre commented 6 years ago

@molpopgen sorry, I didn't see your comment because I was busy making the release. But that would be great to have such a pull request.

molpopgen commented 6 years ago

@timflutre -- no worries. The GSL m4 macros support checking for a min version. One would have to do more work to support < 1.17 && > 2.2.

Thanks for the new version! I'm trying to get all of these packages updated in bioconda, but it may take some time. Some of the recipes are stale.