-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Comments
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 ¯_(ツ)_/¯ |
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 |
@jekriske-lilly can you send a PR with the casts that you mentioned? |
Merged #2389, so this should hopefully fix the issues that @overclock98 was seeing. |
it works~ for me |
@DoubleJ9279 yes the changes were merged. |
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
The text was updated successfully, but these errors were encountered: