# Compilation errors

**URL:** <https://forum.opencv.org/t/compilation-errors/14927>\
**Category:** C++\
**Tags:** build, contrib, xphoto\
**Created:** [October 19, 2023, 7:43pm UTC](https://forum.opencv.org/t/compilation-errors/14927 "2023-10-19T19:43:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shersoni](https://avatars.discourse-cdn.com/v4/letter/s/6a8cbe/32.png) [@Shersoni](https://forum.opencv.org/u/Shersoni)\
**Post date:** [October 19, 2023, 7:43pm UTC](https://forum.opencv.org/t/compilation-errors/14927/1 "2023-10-19T19:43:07Z")

</div>

Hello,

I am trying to build OpenCV 4.8.1 on Linux 22.04 on Nvidia 4070 card. The machine has Xeon processor. While enabling CUDA==On, I get the following errors:  
/home/csverma/Downloads/opencv-4.8.1/modules/core/include/opencv2/core/hal/intrin\_sse.hpp:1439:1: note: in expansion of macro ‘OPENCV\_HAL\_IMPL\_SSE\_SHIFT\_OP’  
1439 | OPENCV\_HAL\_IMPL\_SSE\_SHIFT\_OP(v\_uint64x2, v\_int64x2, epi64, v\_srai\_epi64)  
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~  
/home/csverma/Downloads/opencv\_contrib/modules/xphoto/src/grayworld\_white\_balance.cpp:332:26: note: candidate expects 1 argument, 2 provided  
332 | v\_sR1 = v\_shr(v\_mul(v\_sR1, v\_gainR), 16);  
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~  
/home/csverma/Downloads/opencv\_contrib/modules/xphoto/src/grayworld\_white\_balance.cpp:333:26: error: no matching function for call to ‘v\_shr(cv::hal\_baseline::simd128\_cpp::v\_uint32, int)’  
333 | v\_sR2 = v\_shr(v\_mul(v\_sR2, v\_gainR), 16);  
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~  
In file included from /home/csverma/Downloads/opencv-4.8.1/modules/core/include/opencv2/core/hal/intrin.hpp:217,

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [October 19, 2023, 8:10pm UTC](https://forum.opencv.org/t/compilation-errors/14927/2 "2023-10-19T20:10:32Z")

</div>

disable the xphoto module (cmake variables, browse with cmake-gui) and see where that takes you

---

<div class="post-metadata">

**Author:** ![PeterBP](https://avatars.discourse-cdn.com/v4/letter/p/aeb1de/32.png) [@PeterBP](https://forum.opencv.org/u/PeterBP)\
**Post date:** [November 11, 2023, 11:42am UTC](https://forum.opencv.org/t/compilation-errors/14927/3 "2023-11-11T11:42:29Z")

</div>

Same issue here:  
21\>…\OpenCV\opencv\_contrib-4.x\modules\xphoto\src\grayworld\_white\_balance.cpp(285,21): error C2672: ‘v\_shr’: no matching overloaded function found

v4.8.1 with fresh opencv\_contrib download

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [November 11, 2023, 12:26pm UTC](https://forum.opencv.org/t/compilation-errors/14927/4 "2023-11-11T12:26:02Z")

</div>

> <https://github.com/opencv/opencv_contrib/issues/3582>
>
> \##### System information
> \- OpenCV =\> 4.8.1
> \- Operating System / Platform =\> Ub…untu 22.04.3 LTS
> \- Compiler =\> g++ 11.4.0
> \- Cmake =\> 3.27.7
> 
> \##### Detailed description
> 
> When trying to compile OpenCV 4.8.1 with opencv\_contrib repository, the compilation fails due to the module Xphoto :
> 
> \`\`\`
> \[32%\] Building CXX object modules/dnn/CMakeFiles/opencv\_dnn.dir/src/graph\_simplifier.cpp.o
> /home/paul/Downloads/opencv/opencv\_contrib/modules/xphoto/src/grayworld\_white\_balance.cpp: In function ‘void cv::xphoto::applyChannelGains(cv::InputArray, cv::OutputArray, float, float, float)’:
> /home/paul/Downloads/opencv/opencv\_contrib/modules/xphoto/src/grayworld\_white\_balance.cpp:285:26: error: no matching function for call to ‘v\_shr(cv::hal\_baseline::v\_uint16x8, int)’
> 285 | v\_sB1 = v\_shr(v\_mul\_wrap(v\_sB1, v\_gainB), 8);
> | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> In file included from /home/paul/Downloads/opencv/opencv-4.8.1/modules/core/include/opencv2/core/hal/intrin.hpp:217,
> from /home/paul/Downloads/opencv/opencv\_contrib/modules/xphoto/src/grayworld\_white\_balance.cpp:41:
> /home/paul/Downloads/opencv/opencv-4.8.1/modules/core/include/opencv2/core/hal/intrin\_sse.hpp:1427:16: note: candidate: ‘template\<int imm\> cv::hal\_baseline::v\_uint16x8 cv::hal\_baseline::v\_shr(const cv::hal\_baseline::v\_uint16x8&)’
> 1427 | inline \_Tpuvec v\_shr(const \_Tpuvec& a) \\
> | ^ ~~~~
> /home/paul/Downloads/opencv/opencv-4.8.1/modules/core/include/opencv2/core/hal/intrin\_sse.hpp:1437:1: note: in expansion of macro ‘OPENCV\_HAL\_IMPL\_SSE\_SHIFT\_OP’
> 1437 | OPENCV\_HAL\_IMPL\_SSE\_SHIFT\_OP(v\_uint16x8, v\_int16x8, epi16, \_mm\_srai\_epi16)
> | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /home/paul/Downloads/opencv/opencv-4.8.1/modules/core/include/opencv2/core/hal/intrin\_sse.hpp:1427:16: note: template argument deduction/substitution failed:
> 1427 | inline \_Tpuvec v\_shr(const \_Tpuvec& a) \\
> \`\`\`
> 
> !\[Screenshot from 2023-10-23 10-17-29\](https://github.com/opencv/opencv\_contrib/assets/24894685/2ec212cf-dfd6-4d1e-ae3d-6d0e689cc7fb)
> 
> 
> \##### Steps to reproduce
> \`\`\`
> Inside OpenCV-4.8.1 repository directory : 
> rm -rf build
> mkdir build
> cd build 
> cmake .. -DOPENCV\_EXTRA\_MODULES\_PATH=\<path\_to\_opencv\_contrib\_dir\>/modules
> make -j \<number\_of\_cores\>
> \`\`\`

---

<div class="post-metadata">

**Author:** ![PeterBP](https://avatars.discourse-cdn.com/v4/letter/p/aeb1de/32.png) [@PeterBP](https://forum.opencv.org/u/PeterBP)\
**Post date:** [November 11, 2023, 12:46pm UTC](https://forum.opencv.org/t/compilation-errors/14927/5 "2023-11-11T12:46:17Z")

</div>

Thanks.  
-DBUILD\_opencv\_xphoto=OFF  
-DBUILD\_opencv\_optflow=OFF  
-DBUILD\_opencv\_rgbd=OFF  
“solved” my build
