amplab / snap

Scalable Nucleotide Alignment Program -- a fast and accurate read aligner for high-throughput sequencing data
https://www.microsoft.com/en-us/research/project/snap/
Apache License 2.0
288 stars 66 forks source link

compilation problem on Snow leopard Mac osx in SortedDataWriter.cpp #51

Closed pcantalupo closed 9 years ago

pcantalupo commented 9 years ago

Hello,

Just tried to compile SNAP with latest code but got following error:

++ -O3 -Wno-format -MMD -ISNAPLib -msse   -c -o SNAPLib/SortedDataWriter.o SNAPLib/SortedDataWriter.cpp
SNAPLib/SortedDataWriter.cpp: In member function 'bool SortedDataFilterSupplier::mergeSort()':
SNAPLib/SortedDataWriter.cpp:338:70: error: no matching function for call to 'max(long unsigned int, long long unsigned int)'
             min(1UL << 23, max(1UL << 17, bufferSpace / blocks.size()))); // 128kB to 8MB buffer space per block
                                                                      ^
SNAPLib/SortedDataWriter.cpp:338:70: note: candidates are:
In file included from /usr/local/homebrew/Cellar/gcc/4.9.2_1/include/c++/4.9.2/algorithm:61:0,
                 from SNAPLib/stdafx.h:13,
                 from SNAPLib/SortedDataWriter.cpp:19:
/usr/local/homebrew/Cellar/gcc/4.9.2_1/include/c++/4.9.2/bits/stl_algobase.h:261:5: note: template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^
/usr/local/homebrew/Cellar/gcc/4.9.2_1/include/c++/4.9.2/bits/stl_algobase.h:261:5: note:   template argument deduction/substitution failed:
SNAPLib/SortedDataWriter.cpp:338:70: note:   deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'long long unsigned int')
             min(1UL << 23, max(1UL << 17, bufferSpace / blocks.size()))); // 128kB to 8MB buffer space per block
                                                                      ^
In file included from /usr/local/homebrew/Cellar/gcc/4.9.2_1/include/c++/4.9.2/algorithm:61:0,
                 from SNAPLib/stdafx.h:13,
                 from SNAPLib/SortedDataWriter.cpp:19:
/usr/local/homebrew/Cellar/gcc/4.9.2_1/include/c++/4.9.2/bits/stl_algobase.h:217:5: note: template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)
     max(const _Tp& __a, const _Tp& __b)
     ^
/usr/local/homebrew/Cellar/gcc/4.9.2_1/include/c++/4.9.2/bits/stl_algobase.h:217:5: note:   template argument deduction/substitution failed:
SNAPLib/SortedDataWriter.cpp:338:70: note:   deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'long long unsigned int')
             min(1UL << 23, max(1UL << 17, bufferSpace / blocks.size()))); // 128kB to 8MB buffer space per block
                                                                      ^
make: *** [SNAPLib/SortedDataWriter.o] Error 1

Is this related to the previous problem that I had https://github.com/amplab/snap/issues/40#issuecomment-99205239?

Thank you

jakewendt commented 9 years ago

I changed SNAPLib/SortedDataWriter.cpp line 338 from ...

min(1UL << 23, max(1UL << 17, bufferSpace / blocks.size())));

... to ...

min(1UL << 23, max<long unsigned>(1UL << 17, bufferSpace / blocks.size())));

and it compiled.

pcantalupo commented 9 years ago

That worked for me. Thank you muchly :+1: