Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ViennaRNA/plotting/naview.h file not found #1

Closed
GuoHao150 opened this issue Feb 19, 2023 · 5 comments
Closed

ViennaRNA/plotting/naview.h file not found #1

GuoHao150 opened this issue Feb 19, 2023 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@GuoHao150
Copy link

Hi,

Thank you for creating this crate, I'm not familiar with the rust calling c library. I installed the ViennaRNA at /data01/softwares/ViennaRNA-2.5.1 and the libRNA.a file can be found at /data01/softwares/ViennaRNA-2.5.1/src/ViennaRNA I want to know how to set the LIBRNA_INCLUDE_DIR variable because the cargo keeps telling me that fatal error: 'ViennaRNA/plotting/naview.h' file not found

Best wishes

@fncnt
Copy link
Owner

fncnt commented Feb 20, 2023

Hi, thanks for reaching out!

There are a few things happening here.
First, ViennaRNA 2.5.1 changed the location of that particular header file (ViennaRNA/ViennaRNA@569f647).

Second, for some reason, even if naview.h was at the correct location, we wouldn't find it.
The cause of this is still beyond my understanding a header directory I forgot to include.
However, there is a workaround (additionally to setting LIBRNA_INCLUDE_DIR and LIBRNA_LIB_DIR:

export CPATH=$LIBRNA_INCLUDE_DIR

There's still one major caveat; while debugging, I noticed that librna-sys wouldn't build cargo test wouldn't work with ViennaRNA >=2.5.0 (although crates depending on librna-sys still can create tests with the FFI bindings!).
This is possibly related to ViennaRNA/ViennaRNA@1055687

A workaround for this would be downgrading to 2.4.18 for now and following the user-dir installation instructions, i.e.:

tar -zxvf ViennaRNA-2.4.18.tar.gz
cd ViennaRNA-2.4.18
./configure --prefix=/data01/softwares/ViennaRNA
make install
export LIBRNA_INCLUDE_DIR=/data01/softwares/ViennaRNA/include
export LIBRNA_LIB_DIR=/data01/softwares/ViennaRNA/lib
export CPATH=$LIBRNA_INCLUDE_DIR

This should work until I manage to fix the underlying issues. Sorry for the trouble!

EDIT: changed inaccuracies for future reference.

@fncnt fncnt mentioned this issue Feb 20, 2023
8 tasks
@fncnt fncnt self-assigned this Feb 20, 2023
@fncnt fncnt added the bug Something isn't working label Feb 20, 2023
@fncnt
Copy link
Owner

fncnt commented Feb 20, 2023

Actually, the CPATH workaround might not work for you at all...
Currently I'd recommend installing ViennaRNA via one of the official packages or through bioconda until I fix it:
Have a look at this to get an idea.

@fncnt
Copy link
Owner

fncnt commented Feb 20, 2023

This should be fixed in v0.1.5 which is already live on crates.io.
Feel free to re-open if necessary.

@fncnt fncnt closed this as completed Feb 20, 2023
@GuoHao150
Copy link
Author

Thanks for your explanation, making such a crate is definitely not easy, since the ViennaRNA is a huge package. If someone just wants to use a sub-module of ViennaRNA-2.5.1 with rust, here is the tip: Follow the C API example of ViennaRNA and make a shared library with g++ then call it from rust.

@fncnt
Copy link
Owner

fncnt commented Feb 21, 2023

If someone just wants to use a sub-module of ViennaRNA-2.5.1 with rust, here is the tip: Follow the C API example of ViennaRNA and make a shared library with g++ then call it from rust.

I don't think this is necessary. The linked libRNA.a library is static and only the functions used on the Rust side will be compiled into the binaries.
However, I omitted a few header files containing new functionality since 2.4.18 to maintain backwards-compatibility until I decide how I want to include them without affecting older versions of ViennaRNA (possibly a new minor release). See #2 for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants