# OpenCV-2.3.1_5 fails to compile



## srobert (Jan 9, 2013)

I'm trying to install graphics/opencv under FreeBSD 9.1. 
I've tried deinstalling the dependencies, updating the ports tree, and then reinstalling each dependency after a *make config* on each.
But it's still failing in the same spot.
*pkg-add -r opencv* couldn't find it. 
I searched ftp under 9-stable and only found a previous version incompatible with the already installed ports.
Here's the output:

```
[root@Acer /usr/ports/graphics/opencv]# make install clean
===>  Building for opencv-2.3.1_5
[  1%] Built target opencv_highgui_pch_dephelp
[  2%] Built target pch_Generate_opencv_highgui
[  6%] Built target opencv_highgui
[  7%] Built target opencv_features2d_pch_dephelp
[  8%] Built target pch_Generate_opencv_features2d
[ 13%] Built target opencv_features2d
[ 13%] Built target opencv_calib3d_pch_dephelp
[ 14%] Built target pch_Generate_opencv_calib3d
[ 18%] Built target opencv_calib3d
[ 18%] Built target opencv_test_calib3d_pch_dephelp
[ 18%] Built target pch_Generate_opencv_test_calib3d
Linking CXX executable ../../bin/opencv_test_calib3d
/usr/local/lib/libopencv_imgproc.so: undefined reference 
to `cv::mulSpectrums(cv::_InputArray const&, 
cv::_InputArray const&, cv::_OutputArray const&, int, bool)'
/usr/local/lib/libopencv_imgproc.so: undefined reference 
to `cv::getOptimalDFTSize(int)'
/usr/local/lib/libopencv_imgproc.so: undefined reference 
to `cv::dft(cv::_InputArray const&, 
cv::_OutputArray const&, int, int)'
*** [bin/opencv_test_calib3d] Error code 1

Stop in /usr/ports/graphics/opencv/work/OpenCV-2.3.1.
*** [modules/calib3d/CMakeFiles/opencv_test_calib3d.dir/all] Error code 1

Stop in /usr/ports/graphics/opencv/work/OpenCV-2.3.1.
*** [all] Error code 1

Stop in /usr/ports/graphics/opencv/work/OpenCV-2.3.1.
*** [do-build] Error code 1

Stop in /usr/ports/graphics/opencv.
*** [install] Error code 1

Stop in /usr/ports/graphics/opencv.
```

Any suggestions?


----------



## SirDice (Jan 9, 2013)

What's in /etc/make.conf? And did you enable any options?


----------



## srobert (Jan 10, 2013)

/etc/make.conf is simple:

```
CPUTYPE?=core2
# added by use.perl 2013-01-01 11:33:05
PERL_VERSION=5.14.2
```
For opencv itself make config only JPEG, PNG, and V4L were selected. I think those were the defaults.


----------



## srobert (Jan 11, 2013)

*Solution:*

An update: Yesterday, I saw another post in which it was suggested to deinstall /usr/ports/graphics/opencv-core, then rebuild it, reinstall, and then try building /usr/ports/graphics/opencv  again. I tried that yesterday, but it didn't work.  Today I tried that again. This time opencv built and installed OK. The only difference I can think of is, that today I did a make build prior to make install in both opencv-core and then opencv. But I don't think that should've made any difference. Nevertheless it's now installed.


----------

