Package Details: mingw-w64-opencv 4.9.0-1

Git Clone URL: https://aur.archlinux.org/mingw-w64-opencv.git (read-only, click to copy)
Package Base: mingw-w64-opencv
Description: Open Source Computer Vision Library (mingw-w64)
Upstream URL: http://opencv.org/
Licenses: BSD
Submitter: xantares
Maintainer: drakkan
Last Packager: drakkan
Votes: 2
Popularity: 0.000000
First Submitted: 2015-09-14 18:31 (UTC)
Last Updated: 2023-12-30 16:10 (UTC)

Latest Comments

« First ‹ Previous 1 2 3 4 Next › Last »

drakkan commented on 2019-02-08 14:17 (UTC)

@FoPref, thanks for reporting.

I use pkg-config and so I fixed static build for pkg-config case as you can see inside the PKGBUILD (line 83). This really seems an upstream issue: both pc files and cmake files are broken in some way for shared and static build (please see fixes inside PKGBUILD).

I'll try to fix static cmake build as soon as I have some spare time

FoPref commented on 2019-02-08 14:10 (UTC) (edited on 2019-02-08 14:12 (UTC) by FoPref)

Another problem with the file seems to be that it does not provide the right library names for static builds. The lib names provided in ${OpenCV_LIBRARIES} are, e.g., opencv_core, or opencv_imgproc. The correct names would have the version number appended (opencv_imgproc401 etc).

Note that at the same time, pkg-config does provide the correct names, e.g. -lopencv_imgproc401, and a static build is successful.

FoPref commented on 2019-02-06 17:11 (UTC) (edited on 2019-02-06 17:13 (UTC) by FoPref)

The OpenCVConfig.cmake included in this package is broken. Using CMake with OpenCV dependency fails. The reason is that the INSTALL_PATH is wrongly determined.

Patch:

--- old/OpenCVConfig.cmake     2019-02-06 18:09:22.293211050 +0100
+++ new/OpenCVConfig.cmake     2019-02-06 18:09:32.579844658 +0100
@@ -77,7 +77,7 @@
 # Extract the directory where *this* file has been installed (determined at cmake run-time)
 # Get the absolute path with no ../.. relative marks, to eliminate implicit linker warnings
 set(OpenCV_CONFIG_PATH "${CMAKE_CURRENT_LIST_DIR}")
-get_filename_component(OpenCV_INSTALL_PATH "${OpenCV_CONFIG_PATH}/../../../../../" REALPATH)
+get_filename_component(OpenCV_INSTALL_PATH "${OpenCV_CONFIG_PATH}/../../../" REALPATH)

 # Search packages for host system instead of packages for target system.
 # in case of cross compilation this macro should be defined by toolchain file

drakkan commented on 2018-05-05 16:58 (UTC)

@billypilgrim, in the last update I fixed lapack depends, please note that for static linking you need to add

Libs.private: -lgfortran -lquadmath

to the lapack pc file until lapack package is fixed,

@xantares since you are the mingw-w64-lapack maintainer please fix it

drakkan commented on 2018-05-04 14:35 (UTC) (edited on 2018-05-04 14:36 (UTC) by drakkan)

I build in a clean chroot, probably you have several packages installed that are added as dependency automatically, for example in my case

x86_64-w64-mingw32-pkg-config --libs --static opencv

-L/usr/x86_64-w64-mingw32/lib -lopencv_stitching341 -lopencv_superres341 -lopencv_videostab341 -lopencv_aruco341 -lopencv_bgsegm341 -lopencv_bioinspired341 -lopencv_ccalib341 -lopencv_dnn_objdetect341 -lopencv_dpm341 -lopencv_face341 -lopencv_photo341 -lopencv_fuzzy341 -lopencv_hfs341 -lopencv_img_hash341 -lopencv_line_descriptor341 -lopencv_optflow341 -lopencv_reg341 -lopencv_rgbd341 -lopencv_saliency341 -lopencv_stereo341 -lopencv_structured_light341 -lopencv_phase_unwrapping341 -lopencv_surface_matching341 -lopencv_tracking341 -lopencv_datasets341 -lopencv_text341 -lopencv_dnn341 -lopencv_plot341 -lopencv_xfeatures2d341 -lopencv_shape341 -lopencv_video341 -lopencv_ml341 -lopencv_ximgproc341 -lopencv_calib3d341 -lopencv_features2d341 -lopencv_highgui341 -lopencv_videoio341 -lopencv_flann341 -lopencv_xobjdetect341 -lopencv_imgcodecs341 -lopencv_objdetect341 -lopencv_xphoto341 -lopencv_imgproc341 -lopencv_core341 -lgdi32 -lcomdlg32 -ljpeg -ltiff -llzma -ljpeg -lz -lpng16 -lz -lwebp -lm

as you can see I have no protobuf,lapack,cblas ecc.. and my Libs.private line is empty I added the needed libraries inside the PKGBUILD here:

https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=mingw-w64-opencv#n80

I suggest to build in a clean chroot as for arch linux guidelines

https://wiki.archlinux.org/index.php/DeveloperWiki:Building_in_a_Clean_Chroot

as wrote in the wiki you are getting unwanted linking on packages missing in the depends array

billypilgrim commented on 2018-05-04 14:12 (UTC)

I was also just adding compiler flags with pkg-config basically as you were.

This is what I get when running the same commands as you:

x86_64-w64-mingw32-pkg-config --libs --static opencv | grep protobuf

-L/usr/x86_64-w64-mingw32/lib -L/usr/x86_64-w64-mingw32/share/OpenCV/3rdparty/lib -L/usr/x86_64-w64-mingw32/lib -lopencv_stitching341 -lopencv_superres341 -lopencv_videostab341 -lopencv_aruco341 -lopencv_bgsegm341 -lopencv_bioinspired341 -lopencv_ccalib341 -lopencv_dnn_objdetect341 -lopencv_dpm341 -lopencv_face341 -lopencv_photo341 -lopencv_fuzzy341 -lopencv_hfs341 -lopencv_img_hash341 -lopencv_line_descriptor341 -lopencv_optflow341 -lopencv_reg341 -lopencv_rgbd341 -lopencv_saliency341 -lopencv_stereo341 -lopencv_structured_light341 -lopencv_phase_unwrapping341 -lopencv_surface_matching341 -lopencv_tracking341 -lopencv_datasets341 -lopencv_text341 -lopencv_dnn341 -lopencv_plot341 -lopencv_xfeatures2d341 -lopencv_shape341 -lopencv_video341 -lopencv_ml341 -lopencv_ximgproc341 -lopencv_calib3d341 -lopencv_features2d341 -lopencv_highgui341 -lopencv_videoio341 -lopencv_flann341 -lopencv_xobjdetect341 -lopencv_imgcodecs341 -lopencv_objdetect341 -lopencv_xphoto341 -lopencv_imgproc341 -lopencv_core341 -llibprotobuf -llapack.dll -lblas.dll -lcblas.dll -lcomctl32 -lgdi32 -lole32 -lsetupapi -lws2_32 -ljpeg.dll -lwebp.dll -lpng.dll -lz.dll -ltiff.dll -lavifil32 -lavicap32 -lwinmm -lmsvfw32 -lgdi32 -lcomdlg32 -ljpeg -ltiff -llzma -ljpeg -lz -lpng16 -lz -lwebp -lm

cat /usr/x86_64-w64-mingw32/lib/pkgconfig/opencv.pc | grep protobuf

Libs.private: -L${exec_prefix}/share/OpenCV/3rdparty/lib -llibprotobuf -L/usr/x86_64-w64-mingw32/lib -llapack.dll -lblas.dll -lcblas.dll -lcomctl32 -lgdi32 -lole32 -lsetupapi -lws2_32 -ljpeg.dll -lwebp.dll -lpng.dll -lz.dll -ltiff.dll -lavifil32 -lavicap32 -lwinmm -lmsvfw32 -lgdi32 -lcomdlg32

It's rather strange that we get different outputs.

drakkan commented on 2018-05-04 13:28 (UTC) (edited on 2018-05-04 13:29 (UTC) by drakkan)

@billypilgrim, please explain how you get protobuf depends ecc..

in my qt+opencv app I simply added these lines in the pro file:

CONFIG += static

LIBS+=`x86_64-w64-mingw32-pkg-config --libs --static opencv`

and I was able to statically link my app.

Additionally on my system

cat /usr/x86_64-w64-mingw32/lib/pkgconfig/opencv.pc | grep protobuf

and

cat /usr/x86_64-w64-mingw32/lib/pkgconfig/opencv.pc | grep dll

show nothing,

protobuf was downloaded and builded by opencv but I think it should not be a dependency, I would like to fix the package even more if you provide the info, thanks! You can also write to me directly by email if you prefer, my email address is inside the PKGBUILD

billypilgrim commented on 2018-05-04 13:12 (UTC)

Thank you so much for helping! It's finally working with a few extra hacks in there.

The first problem was that the pkg-config had a -llibprotobuf in the parameters it gave, which should have been -lprotobuf (I also had to install the mingw version of protobuf separately).

The second problem was that there were -ljpeg.dll -lwebp.dll -lpng.dll -lz.dll -ltiff.dll etc. in the pkg-config in addition to -ljpeg etc., which meant that gcc used the dynamic versions of those libraries. But after cutting those extra params out everything worked smoothly (well my program is still buggy but I suspect that's my fault ;-)).

Anyway thanks for all your help.

drakkan commented on 2018-05-03 12:31 (UTC) (edited on 2018-05-03 22:32 (UTC) by drakkan)

@billypilgrim I added support for static builds with this commit

ba17b167e666

use this command

x86_64-w64-mingw32-pkg-config --libs --static opencv

to get the static libs to link to.

I temporary removed jasper, I'll try to understand what is wrong with jasper and static builds in the next weeks

billypilgrim commented on 2018-05-03 08:32 (UTC) (edited on 2018-05-03 08:32 (UTC) by billypilgrim)

Also, out of interest, has anyone else been able to compile statically using this package? I just get a long list of: cannot find -lopencv_stitching341... etc.

It works if I do it dynamically (i.e. not with the -static flag). Even if I point the compiler to the *.a files directly it still seems to compile dynamically, which is especially weird.

It also seems like there's a small mistake in the packages pkg-config file. If I run: x86_64-w64-mingw32-pkg-config --libs opencv

I get: -L/usr/x86_64-w64-mingw32//usr/x86_64-w64-mingw32/lib -lopencv_stitching341 ...

Although if I fix this path manually things still don't work :-(