brewsci / homebrew-bio

:beer::microscope: Bioinformatics formulae for the Homebrew package manager (macOS and Linux)
http://brewsci.github.io/homebrew-bio
Other
306 stars 119 forks source link

Error installing vcflib #1463

Closed alexreg closed 2 years ago

alexreg commented 2 years ago

Output of brew install brewsci/bio/vcflib is the following.

==> Cloning https://github.com/ekg/vcflib.git
Updating /Users/alex/Library/Caches/Homebrew/vcflib--git
==> Checking out tag v1.0.1
HEAD is now at d150a89 Add C++0x badge
HEAD is now at d150a89 Add C++0x badge
Entering 'fastahack'
Entering 'filevercmp'
Entering 'fsom'
Entering 'googletest'
Entering 'intervaltree'
Entering 'libVCFH'
Entering 'multichoose'
Entering 'smithwaterman'
Entering 'tabixpp'
Synchronizing submodule url for 'htslib'
Entering 'tabixpp/htslib'
/Users/alex/Library/Caches/Homebrew/vcflib--git/fastahack
/Users/alex/Library/Caches/Homebrew/vcflib--git/filevercmp
/Users/alex/Library/Caches/Homebrew/vcflib--git/fsom
/Users/alex/Library/Caches/Homebrew/vcflib--git/googletest
/Users/alex/Library/Caches/Homebrew/vcflib--git/intervaltree
/Users/alex/Library/Caches/Homebrew/vcflib--git/libVCFH
/Users/alex/Library/Caches/Homebrew/vcflib--git/multichoose
/Users/alex/Library/Caches/Homebrew/vcflib--git/smithwaterman
/Users/alex/Library/Caches/Homebrew/vcflib--git/tabixpp
/Users/alex/Library/Caches/Homebrew/vcflib--git/tabixpp/htslib
==> Installing vcflib from brewsci/bio
==> make
Last 15 lines from /Users/alex/Library/Logs/Homebrew/vcflib/01.make:
gcc-11 -g -Wall -O2 -I.  -c -o cram/string_alloc.o cram/string_alloc.c
gcc-11 -g -Wall -O2 -I.  -c -o kfunc.o kfunc.c
gcc-11 -g -Wall -O2 -I.  -c -o knetfile.o knetfile.c
gcc-11 -g -Wall -O2 -I.  -c -o kstring.o kstring.c
gcc-11 -g -Wall -O2 -I.  -c -o bcf_sr_sort.o bcf_sr_sort.c
gcc-11 -g -Wall -O2 -I.  -c -o bgzf.o bgzf.c
gcc-11 -g -Wall -O2 -I.  -c -o errmod.o errmod.c
gcc-11 -g -Wall -O2 -I.  -c -o faidx.o faidx.c
gcc-11 -g -Wall -O2 -I.  -c -o hfile.o hfile.c
gcc-11 -g -Wall -O2 -I.  -c -o hfile_net.o hfile_net.c
gcc-11 -g -Wall -O2 -I.  -c -o hts.o hts.c
ar -rc libhts.a kfunc.o knetfile.o kstring.o bcf_sr_sort.o bgzf.o errmod.o faidx.o hfile.o hfile_net.o hts.o md5.o multipart.o probaln.o realn.o regidx.o sam.o synced_bcf_reader.o vcf_sweep.o tbx.o textutils.o thread_pool.o vcf.o vcfutils.o cram/cram_codecs.o cram/cram_decode.o cram/cram_encode.o cram/cram_external.o cram/cram_index.o cram/cram_io.o cram/cram_samtools.o cram/cram_stats.o cram/files.o cram/mFILE.o cram/open_trace_file.o cram/pooled_alloc.o cram/rANS_static.o cram/sam_header.o cram/string_alloc.o
ranlib libhts.a
g++-11 -g -Wall -O2 -fPIC  -o tabix++ main.cpp tabix.o -I/private/tmp/vcflib-20211226-94802-xp20zo/tabixpp/htslib -L. -L/private/tmp/vcflib-20211226-94802-xp20zo/tabixpp/htslib -lhts -lbz2 -lm -lz -llzma -pthread \
        -lhts -lpthread -lm -lbz2 -llzma -lz

If reporting this issue please do so at (not Homebrew/brew or Homebrew/core):
  https://github.com/brewsci/homebrew-bio/issues

From the build output file, it looks like this is the problem.

fatal error: emmintrin.h: No such file or directory

Full Logs

th-of commented 2 years ago

Looks like you are trying to compile for ARM, emmintrin.h is header file for SSE2 intrinsics, SSE2 is an instruction set on Intel/x86-64 CPUs. If you feel competent you can try to replace emmintrin.h with sse2neon (sse2neon.h).

alexreg commented 2 years ago

@th-of Thanks. Upstream or in the cask, you mean?

th-of commented 2 years ago

You would have to download and compile the source. But that seems impossible at the moment, just forget my comment.

alexreg commented 2 years ago

Why impossible, may I ask?

th-of commented 2 years ago

I can't get it to compile here. First error: fatal error: 'tabix.hpp' file not found This is supposed to fix it: https://github.com/Niema-Docker/freebayes/blob/main/Dockerfile#L8-L28 But I can't compile that either: fatal error: 'lzma.h' file not found Even though all all the dependencies are correctly installed.

alexreg commented 2 years ago

Okay, I've got everything building nicely on my end. (N.B., This uses brew's version of htslib rather than the bundled one, which I think is the intention.)

First, apply this patch.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8ec8f9c..f5ad5a8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -52,6 +52,9 @@ endif(GPROF)

 # ---- Include files

+include_directories(/opt/homebrew/include /usr/local/include)
+link_directories(/opt/homebrew/lib /usr/local/lib)
+
 include_directories(include)
 include_directories(fastahack)
 include_directories(intervaltree)

Then to build, run this script which should be placed in the root dir of the vcflib repo.

#!/bin/bash

mkdir -p build &&
cd build &&

{ rm -Rf tabixpp; true; } &&
git clone https://github.com/ekg/tabixpp.git --branch v1.1.0 &&
cd tabixpp &&
make INCLUDES=-I/opt/homebrew/include LIBPATH="-L. -L/opt/homebrew/lib" HTS_HEADERS= HTS_LIB= &&
g++ -g -Wall -O2 -fPIC -I/opt/homebrew/include -L. -L/opt/homebrew/lib -lhts -lpthread -lm -lbz2 -llzma -lz tabix.o -shared -o libtabixpp.so &&
sudo install -p -m 644 libtabixpp.so /usr/local/lib &&
sudo install -p -m 644 tabix.hpp /usr/local/include &&

cd .. &&
cmake .. &&
cmake --build . &&
sudo cmake --install . &&

exit 0
alexreg commented 2 years ago

FYI, seems that emmintrin.h is bundled with clang on my system.

/opt/homebrew//Cellar/llvm/13.0.0_2/lib/clang/13.0.0/include/emmintrin.h

Not sure we can have the formula build using brew's llvm though...