Closed Siddharthk closed 10 years ago
@Siddharthk, sounds really strange! Will try to figure out some solution.
The problem is in unix-install/opencv.pc file:
prefix=/usr/local exec_prefix=${prefix} libdir= includedir_old=${prefix}/include/opencv includedir_new=${prefix}/include
Name: OpenCV Description: Open Source Computer Vision Library Version: 3.0.0 Libs: ${exec_prefix}/lib/libopencv_bioinspired.so ${exec_prefix}/lib/libopencv_calib3d.so ${exec_prefix}/lib/libopencv_contrib.so ${exec_prefix}/lib/lib opencv_core.so ...... "rt pthread m dl". This should be replaced with "-lrt -lpthread -lm -ldl".
I am also getting GUI issues. Not able to display images. Should I install new GTK version? Is gtk-3.0 version supported?
@Siddharthk, i found out that this very problem was fixed today morning. Please check whether fetching the latest master helps, and if it doesn't, please inform - it seems to be an issue.
@AnnaKogan8, Its still not solved. What should I do with the GUI issue? Is this issue at my end?
@Siddharthk, it turns out that the fix was for 2.4 branch. It will appear in master after the weekly merge next week, and right after that the problem is going to be solved. Right now you can try applying the patch from #1623 yourself.
@AnnaKogan8, I have applied the patch. Now it works. But I still have problem with gtk and ffmpeg. cmake is not able to find both these packages. Can you help me with this? I need the GUI functionality urgently.
@Siddharthk, when did the issue appear? Did your commit cause it or rebase to the latest master? Maybe moving to an older version of master helps?
@AnnaKogan8, This happened when I updated my forked repo to 3.0 (latest master branch). I also have a copy of my forked repo before update. There cmake is able to find both the packages..
@AnnaKogan8, I have cloned the latest opencv branch but still cmake is not able to find the gtk and ffmpeg package. What should I do? I have to be on new version of OpenCV in order to remove the merge conflict. Currently I have updated(3.0) folder of OpenCV and another folder without the update(where cmake is able to find both the packages. Which files should I compare?
@Siddharthk, I think you can continue developing in the old code (that causes merge conflict) for now, and in the meantime I'll try to figure out what causes your issues. OK?
@AnnaKogan8, I am finished with the changes in the modules. All errors are also fixed. Let me know if it is ready to be merged or more changes are required.The cmake problem not detecting my libraries is still not solved. Apart from this I just updated my repo and its now giving the following build error:
/home/siddharth/Documents/opencv/modules/core/src/rand.cpp: In function ‘cv::RNG& cv::theRNG()’: /home/siddharth/Documents/opencv/modules/core/src/rand.cpp:734: error: ‘TLSData’ has not been declared make[2]: * [modules/core/CMakeFiles/opencv_core.dir/src/rand.cpp.o] Error 1 make[1]: * [modules/core/CMakeFiles/opencv_core.dir/all] Error 2 make: *\ [all] Error 2
@AnnaKogan8, For your reference, I am showing the result of my cmake before and after update to 3.0
After Update: https://gist.github.com/Siddharthk/7142572
Before Update: https://gist.github.com/Siddharthk/7276470
@Siddharthk, you've done an impressing work! Apart from 4 comments above (which are only to make the code a tiny bit readable), I think, the contribution is ready to be merged in OpenCV. Thank you!
Won't you mind correcting the pieces I highlighted? I'm OK with everything right now, actually, so just let me know when to give the green light:)
@AnnaKogan8, I am still getting the following make error after update:
/home/siddharth/Documents/opencv/modules/core/src/rand.cpp: In function ‘cv::RNG& cv::theRNG()’: /home/siddharth/Documents/opencv/modules/core/src/rand.cpp:734: error: ‘TLSData’ has not been declared make[2]: * [modules/core/CMakeFiles/opencv_core.dir/src/rand.cpp.o] Error 1 make[1]: * [modules/core/CMakeFiles/opencv_core.dir/all] Error 2 make: *\ [all] Error 2
@AnnaKogan8, I have made the changes. We can merge now if there are no more changes to be done. I have removed all the errors. But the cmake problem not finding the gtk and ffmpeg packages is still there.
Result of my cmake before and after update to 3.0:
After Update: https://gist.github.com/Siddharthk/7142572
Before Update: https://gist.github.com/Siddharthk/7276470
Please help me out with this.
@Siddharthk, which versions of the repository exactly were you using in those two examples of the cmake output you posted? Would it be possible to get a diff between the two? I'm still curious about the change that's making it hard for cmake to find gtk and ffmpeg. Thanks.
@ImAlsoGreg,
New: -- General configuration for OpenCV 3.0.0-dev ===================================== -- Version control: 2.4.6.2-3098-gc356335-dirty
and
Old: -- General configuration for OpenCV 2.4.9 ===================================== -- Version control: 2.4.5-1161-gd81d3fc-dirty
More info(including version) is given in the gist which I have posted.
@AnnaKogan8, @ImAlsoGreg This is really annoying. In my one machine(ubuntu 10.04), cmake is not able to find both the packages. In second machine(Ubuntu 12.04), its able to find it. But on "make" its giving the following error:
/home/siddharth/Desktop/opencv/modules/highgui/src/cap_ffmpeg_impl.hpp: In member function ‘void CvVideoWriter_FFMPEG::close()’: /home/siddharth/Desktop/opencv/modules/highgui/src/cap_ffmpeg_impl.hpp:1475:29: error: ‘avformat_free_context’ was not declared in this scope make[2]: * [modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_ffmpeg.cpp.o] Error 1 make[1]: * [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2 make: *\ [all] Error 2
For earlier versions of opencv both my machines are working fine.
What is the best thing to do now?
Looks very strange. @SpecLad, could you please point out the reason for such behavior? What is the solution for the issue? Thank you!
@Siddharthk Both GTK+ and FFmpeg are searched for with pkg-config
. What does this command print?
pkg-config --modversion gtk+-2.0 gthread-2.0 libavformat
/home/siddharth/Desktop/opencv/modules/highgui/src/cap_ffmpeg_impl.hpp:1475:29: error: ‘avformat_free_context’ was not declared in this scope
This function should be declared in /usr/include/libavformat/avformat.h
. Is it?
@SpecLad, Output(for both before update and after update folders are same):
siddharth@sidsniper:~/opencv$ pkg-config --modversion gtk+-2.0 gthread-2.0 libavformat 2.24.17 2.34.0 52.93.0
libavformat dir is missing. But we can leave this for now as I don't want this machine to be upgraded to 3.0 as I am running an application compatible with opencv's older version.
Do you want any specific files from before update and after update which is causing this issue?
Is this on the 10.04 or the 12.04 machine?
libavformat dir is missing
Oh? Does pkg-config --cflags libavformat
print anything? You might have a broken FFmpeg installation...
Do you want any specific files from before update and after update which is causing this issue?
After the update, rerun CMake and post CMakeCache.txt
from your build directory.
libavformat dir is missing on the 12.04 machine. On 10.04 its there.
On both machines output of "pkg-config --cflags libavformat" is: -I/usr/local/include
CMakeCache.txt before update: https://gist.github.com/Siddharthk/7371352
CMakeCache.txt after update: https://gist.github.com/Siddharthk/7371380
Hmm... strange. Even though PKG_CONFIG_EXECUTABLE
is present in the cache, it appears to not have used pkg-config at all, judging by the lack of ALIASOF_
entries. Can you temporarily apply this patch, rerun CMake, post the output?:
diff --git a/cmake/OpenCVUtils.cmake b/cmake/OpenCVUtils.cmake
index 13461e8..747c72b 100644
--- a/cmake/OpenCVUtils.cmake
+++ b/cmake/OpenCVUtils.cmake
@@ -233,6 +233,7 @@ endmacro()
# constants passed as second arg
macro(CHECK_MODULE module_name define)
set(${define} 0)
+ message("check_module ${module_name} PKG_CONFIG_FOUND ${PKG_CONFIG_FOUND}")
if(PKG_CONFIG_FOUND)
set(ALIAS ALIASOF_${module_name})
set(ALIAS_FOUND ${ALIAS}_FOUND)
By the way, which CMake version are you using?
Oh, and by the way, those CMake logs you poster earlier, they seem to be awfully short. Please build in a new directory, so that it generates the full log, and post that.
I have updated the posted CMake logs.
CMake version: 2.8.8
After applying the patch, you want the CMake output or CMakeCache.txt?
Output - cache should be exactly the same.
Cmake output after applying patch: https://gist.github.com/Siddharthk/7372347
OK, I think I found your problem: http://public.kitware.com/Bug/view.php?id=13132
Fixed in CMake 2.8.9.
Yes, I have updated cmake to 2.8.12. This has solved the problem. But in make its giving following error: https://gist.github.com/Siddharthk/7373556
@SpecLad, Why is it not able to find gtk/gtk.h?
"pkg-config gtk+-2.0 --cflags" output: -pthread -I/usr/local/include/gtk-2.0 -I/usr/local/lib/gtk-2.0/include -I/usr/local/include/atk-1.0 -I/usr/local/include/cairo -I/usr/local/include/gdk-pixbuf-2.0 -I/usr/local/include/pango-1.0 -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -I/usr/local/include/pixman-1 -I/usr/local/include -I/usr/local/include/freetype2 -I/usr/include/libpng12
@SpecLad, Any solution?
Well... do you actually have /usr/local/include/gtk-2.0/gtk/gtk.h
?
Yes, it was not there. But after fixing this, its giving the below error: https://gist.github.com/Siddharthk/7415960
It sounds like your installation is broken. gsize
is supposed to be defined in glibconfig.h
, which should be in /usr/local/lib/glib-2.0/include
, judging by your pkg-config
output.
@SpecLad, gtk problem is solved. But the following error is coming:
/home/siddharth/opencv/modules/highgui/src/cap_ffmpeg_impl.hpp: In member function ‘void CvVideoWriter_FFMPEG::close()’: /home/siddharth/opencv/modules/highgui/src/cap_ffmpeg_impl.hpp:1475: error: ‘avformat_free_context’ was not declared in this scope make[2]: * [modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_ffmpeg.cpp.o] Error 1 make[1]: * [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2 make: *\ [all] Error 2
The function is declared in /usr/include/libavformat/avformat.h
Didn't you just say that pkg-config
said it was in /usr/local/include
?
Yes. libavformat is present in [/usr/local/include] also.
Someone else is also getting the same problem: http://answers.opencv.org/question/22994/why-am-i-getting-this-error-installation-issue-in/
So... does /usr/local/include/avformat/avformat.h
declare this function?
Sorry, did not get you. Which function are you asking?
avformat_free_context
. Since you say that /usr/include/libavformat/avformat.h
does declare it, evidently a different file gets included, one that doesn't.
Nope, avformat.h does not declare avformat_free_context.
Well then... which version of FFmpeg is that?
I just updated the ffmpeg. New error:
[ 18%] Building CXX object modules/core/CMakeFiles/opencv_perf_core.dir/perf/perf_math.cpp.o
Linking CXX executable ../../bin/opencv_perf_core
../../lib/libopencv_highgui.so.3.0.0: undefined reference to avformat_network_init' ../../lib/libopencv_highgui.so.3.0.0: undefined reference to
avformat_find_stream_info'
../../lib/libopencv_highgui.so.3.0.0: undefined reference to avio_close' ../../lib/libopencv_highgui.so.3.0.0: undefined reference to
avformat_new_stream'
../../lib/libopencv_highgui.so.3.0.0: undefined reference to avformat_close_input' ../../lib/libopencv_highgui.so.3.0.0: undefined reference to
avformat_write_header'
../../lib/libopencv_highgui.so.3.0.0: undefined reference to av_opt_set' ../../lib/libopencv_highgui.so.3.0.0: undefined reference to
avcodec_open2'
../../lib/libopencv_highgui.so.3.0.0: undefined reference to avformat_free_context' ../../lib/libopencv_highgui.so.3.0.0: undefined reference to
avio_open'
../../lib/libopencv_highgui.so.3.0.0: undefined reference to `avformat_open_input'
collect2: ld returned 1 exit status
make[2]: * [bin/opencv_perf_core] Error 1
make[1]: * [modules/core/CMakeFiles/opencv_perf_core.dir/all] Error 2
make: *\ [all] Error 2
Looks like your headers don't match your libraries. Again, broken installation.
@SpecLad, Build successful. Thanks for the help :+1:
@SpecLad,
When I am running samples/cpp codes, I am getting the following error:
siddharth@sidsniper:~/opencv/samples/cpp$ g++ pca.cpp -ggdb pkg-config --cflags opencv
pkg-config --libs opencv
siddharth@sidsniper:~/opencv/samples/cpp$ ./a.out
./a.out: error while loading shared libraries: libopencv_bioinspired.so.3.0: cannot open shared object file: No such file or directory
Location: siddharth@sidsniper:~/opencv/samples/cpp$ locate libopencv_bioinspired /usr/local/lib/libopencv_bioinspired.so /usr/local/lib/libopencv_bioinspired.so.3.0 /usr/local/lib/libopencv_bioinspired.so.3.0.0
@SpecLad, running ldconfig solved this problem.
@AnnaKogan8, Ready for the merge?
@Siddharthk, yes, I suppose you pull request is to be merged. To do the merge, two things are required:
I can provide you help in any item.
All 3 modules added