# Can't compile opencv with ffmpeg



## drhlo (Apr 2, 2010)

I can't compile opencv (from ports) with ffmpeg enabled:
Code:


```
../../../otherlibs/highgui/.libs/libhighgui.so: undefined reference to `sws_scale'
../../../otherlibs/highgui/.libs/libhighgui.so: undefined reference to `sws_getContext'
```

When I got that error I thought compile opencv1.1pre1 from sourceforge, but can't configure it with ffmpeg too.

I need opencv with ffmpeg-enabled.


----------



## avilla@ (Apr 2, 2010)

ehm... those problems were fixed months ago (and they shouldn't be there in opencv 2)... is your ports tree up to date? what versions of ffmpeg and opencv are you trying to build?


----------



## drhlo (Apr 2, 2010)

*can't compile opencv with some options*



			
				xzhayon said:
			
		

> ehm... those problems were fixed months ago (and they shouldn't be there in opencv 2)... is your ports tree up to date? what versions of ffmpeg and opencv are you trying to build?



OK. I've updated ports tree and tried to build opencv 2. Now I can build it with ffmpeg support, but can't build with any of the "jasper", "tiff", "png", "jpeg" options. I've got an error about undefined reference to functions from libjpeg.


----------



## avilla@ (Apr 2, 2010)

thanks for the report, i'll start testing immediately


----------



## DutchDaemon (Apr 2, 2010)

@drhlo, if your ports were *that* old you'll have to work your way through quite some entries in /usr/ports/UPDATING. Anything compiled against libjpeg and libpng will have to be rebuilt (recursively) anyway.


----------



## avilla@ (Apr 2, 2010)

i agree. by the way, i remember i've tested opencv right few days ago, after png update, and it was ok. i'm rebuilding just to be sure, but you should follow dutchdaemon's advice


----------



## drhlo (Apr 6, 2010)

DutchDaemon said:
			
		

> @drhlo, if your ports were *that* old you'll have to work your way through quite some entries in /usr/ports/UPDATING. Anything compiled against libjpeg and libpng will have to be rebuilt (recursively) anyway.





			
				xzhayon said:
			
		

> i agree. by the way, i remember i've tested opencv right few days ago, after png update, and it was ok. i'm rebuilding just to be sure, but you should follow dutchdaemon's advice



yes, I'm newbie in FreeBSD. I've made "portmaster -a" and then "make config" of opencv and rebuild. And... it works! 

Thanks for your help!


----------

