Augustus icon indicating copy to clipboard operation
Augustus copied to clipboard

bam2hints not compiling - cannot locate BamReader.h

Open MaxCoyle4 opened this issue 3 years ago • 7 comments

Hello! I have been struggling for a while to get bam2hints to compile:

make[2]: Entering directory /netdata/maxcoyle/software/Augustus/auxprogs/bam2hints' g++ -Wall -O2 -Wall -O2 -c bam2hints.cc -o bam2hints.o /netdata/maxcoyle/software/bamtools-master/usr/local/include bam2hints.cc:16:27: fatal error: api/BamReader.h: No such file or directory #include <api/BamReader.h> ^ compilation terminated. make[2]: *** [bam2hints.o] Error 1 make[2]: Leaving directory /netdata/maxcoyle/software/Augustus/auxprogs/bam2hints' make[1]: *** [all] Error 2 make[1]: Leaving directory /netdata/maxcoyle/software/Augustus/auxprogs' make: *** [all] Error 2`

I have a local installation of BamTools on the server and I have edited the bam2hints Makefile to point to that:

BAMTOOLS = /netdata/maxcoyle/software/bamtools-master/usr/local INCLUDES = $(BAMTOOLS)/include/bamtools LIBS = $(BAMTOOLS)/lib/libbamtools.a -lz SOURCES = bam2hints.cc OBJECTS = $(SOURCES:.cc=.o) CXXFLAGS += -Wall -O2 # -g -p -g -ggdb

I have also tried adding /api to the end of the INCLUDES variable since the BamReader.h is actually in the api sub-folder but this doesn't help either. I tried adding all permissions to the .h file as well in case that was necessary.

I'm not sure why it's not recognizing that the BamReader.h is in fact in the specified path! Any help would be greatly greatly appreciated!

Thanks, Max

MaxCoyle4 avatar Nov 12 '20 03:11 MaxCoyle4

I am having the same issue, I am able to point to the correct file and I have verified that it exists but no matter how many times I try, I am unable to get this software to compile.

aliceseaborn avatar Jan 27 '21 01:01 aliceseaborn

I confirm, the bam2hints Makefile is still a problem @MarioStanke @hmehlan @sherbold . On CentOS, I am also using a custom Makefile.

Mine looks like this, hope that helps @Adial314 and @MaxCoyle4 (my Augustus lives in ${HOME}/git/Augustus):

BAMTOOLS = ${HOME}/git/bamtools/build/src/api


INCLUDES = -I $(BAMTOOLS)/include -I $(BAMTOOLS)/../include
LIBS = $(BAMTOOLS)/libbamtools.a -lz

SOURCES = bam2hints.cc 
OBJECTS = $(SOURCES:.cc=.o)
CXXFLAGS += -Wall -O2 # -g -p -g -ggdb 

LINK.cc ?= g++

# Recipe(s)
# $@: full target name of current target. 
# $<: .c file of target. 
bam2hints : $(OBJECTS) 
        $(LINK.cc) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $(OBJECTS) $(LIBS)
        mkdir -p ../../bin
        cp bam2hints ../../bin

all:$(OBJECTS) # Compiles each foo.cc into foo.o

bam2hints.o : $(SOURCES)
        $(LINK.cc) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@ $(INCLUDES) 

clean:
        rm -f bam2hints.o bam2hints ../../bin/bam2hints

KatharinaHoff avatar Jan 27 '21 13:01 KatharinaHoff

Also having major troubles with this - the README provided with Augustus (last edited 6 years ago by @KatharinaHoff ) to guide in making a custom Makefile does no good with a manual installation of bamtools today. I also have no luck when changing the variables to mirror what is given in the above post.

This is a major issue, as without this sorted one can't use a manual installation of Augustus and therefore BRAKER on a cluster environment (I'm on CentOS). I've also had no luck with the bioconda braker2 package (which currently, running after successful installation, seems to expect a 'sortGeneMark.py' in the conda env directory, where none exists).

My manual bamtools installation seems to go off without any problems following the guidance in the wiki - see the attached for the directory structure. Would be very grateful for some attention to this - I'm not familiar with C++ so making a new Makefile for bam2hints following manual bamtools installation would be very difficult on my own.

bamtools.tree.txt

claumer avatar Apr 07 '21 11:04 claumer

Your directory stucture looks similar to mine. libbamtools.a resides where it should, there's an include directory where it should be. You need to adapt the first line

BAMTOOLS = ${HOME}/git/bamtools/build/src/api

to point to your bamtools/build/src/api directory.

KatharinaHoff avatar Apr 07 '21 12:04 KatharinaHoff

Thank you for your quick response!

I have, I think, tried to modify the makefile to resemble yours. I put bamtools within my Augustus install directory on an nfs drive but otherwise it's similar:


BAMTOOLS = /nfs/research1/marioni/claumer/Augustus/bamtools/build/src/api INCLUDES = -I $(BAMTOOLS)/include -I $(BAMTOOLS)/../include LIBS = $(BAMTOOLS)/libbamtools.a -lz SOURCES = bam2hints.cc OBJECTS = $(SOURCES:.cc=.o) CXXFLAGS += -Wall -O2 # -g -p -g -ggdb

LINK.cc ?= g++

Recipe(s)

$@: full target name of current target.

$<: .c file of target.

bam2hints : $(OBJECTS) $(LINK.cc) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $(OBJECTS) $(LIBS) mkdir -p ../../bin cp bam2hints ../../bin

all:$(OBJECTS) # Compiles each foo.cc into foo.o

bam2hints.o : $(SOURCES) $(LINK.cc) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@ $(INCLUDES)

clean: rm -f bam2hints.o bam2hints ../../bin/bam2hints


But after this when I try to compile I still see the BamReader.h missing error:

(base) [claumer@noah-login-01 bam2hints]$ make /nfs/research1/marioni/claumer/miniconda3/bin/x86_64-conda_cos6-linux-gnu-c++ -fvisibility-inlines-hidden -std=c++17 -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /nfs/research1/marioni/claumer/miniconda3/include -Wall -O2 -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /nfs/research1/marioni/claumer/miniconda3/include -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,--disable-new-dtags -Wl,--gc-sections -Wl,-rpath,/nfs/research1/marioni/claumer/miniconda3/lib -Wl,-rpath-link,/nfs/research1/marioni/claumer/miniconda3/lib -L/nfs/research1/marioni/claumer/miniconda3/lib -fvisibility-inlines-hidden -std=c++17 -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /nfs/research1/marioni/claumer/miniconda3/include -Wall -O2 -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /nfs/research1/marioni/claumer/miniconda3/include -c bam2hints.cc -o bam2hints.o -I /nfs/research1/marioni/claumer/Augustus/bamtools/build/src/api/include -I /nfs/research1/marioni/claumer/Augustus/bamtools/build/src/api/../include bam2hints.cc:16:10: fatal error: api/BamReader.h: No such file or directory #include <api/BamReader.h> ^~~~~~~~~~~~~~~~~ compilation terminated. make: *** [Makefile:31: bam2hints.o] Error 1

claumer avatar Apr 08 '21 13:04 claumer

Hello @claumer, you mentioned that you had no luck with the bioconda braker2 package. The sortGeneMark.py is a new script but it should be a part of the latest bioconda package (released about a week ago). Please open an issue in BRAKER2 repository with more details, I'll be happy to help with this further.

tomasbruna avatar Apr 08 '21 23:04 tomasbruna

Hello @MaxCoyle4,

you were right in adding "/bamtools" to the INCLUDES variable, but you still missed the leading "-I". The README file missed both. Sorry.

Please change your INCLUDES = $(BAMTOOLS)/include/bamtools into INCLUDES = -I $(BAMTOOLS)/include/bamtools

@claumer Please try to change INCLUDES = -I $(BAMTOOLS)/include -I $(BAMTOOLS)/../include into INCLUDES = -I $(BAMTOOLS)/include/bamtools -I $(BAMTOOLS)/../include/bamtools

Additionally the README file doesn't mentioned the last install step of bamtools: $ make DESTDIR=/my/stage/dir install ( or if the directory was mentioned in the previous cmake call just call $ make install )

I suppose you haven't done this step, as your BAMTOOLS variable ends with /build/src/api.

Edit: All INCLUDES and LIBRARY paths can now be set in commons.mk alone.

Please try a new installation according to the instructions in README and docs/INSTALL.md .

hmehlan avatar Apr 14 '21 17:04 hmehlan