Nebula icon indicating copy to clipboard operation
Nebula copied to clipboard

Error while compiling

Open srbehera opened this issue 4 years ago • 4 comments
trafficstars

I am getting the following error when I build Nebula i.e. execute make in cpp directory. I am running on my Macbook, so changed g++ to clang++ -Xpreprocessor and also copied stdc++.h to htslib directory (base) behera@Administrators-MacBook-Pro cpp % make

clang++ -Xpreprocessor -std=c++11 -O3 -funroll-loops -fopenmp -I./htslib -c genotyper.cpp -o genotyper.o 
clang++ -Xpreprocessor -std=c++11 -O3 -funroll-loops -fopenmp -I./htslib -c inner.cpp -o inner.o 
inner.cpp:178:87: error: non-constant-expression cannot be narrowed from type 'int' to 'uint16_t' (aka 'unsigned short') in initializer list [-Wc++11-narrowing]
        Locus locus({track.chrom, track.begin, LOCUS_TYPE_INNER, it->left, it->right, it->gc / 5, true}) ;
                                                                                      ^~~~~~~~~~
inner.cpp:178:87: note: insert an explicit cast to silence this issue
        Locus locus({track.chrom, track.begin, LOCUS_TYPE_INNER, it->left, it->right, it->gc / 5, true}) ;
                                                                                      ^~~~~~~~~~
                                                                                      static_cast<uint16_t>( )
1 error generated.
make: *** [inner.o] Error 1

I also tried on our institute cluster, but I got an error while building the htslib. I installed libz using conda install zlib.

(base) [u236519@sug-login1 htslib]$ make
gcc -g -Wall -O2 -fvisibility=hidden -I.  -c -o cram/cram_io.o cram/cram_io.c
cram/cram_io.c:53:10: fatal error: bzlib.h: No such file or directory
 #include <bzlib.h>
          ^~~~~~~~~
compilation terminated.
make: *** [Makefile:162: cram/cram_io.o] Error 1

srbehera avatar Jul 26 '21 16:07 srbehera

The first error (narrowing conversion) should be fixed with the latest commit.

If the compiler can't find your zlib then the headers are not in the search path. You can update your CFLAGS with the path to zlib header (e.g -I/usr/local/conda/zlib) or whatever path they've been installed to.

Parsoa avatar Jul 28 '21 20:07 Parsoa

For the zlib error, I am still confused about updating CFLAGS. Do I just need to add -I/<path>/miniconda3/include?

This is what CFLAGS contains currently

(base) $ echo $CFLAGS
-march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /<path>/miniconda3/include

srbehera avatar Aug 02 '21 06:08 srbehera

I could fix the first error (i.e. building both htslib and Nebula on my Macbook) after installing and correcting the paths for all dependencies. Thanks !! I am still trying to fix the issues on the cluster.

srbehera avatar Aug 02 '21 21:08 srbehera

Sorry for my late response. I'm glad you could fix the issue.

As for your cluster, you should contact your admin and make sure they have all the libraries required by Nebula installed and that they are in standard locations so they can be properly linked to at runtime.

Parsoa avatar Aug 05 '21 02:08 Parsoa