zeeev / wham

Structural variant detection and association testing
Other
101 stars 25 forks source link

installation fails undefined reference to BamTools functions #49

Open wiraki opened 6 years ago

wiraki commented 6 years ago

Hello,

I am trying to install whamg with git clone --recursive https://github.com/zeeev/wham.git; cd wham; make

I have seen a couple of other issues referring to similar problems but I couldn't fix it myself. Here is the part that raises the error:

g++ -fstack-protector-all -Wall -DVERSION=\"v1.7.0-311-g4e8c-dirty\" -std=c++0x -Wno-sign-compare -O3 -Isrc/lib -Isrc/bamtools/include -Isrc/bamtools/src -Isrc/ -Isrc/fastahack -Isrc/Complete-Striped-Smith-Waterman-Library/src/ src/bin/whamg.cpp src/bamtools/lib/libbamtools.a src/obj/entropy.o src/obj/read_pileup.o src/obj/split.o src/obj/readPileUp.o src/obj/flag.o src/fastahack/Fasta.o src/Complete-Striped-Smith-Waterman-Library/src/ssw_cpp.o src/Complete-Striped-Smith-Waterman-Library/src/ssw.o -o bin/whamg -fopenmp -lz -lm
src/bin/whamg.cpp: In function ‘void findPairs(std::vector<node*>&, breakpoint*, std::map<int, std::map<int, breakpoint*> >&)’:
src/bin/whamg.cpp:1706:9: warning: variable ‘lmax’ set but not used [-Wunused-but-set-variable]
     int lmax = 0;
         ^
src/bin/whamg.cpp:1707:9: warning: variable ‘rmax’ set but not used [-Wunused-but-set-variable]
     int rmax = 0;
         ^
src/bin/whamg.cpp:1709:9: warning: variable ‘edsn’ set but not used [-Wunused-but-set-variable]
     int edsn = 0;
         ^
/tmp/cc2QE5uH.o: In function `bool BamTools::BamAlignment::GetTag<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) const [clone .part.22]':
whamg.cpp:(.text+0x73): undefined reference to `BamTools::BamAlignment::FindTag(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char*&, unsigned int const&, unsigned int&) const'
/tmp/cc2QE5uH.o: In function `loadBam(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)':
whamg.cpp:(.text+0x5cf3): undefined reference to `BamTools::BamReader::Open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
whamg.cpp:(.text+0x6745): undefined reference to `BamTools::BamReader::OpenIndex(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/tmp/cc2QE5uH.o: In function `gatherBamStats(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)':
whamg.cpp:(.text+0x9b2b): undefined reference to `BamTools::BamReader::Open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
whamg.cpp:(.text+0x9c37): undefined reference to `BamTools::BamReader::OpenIndex(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/tmp/cc2QE5uH.o: In function `runRegion(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int, int, std::vector<BamTools::RefData, std::allocator<BamTools::RefData> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)':
whamg.cpp:(.text+0xd33e): undefined reference to `BamTools::BamReader::Open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
whamg.cpp:(.text+0xd438): undefined reference to `BamTools::BamReader::OpenIndex(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/tmp/cc2QE5uH.o: In function `main':
whamg.cpp:(.text.startup+0xf4): undefined reference to `BamTools::BamMultiReader::Open(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)'
src/obj/readPileUp.o: In function `readPileUp::processPileup(long*)':
readPileUp.cpp:(.text+0x28b4): undefined reference to `BamTools::BamAlignment::FindTag(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char*&, unsigned int const&, unsigned int&) const'
collect2: error: ld returned 1 exit status
make: *** [bin/whamg] Error 1

Would appreciate some help :)

zeeev commented 6 years ago

Hi @mpauper,

What system are you using? Do you have a newer version of bamtools in your path?

wiraki commented 6 years ago

Hi @zeeev ,

Thanks for the prompt reply!

I am on a CentOS 7.4 system. I do not have any other bamtools in my path.

cmake version 3.12.1 gcc version 5.1.0

srynobio commented 6 years ago

@zeeev I think this is related to the issue I opened. Possibility related to the bamtools build in your makefile.

zeeev commented 6 years ago

Hi Shawn,

Did you try updating the checkout of bamtools prior to the build, like I suggested? Did that solve the problem? If so, I will just update the bamtools checkout.

—Zev

On Aug 20, 2018, at 2:41 PM, Shawn Rynearson notifications@github.com wrote:

@zeeev https://github.com/zeeev I think this is related to the issue https://github.com/zeeev/wham/issues/47 I opened. Possibility related to the bamtools build in your makefile.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/zeeev/wham/issues/49#issuecomment-414472854, or mute the thread https://github.com/notifications/unsubscribe-auth/AAnxIRSrZVlsIv5mrjSiWYi2-su4AR-5ks5uSy0jgaJpZM4V_upl.

wiraki commented 6 years ago

Hello,

I am not sure that this is the correct way to do it but here is what I tried:

> cd src/bamtools/
> git pull
You are not currently on a branch. Please specify which
branch you want to merge with. See git-pull(1) for details.
> git checkout master
Previous HEAD position was 2d7685d... Clarified documentation on BamReader::GetNextAlignmentCore
Switched to branch 'master'
> git pull
Already up-to-date.
> cd ../..
> make

I still have the same error, however.

davidecarlson commented 3 years ago

Old thread, but I wanted to note that I had similar issues and was able to resolve them by using an older version of Cmake and gcc. I switched from Cmake 3.16 and gcc 7.1 to Cmake 3.5.1 and gcc 4.8.5 and the compilation worked.

quentin0515 commented 3 years ago

Hi Shawn, Did you try updating the checkout of bamtools prior to the build, like I suggested? Did that solve the problem? If so, I will just update the bamtools checkout. —Zev On Aug 20, 2018, at 2:41 PM, Shawn Rynearson @.***> wrote: @zeeev https://github.com/zeeev I think this is related to the issue <#47> I opened. Possibility related to the bamtools build in your makefile. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#49 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/AAnxIRSrZVlsIv5mrjSiWYi2-su4AR-5ks5uSy0jgaJpZM4V_upl.

Hi, @zeeev I have the same problem as #47 and I have read about the other problem #47, and the solution you proposed. But I'm not sure I understand what do you mean by "go into the bamtools submodule, in whamg, prior to building and then update the branch?" Could you give more detailed instructions about it and I will try it immediately. Many thanks.

I tried to change LBAMTOOLS=src/bamtools/lib/libbamtools.a to LBAMTOOLS=src/bamtools/build/src/api/libbamtools.a It works. Though I'm not sure if it also because I made other changes to my environment.

Quentin