Coder Social home page Coder Social logo

Comments (16)

deadprogram avatar deadprogram commented on May 14, 2024

Hello @kruffin when you built OpenCV itself, perhaps you did not pickup all of the needed settings for OpenCV. This line is what sets all of the build settings on AppVeyor (Windows build), which is worth looking at as a base to compare to:

https://github.com/hybridgroup/gocv/blob/master/appveyor_build_opencv.cmd#L13

from gocv.

ogrian avatar ogrian commented on May 14, 2024

I had the same issue. The set of libraries in CGO_LDFLAGS differs from the set of libraries which are defined in the same environment variable for Linux. I just adjusted this set of libraries to be consistent and it started working...

from gocv.

deadprogram avatar deadprogram commented on May 14, 2024

Hi @ogrian thanks for the comment. Which things did you change? Perhaps we need to update the docs?

from gocv.

ogrian avatar ogrian commented on May 14, 2024

@deadprogram I have the code on my laptop at home. After the working day I'll describe the changes that I made.

from gocv.

kruffin avatar kruffin commented on May 14, 2024

I see the OSX and Linux versions set CGO_CXXFLAGS and they don't have the "331" suffix on the library names. I'll try these two after work, but looking forward to hear what @ogrian did to get it to work. I'll also take a look at the AppVeyor build @deadprogram and see if I need to fix something there. I did double check that the libraries listed are actually built and available in the directory.

export CGO_CXXFLAGS="--std=c++1z"
-lopencv_face331  ==> -lopencv_face

from gocv.

ogrian avatar ogrian commented on May 14, 2024

This config worked for me on Windows:

CGO_LDFLAGS

-L{PATH_TO_LIB_DIR} -lopencv_core331 -lopencv_face331 -lopencv_videoio331 -lopencv_videoio331 -lopencv_imgproc331 -lopencv_highgui331 -lopencv_imgcodecs331 -lopencv_objdetect331 -lopencv_features2d331 -lopencv_video331 -lopencv_xfeatures2d331

I'm not sure that all the needed libs are added here but this set of libraries allows to run all the examples, at least.

from gocv.

deadprogram avatar deadprogram commented on May 14, 2024

@kruffin the Windows build of OpenCV adds the suffix 331 to all of the lib files, so that is needed on Windows. The -L flag needs to point to the destination that was used for for building the OpenCV libs into.

The other thing is to ensure that you have used all the same build flags as in the AppVeyor build. Some of them seen unimportant but are required.

from gocv.

kruffin avatar kruffin commented on May 14, 2024

I found that I had msys64 executables on my path so removed those thinking maybe that was the problem. Re-ran the build using the exact cmake command from the apveyor script (which was way easier and less error prone than using the cmake UI) and have the same error.

cmake C:\opencv\opencv-3.3.1 -G "MinGW Makefiles" -BC:\opencv\build -DENABLE_CXX11=ON -DOPENCV_EXTRA_MODULES_PATH=C:\opencv\opencv_contrib-3.3.1\modules -DBUILD_SHARED_LIBS=ON -DBUILD_EXAMPLES=OFF -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_opencv_java=OFF -DBUILD_opencv_python=OFF -DBUILD_opencv_python2=OFF -DBUILD_opencv_python3=OFF -DBUILD_DOCS=OFF -DENABLE_PRECOMPILED_HEADERS=OFF -DBUILD_opencv_saliency=OFF -Wno-dev

I saw somewhere you can generate debug opencv libraries; I may try that next to see if I can get more output that a weird error code.

Could the issue be that I'm using the mingw32-make on a 64 bit system (with a mingw-w64 gcc)?

from gocv.

deadprogram avatar deadprogram commented on May 14, 2024

Hi @kruffin you should be using only the MinGW-W64 tools, including the compiler and linker, which is known as mingw32-make. None of the other toolchains are known to work, at least from my own experimenting.

from gocv.

kruffin avatar kruffin commented on May 14, 2024

Well, I've definitely broken something now. The opencv_version.exe created when building opencv doesn't work anymore. It complains with

The procedure entry point GIBBERISH could not be located in the dynamic link library C:\opencv\build\install\x64\mingw\bin\libopencv_core331.dll.

Where GIBBERISH is auto generated characters.The only thing I did was rebuild after removing msys64 from my path.

C:\msys64\usr\bin
C:\msys64\mingw64\bin

from gocv.

pashifika avatar pashifika commented on May 14, 2024

set CGO_CPPFLAGS=-IC:\opencv\build\install\include
set CGO_LDFLAGS=-LC:\opencv\build\install\x64\mingw\lib -lopencv_core -lopencv_face -lopencv_videoio -lopencv_videoio -lopencv_imgproc -lopencv_highgui -lopencv_imgcodecs -lopencv_objdetect -lopencv_features2d -lopencv_video -lopencv_xfeatures2d

worked my windows10 & msys2.

from gocv.

deadprogram avatar deadprogram commented on May 14, 2024

I've added a Windows cmd file to the dev branch with the intention of simplifying the env configuration process in similar fashion as what the env.sh file does for MacOS/Linux:

https://github.com/hybridgroup/gocv/blob/dev/env.cmd

from gocv.

deadprogram avatar deadprogram commented on May 14, 2024

The env.cmd script was released as part of v0.8.0 so now closing. Please reopen if needed. Thank you.

from gocv.

SamOrozco avatar SamOrozco commented on May 14, 2024

For anyone in the future I was getting this on windows 10 and I needed to restart my computer

from gocv.

bobbyboy1710 avatar bobbyboy1710 commented on May 14, 2024

import (
"github.com/andlabs/ui"
_ "github.com/andlabs/ui/winmanifest"
)

from gocv.

aileen5150 avatar aileen5150 commented on May 14, 2024

C:\opencv\build\install\x64\mingw\bin\libstdc++-6.dll 拷贝到C:\Windows\System32

from gocv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.