jts / sga

de novo sequence assembler using string graphs
http://genome.cshlp.org/content/22/3/549
237 stars 82 forks source link

./configure Cannot find sparsehash on Mac OS X #77

Closed noporpoise closed 10 years ago

noporpoise commented 10 years ago

When running ./configure --with-sparsehash=<...> I get the message: configure: error: google sparse hash library is required.

montag:src isaac$ ./configure --with-sparsehash=/Users/isaac/Applications/sparsehash-2.0.2/src/
checking for a BSD-compatible install... /opt/local/bin/ginstall -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /opt/local/bin/gmkdir -p
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of g++... gcc3
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for ranlib... ranlib
checking how to run the C++ preprocessor... g++ -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking zlib.h usability... yes
checking zlib.h presence... yes
checking for zlib.h... yes
checking for library containing gzopen... -lz
checking for library containing clock_gettime... no
checking for OpenMP flag of C++ compiler... -fopenmp
checking for host type... warning: multi-threading is not available since OSX does not support un-named pthread semaphores.
checking google/sparse_hash_set usability... no
checking google/sparse_hash_set presence... no
checking for google/sparse_hash_set... no
configure: error: google sparse hash library is required: http://code.google.com/p/google-sparsehash/
jts commented 10 years ago

Hi Isaac,

Did you run configure && make && make install on sparsehash? You need to point --with-sparsehash to the directory that you installed to.

Jared

noporpoise commented 10 years ago

Hi Jared,

It looks like sparsehash installed into /usr/local/include/sparsehash, but running ./configure --with-sparsehash=/usr/local/include/sparsehash gives me the same error.

Isaac

jts commented 10 years ago

Hi Isaac,

In this case I think giving the root directory (--with-sparsehash=/usr/local) should work.

Jared

noporpoise commented 10 years ago

Hi Jared,

Thank you for the quick reply - that seems to work. Now I'm hitting an issue with linking to bamtools:

./configure --with-sparsehash=/usr/local --with-bamtools=/usr/local
...
Making all in SGA
g++ -Wall -Wextra  -Wno-unknown-pragmas -O3 -pthread -fopenmp  -Wl,-rpath,/usr/local/lib -L/usr/local/lib -Wl,-rpath,/usr/local/lib/bamtools -L/usr/local/lib/bamtools -L/opt/local/lib -o sga sga-sga.o sga-index.o sga-overlap.o sga-assemble.o sga-correct.o sga-oview.o sga-preprocess.o sga-rmdup.o sga-merge.o sga-subgraph.o sga-scaffold.o sga-scaffold2fasta.o sga-connect.o sga-walk.o sga-filter.o sga-kmer-count.o sga-stats.o sga-fm-merge.o sga-gmap.o sga-filterBAM.o sga-cluster.o sga-gen-ssa.o sga-bwt2fa.o sga-graph-diff.o sga-graph-concordance.o sga-gapfill.o sga-preqc.o sga-variant-detectability.o sga-rewrite-evidence-bam.o sga-somatic-variant-filters.o sga-haplotype-filter.o sga-OverlapCommon.o ../Scaffold/libscaffold.a ../GraphDiff/libgraphdiff.a ../StringGraph/libstringgraph.a ../Concurrency/libconcurrency.a ../Algorithm/libalgorithm.a ../SuffixTools/libsuffixtools.a ../Bigraph/libbigraph.a ../Util/libutil.a ../SQG/libsqg.a ../Thirdparty/libthirdparty.a -lz  -lbamtools
Undefined symbols for architecture x86_64:
  "BamTools::BamReader::Open(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
      connectMain(int, char**) in sga-connect.o
      filterBAMMain(int, char**) in sga-filterBAM.o
      rewriteEvidenceBAMMain(int, char**) in sga-rewrite-evidence-bam.o
      somaticVariantFiltersMain(int, char**) in sga-somatic-variant-filters.o
  "BamTools::BamWriter::Open(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, BamTools::SamHeader const&, std::vector<BamTools::RefData, std::allocator<BamTools::RefData> > const&)", referenced from:
      GraphCompareAggregateResults::GraphCompareAggregateResults(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, ReadTable const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in libgraphdiff.a(libgraphdiff_a-GraphCompare.o)
      GraphCompareAggregateResults::GraphCompareAggregateResults(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, ReadTable const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in libgraphdiff.a(libgraphdiff_a-GraphCompare.o)
  "BamTools::BamWriter::Open(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<BamTools::RefData, std::allocator<BamTools::RefData> > const&)", referenced from:
      filterBAMMain(int, char**) in sga-filterBAM.o
      rewriteEvidenceBAMMain(int, char**) in sga-rewrite-evidence-bam.o
  "BamTools::SamHeader::SamHeader(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
      GraphCompareAggregateResults::GraphCompareAggregateResults(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, ReadTable const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in libgraphdiff.a(libgraphdiff_a-GraphCompare.o)
      GraphCompareAggregateResults::GraphCompareAggregateResults(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, ReadTable const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in libgraphdiff.a(libgraphdiff_a-GraphCompare.o)
  "BamTools::BamAlignment::SetErrorString(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const", referenced from:
      getErrorRate(BamTools::BamAlignment&)       in sga-filterBAM.o
  "BamTools::BamAlignment::FindTag(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char*&, unsigned int const&, unsigned int&) const", referenced from:
      getErrorRate(BamTools::BamAlignment&)       in sga-filterBAM.o
  "BamTools::BamReader::GetReferenceID(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const", referenced from:
      getVariantCoverage(BamTools::BamReader*, VCFRecord const&, ReadTable const*) in sga-somatic-variant-filters.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make[2]: *** [sga] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

If I look in /usr/local/ bamtools is installed:

isaac$ ls /usr/local/lib/bamtools/
libbamtools.2.3.0.dylib libbamtools.a       libbamtools.dylib

Thanks for the help, Isaac

jts commented 10 years ago

The link flag is being set correctly (-L/usr/local/lib/bamtools) so I don't know why its not linking. On my OSX laptop I've installed bamtools using homebrew which goes into /usr/local/lib. This builds correctly.

jts commented 10 years ago

What version of g++ are you using? It appears to support OpenMP, which I didn't know was available on OS X.

noporpoise commented 10 years ago
isaac$ g++ --version
g++ (MacPorts gcc48 4.8.2_2) 4.8.2
jts commented 10 years ago

Hmm. I'm reading some reports of link errors in OSX 10.9 caused by a change to the C++ standard library implementation. Are you on 10.9?

On Tue, Aug 5, 2014 at 7:42 PM, Isaac Turner notifications@github.com wrote:

isaac$ g++ --version g++ (MacPorts gcc48 4.8.2_2) 4.8.2

— Reply to this email directly or view it on GitHub https://github.com/jts/sga/issues/77#issuecomment-51275635.

noporpoise commented 10 years ago

Yes, I'm on Mac OS X 10.9.4

jts commented 10 years ago

Thanks. Was bamtools compiled with the same version of gcc? Can you run otool -hv -arch all /usr/local/lib/bamtools/libbamtools.a?

noporpoise commented 10 years ago
isaac$ lipo -info /usr/local/lib/bamtools/libbamtools.a
input file /usr/local/lib/bamtools/libbamtools.a is not a fat file
Non-fat file: /usr/local/lib/bamtools/libbamtools.a is architecture: x86_64
noporpoise commented 10 years ago

Fixed! Bamtools cmake was choosing a different compiler. Setting compilers with:

export CC=/opt/local/bin/gcc
export CXX=/opt/local/bin/g++

before compiling Bamtools fixed the issue when linking SGA.

Many thanks Jared.

Isaac

jts commented 10 years ago

Aha! Very glad to hear it.

noporpoise commented 10 years ago

A note for others using a mac: I had to add the following to ~/.profile

export DYLD_LIBRARY_PATH=/usr/local/lib/bamtools:${DYLD_LIBRARY_PATH}

Otherwise sga fails with the error:

dyld: Library not loaded: libbamtools.2.3.0.dylib
  Referenced from: /Users/isaac/bioinf/sga/src/./SGA/sga
  Reason: image not found
Trace/BPT trap: 5