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

error adding symbols: File format not recognized #279

Closed
svm-zhang opened this issue Oct 31, 2020 · 13 comments
Closed

error adding symbols: File format not recognized #279

svm-zhang opened this issue Oct 31, 2020 · 13 comments

Comments

@svm-zhang
Copy link

Hello,

I am very new to rust and rust-htslib.

I am trying to use rust-htslib to extract alignment information from BAM files for my project. I keep getting "error adding symbols: File format not recognized" errors when running cargo run (see below). I am using the example from: https://docs.rs/rust-htslib/0.32.0/rust_htslib/. The error seems to be related to decompression I guess? I am able to build basic projects such as "hello world". I am on CentOS 8.2.2004. Any help would be much appreciated!

target/debug/deps/libhts_sys-26e72ed60472137f.rlib(bgzf.o): unable to initialize decompress status for section .debug_info
target/debug/deps/libhts_sys-26e72ed60472137f.rlib: error adding symbols: File format not recognized

Simo

@brainstorm
Copy link
Member

How do you compile your example? Can you show us the commands you use?

@svm-zhang
Copy link
Author

Thanks for the help here. Below is my toml file

[package]
name = "frag"
version = "0.1.0"
authors = ["szhang"]
edition = "2018"

[dependencies]
rust-htslib = "*"

The command I used for compiling is simply cargo run.

@brainstorm
Copy link
Member

Have you tried with cross run instead?

@svm-zhang
Copy link
Author

svm-zhang commented Nov 1, 2020

I got this error when running either cross build or cross run

Error: could not get runtime: error generating default config from memory: cannot mkdir /run/user/1270/libpod: mkdir /run/user/1270/libpod: no such file or directory

It feels like due to a permission problem?

@brainstorm
Copy link
Member

Yes, looks like some type of issue with your Docker installation/setup, as far as I can see :-S

@svm-zhang
Copy link
Author

Oh, let me clarify a bit more. I was running without docker. I am working on a HPC server. Is docker a must to use rust-htslib?

@sitag
Copy link
Contributor

sitag commented Nov 2, 2020

@svm-zhang I have had issues with reading zipped files on centos (6, 7 at leasr); the bgzip errors seems to indicate something similar. Do you get the same error if you try reading a sam file instead of bam?

@svm-zhang
Copy link
Author

@sitag, yes, I got the same error.

I also tried to download the htslib from htslib.org and manually install it to overwrite the htslib in the target/build within the project folder. Interestingly, once I did that, the bgzf.o error went away and the compiler then complained about the libz.

@sitag
Copy link
Contributor

sitag commented Nov 2, 2020

@svm-zhang I would have thought that git clone --recursive would have pulled the right version of htslib, so that shouldn't have been an issue. The failure with sam input says something was not cloned right. You could check the commit in htslib under hts-sys.

CentOS does have a bunch of weird issues with outdated libraries. If you have access to a ubuntu node then that would help. Docker is not an option in HPC as it want to run under root. But you can try singularity. Alternatively, you could also try building with target x86_64-unknown-linux-musl on an ubuntu machine and use that on CentOS HPC node.

@svm-zhang
Copy link
Author

@sitag, thanks for the suggestions. The same code used to work fine on the old server and I was using rustc v1.36.0 and rust-htslib v0.24.0. Now we switched to a new server... sigh...

I just checked the log under hts-sys and i believe it is the right version that was pulled in.

I will wait a bit longer to see if the developers could help me figure this out. Thank you again.

@svm-zhang
Copy link
Author

@brainstorm @sitag,

I think I somehow figured it out. Here is what I did.

  1. Cloned the rust-htslib repo to the project folder;
  2. Updated the Cargo.toml to make sure the rust-htslib is built from the cloned local copy;
    2.1 Ensured the rust-htslib version is 0.32.1-alpha.0
  3. Updated the Cargo.toml under the htslib folder within the rust-htslib as the following
    3.1 libz-sys version => 1.1.2
    3.2 curl-sys version => 0.4.34
    3.3 openssl-sys version => 0.9.58

Using this setting, now my code can be compiled and ran. However, I am not sure if this would break someday. But for now, I am gonna enjoy it :)

@sitag sitag closed this as completed Nov 3, 2020
@brainstorm
Copy link
Member

Oh, I thought I fixed that one in #231 :/ ... I'd keep working on #275 to get it properly fixed and on CI so that we don't hit a regression again, sorry for the hassle @svm-zhang :-S

@svm-zhang
Copy link
Author

@brainstorm , no worries at all. I simply try to help. I have been enjoying the rust-htslib a lot :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants