Problem with std::max
Jamaika1 opened this issue · 8 comments
Hi
I can't compile the latest PIK. How to deal with errors in GCC 7.3.0.
In file included from tile_flow.h:38,
from tile_flow.cc:17:
image.h: In member function 'int64_t pik::WrapClamp::operator()(int64_t, int64_t) const':
image.h:606:39: error: no matching function for call to 'max(long int, const int64_t&)'
return std::min(std::max(0L, coord), size - 1L);
^
In file included from c:\msys801\include\c++\8.0.1\algorithm:61,
from tile_flow.h:29,
from tile_flow.cc:17:
c:\msys801\include\c++\7.3.0\bits\stl_algobase.h:219:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
max(const _Tp& __a, const _Tp& __b)
^~~
c:\msys801\include\c++\7.3.0\bits\stl_algobase.h:219:5: note: template argument deduction/substitution failed:
In file included from tile_flow.h:38,
from tile_flow.cc:17:
tile_flow.cc:1406:54: error: no matching function for call to 'max(size_t, long unsigned int)'
num_instances_(std::max(pool->NumThreads(), 1ul)) {
^
In file included from c:\msys801\include\c++\8.0.1\algorithm:61,
from tile_flow.h:29,
from tile_flow.cc:17:
c:\msys801\include\c++\7.3.0\bits\stl_algobase.h:219:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
max(const _Tp& __a, const _Tp& __b)
^~~
c:\msys801\include\c++\7.3.0\bits\stl_algobase.h:219:5: note: template argument deduction/substitution failed:
tile_flow.cc:1406:54: note: deduced conflicting types for parameter 'const _Tp' ('long long unsigned int' and 'long unsigned int')
num_instances_(std::max(pool->NumThreads(), 1ul)) {
^
In file included from c:\msys801\include\c++\8.0.1\algorithm:61,
from tile_flow.h:29,
from tile_flow.cc:17:
c:\msys801\include\c++\8.0.1\bits\stl_algobase.h:265:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
max(const _Tp& __a, const _Tp& __b, _Compare __comp)
^~~
c:\msys801\include\c++\7.3.0\bits\stl_algobase.h:265:5: note: template argument deduction/substitution failed:
tile_flow.cc:1406:54: note: deduced conflicting types for parameter 'const _Tp' ('long long unsigned int' and 'long unsigned int')
num_instances_(std::max(pool->NumThreads(), 1ul)) {
^
In file included from c:\msys801\include\c++\8.0.1\algorithm:62,
from tile_flow.h:29,
from tile_flow.cc:17:
c:\msys801\include\c++\8.0.1\bits\stl_algo.h:3462:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
max(initializer_list<_Tp> __l)
^~~
c:\msys801\include\c++\7.3.0\bits\stl_algo.h:3462:5: note: template argument deduction/substitution failed:
tile_flow.cc:1406:54: note: mismatched types 'std::initializer_list<_Tp>' and 'long long unsigned int'
num_instances_(std::max(pool->NumThreads(), 1ul)) {
^
In file included from c:\msys801\include\c++\8.0.1\algorithm:62,
from tile_flow.h:29,
from tile_flow.cc:17:
c:\msys801\include\c++\7.3.0\bits\stl_algo.h:3468:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
max(initializer_list<_Tp> __l, _Compare __comp)
^~~
c:\msys801\include\c++\7.3.0\bits\stl_algo.h:3468:5: note: template argument deduction/substitution failed:
tile_flow.cc:1406:54: note: mismatched types 'std::initializer_list<_Tp>' and 'long long unsigned int'
num_instances_(std::max(pool->NumThreads(), 1ul)) {
Thank you for reporting this! We'll fix it in the next push. In the meantime, you can replace those two lines with
return std::min(std::max<int64_t>(0, coord), size - 1);
and
num_instances_(std::max<size_t>(pool->NumThreads(), 1)) {
Thanks
I believe this is fixed; if not, please feel free to re-open.
This is fixed, but I don't know, how should codec work properly with gcc?
I use gcc 9.00. I don't know, can newer versions of butteraugli be used? It has other recording.
I have problem with new brotli. The files are missing
I have problem with decoder. It doesn't work.
I have problem with function thread. Does it work with implementation mingw-std-threads-master.zip for Windows.
Interestingly our Travis build uses an ancient GCC 4.8.4 but it compiles fine. What error do you see?
To get Brotli, git submodule init && git submodule update
(as the Makefile says).
What problems do you have with decoder/threads?
I will add opensource and codec pik:
https://www.sendspace.com/file/yhh7rl
The encoder command line:
cpik_google_none.exe input.png output.pik --distance 3.0 --num_threads 0
dpik_google_none.exe --num_threads 0 output.pik output.png
When the number of cores is greater than zero, the encoder doesn't create pik images.
The decoder doesn't want to create files png.
I don't know, there is no specified value zu.
Compressing zu x zu pixels with maximum Butteraugli distance 3.000000, zu threads.
Compressed to zu bytes (0.00 MB/s).
Read zu compressed bytes
Failed to decompress.
I believe the zu format string issue has since been fixed. Is this an older binary?
If you are able to compile and link with -fsanitize=address, and add these after the include guard in status.h: #define PIK_ENABLE_ASSERT
#define PIK_CRASH_ON_ERROR
then we might be able to help diagnose the problem :)
I believe the zu format string issue has since been fixed. Is this an older binary?
Brotli work correct, add patch version 27.06.2018
I have Windows no Linux. A little inconvenience that I will not preview the value of zu.
I add #define PIK_ENABLE_ASSERT
and #define PIK_CRASH_ON_ERROR
I can't add -fsanitize=address for Windows. :(
I has communique error:
Pik assert failed at write_bits.h:47