rlorigro / GFAse

Tool for globally phasing diploid assembly graphs with orthogonal data
Mozilla Public License 2.0
36 stars 4 forks source link

missing jansson package #19

Closed LHG-GG closed 1 year ago

LHG-GG commented 1 year ago

Hi

While installing Gfase, I got the following error:

[  4%] Performing configure step for 'project_bdsg'
-- Checking for module 'jansson'
--   No package 'jansson' found
CMake Error at /usr/share/cmake-3.16/Modules/FindPkgConfig.cmake:463 (message):
  A required package was not found
Call Stack (most recent call first):
  /usr/share/cmake-3.16/Modules/FindPkgConfig.cmake:643 (_pkg_check_modules_internal)
  CMakeLists.txt:140 (pkg_check_modules)

I installed jansson from https://github.com/akheron/jansson and exported the path like export LD_LIBRARY_PATH="~/tools/jansson-2.14/lib/:$LD_LIBRARY_PATH"

still the same error. As I do not have permission to copy the libjansson.so.4.14.0into /usr/local/lib/. could you help me resolve the issue?

I ran Verkko with hic data. There are so many gfa files. Which GFA file needs to used for Gfase?

Thank you

rlorigro commented 1 year ago

Hi,

can you verify that you are using dev version of the library? please check the dependency list on the ReadMe page.

At the moment the verkko GFA would need to be homopolymer decompressed before running GFAse. We originally worked with the authors to get this, but we are currently developing on a workflow that will do everything automatically @juklucas @jeizenga

LHG-GG commented 1 year ago

Hi @rlorigro

Thank you.

post rectifying libjansson-dev. cmake ran successfully with no error but encountered an error while make. I have attached the full log.

gfase_install_error.txt cmake.txt

rlorigro commented 1 year ago

Hi, yes that is my fault for not listing ‘autoconf’ and ‘autoheader’ as a dependency. Samtools needs them. Often if you rerun the make command single-threaded after it fails you can get a cleaner error output.

LHG-GG commented 1 year ago

Thank you. I could install successfully.

scthree commented 1 year ago

Dear Developers,

Thank you for maintaining this software and community!

Apologies for bugging you again. I'm trying to install GFAse on a university cluster (and don't have root privelege) and can load many of the required GFAse dependencies as modules. But I don't think we have the Jansson module (I emailed our admin to double-check)...so I tried to install it in a local usr dir (see below):

├── control ├── control.tar ├── control.tar.zst ├── data.tar ├── data.tar.zst ├── debian-binary ├── libjansson-dev_2.13.1-1.1build3_amd64.deb ├── md5sums └── usr ├── include │   ├── jansson_config.h │   └── jansson.h ├── lib │   └── x86_64-linux-gnu │   ├── libjansson.a │   ├── libjansson.so -> libjansson.so.4.13.0 │   └── pkgconfig │   └── jansson.pc └── share └── doc └── libjansson-dev ├── changelog.Debian.gz -> ../libjansson4/changelog.Debian.gz └── copyright

Then I exported it into my bashrc, and sourced it: export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu"

But during make -j step, the Jansson package still can't be found:

checking for C compiler default output file name... a.out checking for suffix of executables... -- Checking for module 'jansson' -- No package 'jansson' found CMake Error at /share/software/user/open/cmake/3.24.2/share/cmake-3.24/Modules/FindPkgConfig.cmake:607 (message): A required package was not found Call Stack (most recent call first): /share/software/user/open/cmake/3.24.2/share/cmake-3.24/Modules/FindPkgConfig.cmake:829 (_pkg_check_modules_internal) CMakeLists.txt:140 (pkg_check_modules)

Appreciate your time, I know you guys are busy and have your own projects to work on! Best, Steve

rlorigro commented 1 year ago

Hi Steve,

I am not an expert on local builds, but could you try ldconfig -v and seeing if jansson is found? If possible, you may be able to simply move your jansson library into one of the dirs that your linker searches already, assuming you have permissions.

@adamnovak do you have any advice for building libbdsg locally?

-Ryan

adamnovak commented 1 year ago

libbdsg (a GFAse dependency) looks for Jansson like this: https://github.com/vgteam/libbdsg/blob/8e47864fbf6513d54810b1d16df38b1b4cffcdfe/CMakeLists.txt#L140

So that means jansson has to be visible to pkg-config, the tool we use to find it. If you run pkg-config --libs jansson you need to get something sort of like:

-L/opt/homebrew/Cellar/jansson/2.14/lib -ljansson

For that to happen, the jansson.pc file that Jansson installed needs to be in one of the directories that pkg-config searches. So you need to do something like:

export PKG_CONFIG_PATH="/wherever/you/put/jansson/usr/lib/x86_64-linux-gnu/pkgconfig:${PKG_CONFIG_PATH}"

Doing export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu" would add /usr/lib/x86_64-linux-gnu to the places to look for libraries when running a program; it won't hook up pkg-config I don't think. And also, did you really put your Jansson in /usr under the root of the drive? Without root privileges?

Also, it looks like you are downloading the Debian package for Jansson and extracting it somewhere. I don't think that will actually work, even if you point pkg-config at it, because jansson.pc is going to list the paths that the Debian package expected its files to be placed at, not the paths you actually placed them at. Debian packages aren't really movable; they need to be installed where they expect or they won't work.

If you aren't using the system package manager to get Jansson, what we really expect you to do is to build Jansson from source and put it in a --prefix you control:

  1. Download https://github.com/akheron/jansson/releases/download/v2.14/jansson-2.14.tar.bz2
  2. Extract it and go in the directory it makes.
  3. Run ./configure --prefix="${HOME}/.local". This will set up Jansson to expect to live in the "prefix" of a.localfolder under your home folder, along with e.g. all the Python stuff you might install withpip install --user. So everything that ususally goes in/usr/libwould instead go in.local/lib` in your home directory.
  4. Run make
  5. Run make install so Jansson copies all its stuff into place
  6. Find the directory where Jansson put its jansson.pc (probably ${HOME}/.local/lib/x86_64-linux-gnu/pkgconfig? Or maybe without the x86_64-linux-gnu?) and make sure it is in your PKG_CONFIG_PATH environment variable. export PKG_CONFIG_PATH="${HOME}/.local/lib/x86_64-linux-gnu/pkgconfig:${PKG_CONFIG_PATH}"
  7. Run pkg-config --libs jansson to make sure that pkg-config is picking up your Jansson installation.

Then, if that works, the GFAse build should pick it up and use it.

scthree commented 1 year ago

Thank you Ryan for your kind reply!

Adam, really appreciate your eloquent, detailed, and easy to follow suggestions! They were so helpful and I'm sorry you had to type all of that. Thanks for teaching me how pkg-config looks for jansson. You were 100% right...I tried to manually extract the Debian Jansson package into a local dir (forgot to add ~/usr which is a local dir I created) and then incorrectly tried to point pkg-config to it with export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu"

Now I followed your instructions, and was able to build Jansson from source with the prefix flag (ugh, sorry I forgot I could use this flag). Then was able to successfully export jansson.pc into my PKG_CONFIG_PATH environment variable. No issues now loading Jansson when installing GFAse (make -j), but unfortunately I'm getting several new errors. I will try to troubleshoot myself first before reaching out to you again for help :) But just wanted to write back before too much time had passed to thank you both!

Sincerely, Steve

adamnovak commented 1 year ago

@scthree Great! Let us know if there's anything you think we could do about the other problems. If they're common problems we probably should put them on a troubleshooting list around here somewhere.