Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compile a program with gtk+3 for Windows ? #5584

Closed
mrcyberfighter opened this issue Oct 29, 2015 · 7 comments
Closed

compile a program with gtk+3 for Windows ? #5584

mrcyberfighter opened this issue Oct 29, 2015 · 7 comments
Labels

Comments

@mrcyberfighter
Copy link

Hello,

i recently success to compile the opencv library from the source, for code-block mingw, according this tutorial.

So i get all requirement to compile my program including gtk+3.0, SDL2_mixer and opencv but...

The compilation fail and code-block try to build a library called something like opencv_gtk_test.a what's the name of my code-block project ???

I think the compilation fail due of the conjunction of the GTK+3.0 library with the opencv library because i soon have compile opencv from source for Linux and the cmake print a GTK+ take in charge which doesn't appear by Windows...???

Must I recompile OpenCV, it's was a little bit hard the last time to get viable libs on Windows and i have try to set the GTK+3 path into the PATH variable before compiling, or i'm in error ?

I get following code-block Build messages:

||=== Build: Debug in test_opencv_gtk (compiler: GNU GCC Compiler) ===|
obj\Debug\main.o||In function `ZN2cv3Mat7releaseEv':|
C:\Users\edward\Desktop\opencv_gtk\include\opencv2\core\mat.inl.hpp|671|undefined reference to `__atomic_fetch_add_4'|
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 3 second(s)) ===|

And following code-block Build log:

mingw32-g++.exe -shared -Wl,--output-def=bin\Debug\libtest_opencv_gtk.def -Wl,--out-implib=bin\Debug\libtest_opencv_gtk.a -Wl,--dll  obj\Debug\main.o  -o bin\Debug\test_opencv_gtk.dll  lib\atk-1.0.lib lib\cairo.lib lib\fontconfig.lib lib\gailutil.lib lib\gdk_pixbuf-2.0.lib lib\gdk-win32-3.0.lib lib\gio-2.0.lib lib\glib-2.0.lib lib\gmodule-2.0.lib lib\gobject-2.0.lib lib\gthread-2.0.lib lib\gtk-win32-3.0.lib lib\libatk-1.0.dll.a lib\libcairo.dll.a lib\libcairo-gobject.dll.a lib\libcairo-script-interpreter.dll.a lib\libcroco-0.6.dll.a lib\libffi.dll.a lib\libfontconfig.dll.a lib\libfreetype.dll.a lib\libgailutil-3.dll.a lib\libgdk_pixbuf-2.0.dll.a lib\libgdk-3.dll.a lib\libgio-2.0.dll.a lib\libglib-2.0.dll.a lib\libgmodule-2.0.dll.a lib\libgobject-2.0.dll.a lib\libgthread-2.0.dll.a lib\libgtk-3.dll.a lib\libiconv.dll.a lib\libintl.dll.a lib\libjasper.dll.a lib\libjpeg.dll.a lib\liblzma.dll.a lib\libpango-1.0.dll.a lib\libpangocairo-1.0.dll.a lib\libpangoft2-1.0.dll.a lib\libpangowin32-1.0.dll.a lib\libpixman-1.dll.a lib\libpng.dll.a lib\libpng15.dll.a lib\librsvg-2.dll.a lib\libtiff.dll.a lib\libxml2.dll.a lib\libz.dll.a lib\pango-1.0.lib lib\pangocairo-1.0.lib lib\pangoft2-1.0.lib lib\pangowin32-1.0.lib lib\libopencv_calib3d300.dll.a lib\libopencv_core300.dll.a lib\libopencv_features2d300.dll.a lib\libopencv_flann300.dll.a lib\libopencv_hal300.a lib\libopencv_highgui300.dll.a lib\libopencv_imgcodecs300.dll.a lib\libopencv_imgproc300.dll.a lib\libopencv_ml300.dll.a lib\libopencv_objdetect300.dll.a lib\libopencv_photo300.dll.a lib\libopencv_shape300.dll.a lib\libopencv_stitching300.dll.a lib\libopencv_superres300.dll.a lib\libopencv_ts300.a lib\libopencv_video300.dll.a lib\libopencv_videoio300.dll.a lib\libopencv_videostab300.dll.a lib\libtest_opencv_gtk.a -luser32 -lm
obj\Debug\main.o: In function `ZN2cv3Mat7releaseEv':
C:\Users\edward\Desktop\opencv_gtk/include/opencv2/core/mat.inl.hpp:671: undefined reference to `__atomic_fetch_add_4'
collect2.exe: error: ld returned 1 exit status
Creating library file: bin\Debug\libtest_opencv_gtk.a
Process terminated with status 1 (0 minute(s), 3 second(s))
1 error(s), 0 warning(s) (0 minute(s), 3 second(s))
@mshabunin
Copy link
Contributor

@mrcyberfighter, it seems that you use mingw32 - this compiler is quite old. Please try to switch to mingw-w64.

@mrcyberfighter
Copy link
Author

I have try it with the mingw-w64 from MSYS2: mingw-w64-x86_64
I have try it with the mingw-w64: mingw-w64 (posix threads as win threads).

Nothing to do, it doesn't work.

It compile right (the opencv3 library) only with the opencv-master.zip from github but nothing else:

the installers (opencv 3.0, opencv 3.0 beta, opencv 2.4.11) from opencv website won't compile.

I let Windows in her shit, in others words i give up, so that windows can go fuck to hell.

Under Linux all work perfectly, except that the opencv version from the package-manager is compiled with GTK+2 instead of GTK+3,
but that's not a problem i can compile the library from source and link my program in this way...

Else i get no problem during my holyday where i write a big part of my program on a MAC.

Why opencv.org do not provide us prebuilded bundle like she do for vs for mingw ?

Now i must capitulate in front of the worse ugly bitch of the world: Windows.

@mshabunin
Copy link
Contributor

It compile right (the opencv3 library) only with the opencv-master.zip from github but nothing else

Because mingw compilation has been fixed after 3.0 release: #5282
If you want to compile 3.0 release, try to port mentioned changes (or some more). But I'd recommend to use current master version or wait until 3.1.

Why opencv.org do not provide us prebuilded bundle like she do for vs for mingw ?

Because mingw is not officially supported.

@mrcyberfighter
Copy link
Author

Ok i try to compile my program with a not officially supported compiler, like an idiot !!!

But how to fix:

fixed GNUC version checks (for correctness and convenience)

Because a something with gnu_* was in my tracebacks.

@mrcyberfighter
Copy link
Author

I have found the diff of the files here of your mingw hack from opencv source but they are many changes to apply and i ask you if you don't get a downloadable bundle of your modified sources or better the compiled binaries of your mingw fork, maybe at mshabunin/opencv but i make a diff from a file and it doesn't correspond ?

It seems very hard to do all the changes manually for me.

Thanks for your answers.

@mshabunin
Copy link
Contributor

@mrcyberfighter, these changes has already been integrated on master branch. You can just take latest from GitHub ant it should compile.

@mrcyberfighter
Copy link
Author

Thanks but i download this repository and IT'S WORK.

But now, because i develop my program on Linux, i hit on problems like the function realpath() which is not included in mingw...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants