Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while compailing for raspberry pi "error: no matching function for call to ‘min(size_t&, long unsigned int)’" #2330

Closed
overclock98 opened this issue Jun 18, 2020 · 7 comments

Comments

@overclock98
Copy link

I'm trying to build torchvision on raspberry pi but getting thiss error. how can i fix?

/home/pi/vision/torchvision/csrc/cpu/decoder/seekable_buffer.cpp:58:47: error: no matching function for call to ‘min(size_t&, long unsigned int)’
buffer_.resize(std::min(maxBytes, 4 * 1024UL));
^
In file included from /usr/include/c++/8/bits/char_traits.h:39,
from /usr/include/c++/8/string:40,
from /usr/include/c++/8/stdexcept:39,
from /usr/include/c++/8/array:39,
from /home/pi/vision/torchvision/csrc/cpu/decoder/defs.h:3,
from /home/pi/vision/torchvision/csrc/cpu/decoder/seekable_buffer.h:3,
from /home/pi/vision/torchvision/csrc/cpu/decoder/seekable_buffer.cpp:1:
/usr/include/c++/8/bits/stl_algobase.h:195:5: note: candidate: ‘template constexpr const _Tp& std::min(const _Tp&, const _Tp&)’
min(const _Tp& __a, const _Tp& __b)
^~~
/usr/include/c++/8/bits/stl_algobase.h:195:5: note: template argument deduction/substitution failed:
/home/pi/vision/torchvision/csrc/cpu/decoder/seekable_buffer.cpp:58:47: note: deduced conflicting types for parameter ‘const Tp’ (‘unsigned int’ and ‘long unsigned int’)
buffer
.resize(std::min(maxBytes, 4 * 1024UL));
^
In file included from /usr/include/c++/8/bits/char_traits.h:39,
from /usr/include/c++/8/string:40,
from /usr/include/c++/8/stdexcept:39,
from /usr/include/c++/8/array:39,
from /home/pi/vision/torchvision/csrc/cpu/decoder/defs.h:3,
from /home/pi/vision/torchvision/csrc/cpu/decoder/seekable_buffer.h:3,
from /home/pi/vision/torchvision/csrc/cpu/decoder/seekable_buffer.cpp:1:
/usr/include/c++/8/bits/stl_algobase.h:243:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)’
min(const _Tp& __a, const _Tp& __b, _Compare __comp)
^~~
/usr/include/c++/8/bits/stl_algobase.h:243:5: note: template argument deduction/substitution failed:
/home/pi/vision/torchvision/csrc/cpu/decoder/seekable_buffer.cpp:58:47: note: deduced conflicting types for parameter ‘const Tp’ (‘unsigned int’ and ‘long unsigned int’)
buffer
.resize(std::min(maxBytes, 4 * 1024UL));
^
In file included from /usr/include/c++/8/algorithm:62,
from /home/pi/.local/lib/python3.7/site-packages/torch/include/c10/util/Registry.h:12,
from /home/pi/.local/lib/python3.7/site-packages/torch/include/c10/util/Flags.h:36,
from /home/pi/.local/lib/python3.7/site-packages/torch/include/c10/util/Logging.h:12,
from /home/pi/vision/torchvision/csrc/cpu/decoder/seekable_buffer.cpp:2:
/usr/include/c++/8/bits/stl_algo.h:3450:5: note: candidate: ‘template constexpr _Tp std::min(std::initializer_list<_Tp>)’
min(initializer_list<_Tp> __l)
^~~
/usr/include/c++/8/bits/stl_algo.h:3450:5: note: template argument deduction/substitution failed:
/home/pi/vision/torchvision/csrc/cpu/decoder/seekable_buffer.cpp:58:47: note: mismatched types ‘std::initializer_list<Tp>’ and ‘unsigned int’
buffer
.resize(std::min(maxBytes, 4 * 1024UL));
^
In file included from /usr/include/c++/8/algorithm:62,
from /home/pi/.local/lib/python3.7/site-packages/torch/include/c10/util/Registry.h:12,
from /home/pi/.local/lib/python3.7/site-packages/torch/include/c10/util/Flags.h:36,
from /home/pi/.local/lib/python3.7/site-packages/torch/include/c10/util/Logging.h:12,
from /home/pi/vision/torchvision/csrc/cpu/decoder/seekable_buffer.cpp:2:
/usr/include/c++/8/bits/stl_algo.h:3456:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)’
min(initializer_list<Tp> l, Compare comp)
^~~
/usr/include/c++/8/bits/stl_algo.h:3456:5: note: template argument deduction/substitution failed:
/home/pi/vision/torchvision/csrc/cpu/decoder/seekable_buffer.cpp:58:47: note: mismatched types ‘std::initializer_list<Tp>’ and ‘unsigned int’
buffer
.resize(std::min(maxBytes, 4 * 1024UL));
^
/home/pi/vision/torchvision/csrc/cpu/decoder/seekable_buffer.cpp:69:24: warning: comparison of integer expressions of different signedness: ‘long int’ and ‘size_t’ {aka ‘unsigned int’} [-Wsign-compare]
while (!eof
&& end
< maxBytes && (hasTime = watcher())) {
~~~~~^~~~~~~~~~
/home/pi/vision/torchvision/csrc/cpu/decoder/seekable_buffer.cpp:74:16: warning: comparison of integer expressions of different signedness: ‘long int’ and ‘std::vector::size_type’ {aka ‘unsigned int’} [-Wsign-compare]
if (end == buffer.size()) {
~~~~~^~~~~~~~~~~~~~~~~
/home/pi/vision/torchvision/csrc/cpu/decoder/seekable_buffer.cpp:75:53: error: no matching function for call to ‘min(long unsigned int, size_t&)’
buffer.resize(std::min(end * 4UL, maxBytes));
^
In file included from /usr/include/c++/8/bits/char_traits.h:39,
from /usr/include/c++/8/string:40,
from /usr/include/c++/8/stdexcept:39,
from /usr/include/c++/8/array:39,
from /home/pi/vision/torchvision/csrc/cpu/decoder/defs.h:3,
from /home/pi/vision/torchvision/csrc/cpu/decoder/seekable_buffer.h:3,
from /home/pi/vision/torchvision/csrc/cpu/decoder/seekable_buffer.cpp:1:
/usr/include/c++/8/bits/stl_algobase.h:195:5: note: candidate: ‘template constexpr const _Tp& std::min(const _Tp&, const _Tp&)’
min(const _Tp& __a, const _Tp& _b)
^~~
/usr/include/c++/8/bits/stl_algobase.h:195:5: note: template argument deduction/substitution failed:
/home/pi/vision/torchvision/csrc/cpu/decoder/seekable_buffer.cpp:75:53: note: deduced conflicting types for parameter ‘const Tp’ (‘long unsigned int’ and ‘size_t’ {aka ‘unsigned int’})
buffer
.resize(std::min(end
* 4UL, maxBytes));
^
In file included from /usr/include/c++/8/bits/char_traits.h:39,
from /usr/include/c++/8/string:40,
from /usr/include/c++/8/stdexcept:39,
from /usr/include/c++/8/array:39,
from /home/pi/vision/torchvision/csrc/cpu/decoder/defs.h:3,
from /home/pi/vision/torchvision/csrc/cpu/decoder/seekable_buffer.h:3,
from /home/pi/vision/torchvision/csrc/cpu/decoder/seekable_buffer.cpp:1:
/usr/include/c++/8/bits/stl_algobase.h:243:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)’
min(const _Tp& __a, const _Tp& __b, _Compare _comp)
^~~
/usr/include/c++/8/bits/stl_algobase.h:243:5: note: template argument deduction/substitution failed:
/home/pi/vision/torchvision/csrc/cpu/decoder/seekable_buffer.cpp:75:53: note: deduced conflicting types for parameter ‘const Tp’ (‘long unsigned int’ and ‘size_t’ {aka ‘unsigned int’})
buffer
.resize(std::min(end
* 4UL, maxBytes));
^
In file included from /usr/include/c++/8/algorithm:62,
from /home/pi/.local/lib/python3.7/site-packages/torch/include/c10/util/Registry.h:12,
from /home/pi/.local/lib/python3.7/site-packages/torch/include/c10/util/Flags.h:36,
from /home/pi/.local/lib/python3.7/site-packages/torch/include/c10/util/Logging.h:12,
from /home/pi/vision/torchvision/csrc/cpu/decoder/seekable_buffer.cpp:2:
/usr/include/c++/8/bits/stl_algo.h:3450:5: note: candidate: ‘template constexpr _Tp std::min(std::initializer_list<_Tp>)’
min(initializer_list<_Tp> _l)
^~~
/usr/include/c++/8/bits/stl_algo.h:3450:5: note: template argument deduction/substitution failed:
/home/pi/vision/torchvision/csrc/cpu/decoder/seekable_buffer.cpp:75:53: note: mismatched types ‘std::initializer_list<Tp>’ and ‘long unsigned int’
buffer
.resize(std::min(end
* 4UL, maxBytes));
^
In file included from /usr/include/c++/8/algorithm:62,
from /home/pi/.local/lib/python3.7/site-packages/torch/include/c10/util/Registry.h:12,
from /home/pi/.local/lib/python3.7/site-packages/torch/include/c10/util/Flags.h:36,
from /home/pi/.local/lib/python3.7/site-packages/torch/include/c10/util/Logging.h:12,
from /home/pi/vision/torchvision/csrc/cpu/decoder/seekable_buffer.cpp:2:
/usr/include/c++/8/bits/stl_algo.h:3456:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)’
min(initializer_list<_Tp> __l, _Compare _comp)
^~~
/usr/include/c++/8/bits/stl_algo.h:3456:5: note: template argument deduction/substitution failed:
/home/pi/vision/torchvision/csrc/cpu/decoder/seekable_buffer.cpp:75:53: note: mismatched types ‘std::initializer_list<Tp>’ and ‘long unsigned int’
buffer
.resize(std::min(end
* 4UL, maxBytes));
^
error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

@overclock98 overclock98 changed the title Error while compailing for raspberry pi Error while compailing for raspberry pi "error: no matching function for call to ‘min(size_t&, long unsigned int)’" Jun 18, 2020
@overclock98
Copy link
Author

issue solved.

https://github.com/nmilosev/pytorch-arm-builds/blob/master/pytorch-armv7hl.sh

I updated the packages and flags mentioned in the above file, that's it ¯_(ツ)_/¯

@jekriske-lilly
Copy link
Contributor

jekriske-lilly commented Jul 2, 2020

So your solution was to drop the version to 0.4.0?

For me, I had to explicitly cast to size_t (preferred) or uint at:

https://github.com/pytorch/vision/blob/master/torchvision/csrc/cpu/decoder/seekable_buffer.cpp#L58
https://github.com/pytorch/vision/blob/master/torchvision/csrc/cpu/decoder/seekable_buffer.cpp#L75
and
https://github.com/pytorch/vision/blob/master/torchvision/csrc/cpu/decoder/util.cpp#L398-L399

@fmassa
Copy link
Member

fmassa commented Jul 3, 2020

@jekriske-lilly can you send a PR with the casts that you mentioned?

@jekriske-lilly
Copy link
Contributor

@fmassa Created #2389

@fmassa
Copy link
Member

fmassa commented Jul 6, 2020

Merged #2389, so this should hopefully fix the issues that @overclock98 was seeing.

@DoubleJ9279
Copy link

@jekriske-lilly
Copy link
Contributor

@DoubleJ9279 yes the changes were merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants