{"action":"closed","issue":{"url":"https://api.github.com/repos/Itseez/opencv/issues/5930","repository_url":"https://api.github.com/repos/Itseez/opencv","labels_url":"https://api.github.com/repos/Itseez/opencv/issues/5930/labels{/name}","comments_url":"https://api.github.com/repos/Itseez/opencv/issues/5930/comments","events_url":"https://api.github.com/repos/Itseez/opencv/issues/5930/events","html_url":"https://github.com/Itseez/opencv/issues/5930","id":125325539,"number":5930,"title":"Building Opencv with ffmpeg built from source gives linking errors","user":{"login":"Corentin-Hamel","id":5085925,"avatar_url":"https://avatars.githubusercontent.com/u/5085925?v=3","gravatar_id":"","url":"https://api.github.com/users/Corentin-Hamel","html_url":"https://github.com/Corentin-Hamel","followers_url":"https://api.github.com/users/Corentin-Hamel/followers","following_url":"https://api.github.com/users/Corentin-Hamel/following{/other_user}","gists_url":"https://api.github.com/users/Corentin-Hamel/gists{/gist_id}","starred_url":"https://api.github.com/users/Corentin-Hamel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Corentin-Hamel/subscriptions","organizations_url":"https://api.github.com/users/Corentin-Hamel/orgs","repos_url":"https://api.github.com/users/Corentin-Hamel/repos","events_url":"https://api.github.com/users/Corentin-Hamel/events{/privacy}","received_events_url":"https://api.github.com/users/Corentin-Hamel/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Itseez/opencv/labels/affected:%202.4","name":"affected: 2.4","color":"ededed"},{"url":"https://api.github.com/repos/Itseez/opencv/labels/category:%20build/install","name":"category: build/install","color":"ededed"},{"url":"https://api.github.com/repos/Itseez/opencv/labels/category:%20highgui-video","name":"category: highgui-video","color":"ededed"},{"url":"https://api.github.com/repos/Itseez/opencv/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":21,"created_at":"2016-01-07T05:31:44Z","updated_at":"2016-04-07T09:19:43Z","closed_at":"2016-04-07T09:19:43Z","body":"Hi,\r\nI'm trying build opencv to used it on ASW Lambda. Opencv is going to be uploaded as a zip file so I'm doing a static build with BUILD_SHARED_LIBS=OFF. I set up WITH_FFMPEG=YES as i will process some video files. \r\nI didn't want to install ffmpeg with apt-get as I want to have control on where my libraries are installed. I've downloaded ffmpeg and installed it from source to get the libavcodec, libavformat, libavutil and libswscale.\r\nI installed it as follow:\r\n```\r\n./configure --prefix=ffmpeg_build --disable-yasm --enable-shared --cc=\"gcc -fPIC\"\r\n```\r\nI also did: \r\n```\r\nexport LD_LIBRARY_PATH=/path/ffmpeg/ffmpeg_build/lib\r\nexport PKG_CONFIG_PATH=/path/ffmpeg/ffmpeg_build/lib/pkgconfig\r\n```\r\nI can see ffmpeg was well installed by running ./ffmpeg:\r\n```\r\nffmpeg version N-77722-g3ec5d8f Copyright (c) 2000-2016 the FFmpeg developers\r\n  built with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)\r\n  configuration: --prefix=ffmpeg_build --disable-yasm --enable-shared --cc='gcc -fPIC'\r\n  libavutil      55. 12.100 / 55. 12.100\r\n  libavcodec     57. 22.100 / 57. 22.100\r\n  libavformat    57. 21.101 / 57. 21.101\r\n  libavdevice    57.  0.100 / 57.  0.100\r\n  libavfilter     6. 23.100 /  6. 23.100\r\n  libswscale      4.  0.100 /  4.  0.100\r\n  libswresample   2.  0.101 /  2.  0.101\r\n```\r\n\r\nNow I'm trying to build opencv and link ffmpeg but it looks like it can't find it. Using the cmake UI i can even specify the path of the libraries as follow.\r\n```\r\nFFMPEG_CODEC_LIB              /home/ubuntu/test_lambda/ffmpeg/ffmpeg_build/lib/libavcodec.so.57                               \r\n FFMPEG_FORCE_TCP            ON                                                                                           \r\n FFMPEG_FORMAT_LIB           /home/ubuntu/test_lambda/ffmpeg/ffmpeg_build/lib/libavformat.so.57                              \r\n FFMPEG_INCLUDE_DIR         /home/ubuntu/test_lambda/ffmpeg/ffmpeg_build/include                                         \r\n FFMPEG_LIB_DIR                   /home/ubuntu/test_lambda/ffmpeg/ffmpeg_build/include/../lib                                  \r\n FFMPEG_SWSCALE_LIB        /home/ubuntu/test_lambda/ffmpeg/ffmpeg_build/lib/libswscale.so.4                               \r\n FFMPEG_UTIL_LIB                  /home/ubuntu/test_lambda/ffmpeg/ffmpeg_build/lib/libavutil.so.55          \r\n```\r\nBut running the cmake command give the following:\r\n```\r\nVideo I/O:\r\n--     DC1394 1.x:     NO\r\n--     DC1394 2.x:     NO\r\n--     FFMPEG:         YES\r\n--       codec:             NO\r\n--       format:            NO\r\n--       util:                  NO\r\n--       swscale:          NO\r\n```\r\nThen if i still try to use make i get:\r\n```\r\nLinking CXX shared library ../../lib/libopencv_photo.so\r\nIn file included from /home/ubuntu/test_lambda/rb-opencv/modules/highgui/src/cap_ffmpeg.cpp:45:0:\r\n/home/ubuntu/test_lambda/rb-opencv/modules/highgui/src/cap_ffmpeg_impl.hpp:71:6: error: #error \"libswscale is necessary to build the newer OpenCV ffmpeg wrapper\"\r\n```\r\nOpenCV can't find my libavcodec etc... and I have no clue how to fix that. I don't understand why it can't find with all the steps I have done before.\r\nAny ideas? \r\nThanks for your help."}}