Comments (24)
Hello @jkuri make sure you have set whatever needed environment vars for your config. For example, on OS X or Ubuntu you run source ./env.sh
as documented here: https://github.com/hybridgroup/gocv#os-x-1
Hope that helps!
from gocv.
Hi Rob, thank you for your support. Now I have
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1
My clang version is:
Apple LLVM version 9.0.0 (clang-900.0.38)
Target: x86_64-apple-darwin17.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
and Xcode 9.1 (9B55)
. Maybe know what's wrong? Thanks again.
from gocv.
As I see you are using OS X, did you install OpenCV using Homebrew?
from gocv.
yes, I installed it as brew install opencv3 --with-contrib
. I just also tried to reinstall whole Xcode but still same issue.
from gocv.
I made it work, I updated CGO flags in env.sh
file to
export CGO_CPPFLAGS="-I/usr/local/Cellar/opencv/3.3.1_1/include -I/usr/local/Cellar/opencv/3.3.1/include/opencv2"
export CGO_CXXFLAGS="--std=c++1z -stdlib=libc++"
export CGO_LDFLAGS="-L/usr/local/Cellar/opencv/3.3.1_1/lib -lopencv_core -lopencv_videoio -lopencv_imgproc -lopencv_highgui -lopencv_imgcodecs -lopencv_objdetect -lopencv_calib3d -lopencv_video"
path to OpenCV was wrong. Thanks for your support!
from gocv.
Glad you found that, the dev
branch already has that change. Seems like we better release it!
from gocv.
yes, or maybe add condition to the env.sh
for backward compatibility for users who doesn't upgrade libraries very often.
from gocv.
After following these directions I am a getting the error specified above. Has anyone else had this issue since?
from gocv.
@cskonopka run source ./env.sh
from this repository, then you need to compile in the same terminal session.
from gocv.
@jkuri ran source ./env.sh
from this repo then compiled the program again, same error. Maybe I should just re-install and that would work? Before I did this I completely uninstalled homebrew and installed it fresh so in theory this should have been fine. And for clarity this is the exact issue.
# gocv.io/x/gocv imgproc.cpp:23:26: error: expected '(' for function-style cast or type construction imgproc.cpp:25:19: error: expected '(' for function-style cast or type construction imgproc.cpp:90:28: error: expected '(' for function-style cast or type construction
from gocv.
@jkuri So I delete the repo, started from scratch again. The updated version at this point for openCV is 3.4.0_1 so I changed that in the env.sh file. I do not get the previous error but get a new one. The camera seems to turn on then off immediately and the program crashes. I've tried changing the variables above to 3.4.0 and 3.4.0_1 with no luck. Any ideas or other thread this may pertain to? Thanks for the help, very much appreciate it, really want to get this working at all costs.
start reading camera device: 0
OpenCV Error: Assertion failed (!empty()) in detectMultiScale, file /tmp/opencv-20180113-80339-d8g5mw/opencv-3.4.0/modules/objdetect/src/cascadedetect.cpp, line 1698
libc++abi.dylib: terminating with uncaught exception of type cv::Exception: /tmp/opencv-20180113-80339-d8g5mw/opencv-3.4.0/modules/objdetect/src/cascadedetect.cpp:1698: error: (-215) !empty() in function detectMultiScale
SIGABRT: abort
PC=0x7fff52822e3e m=0 sigcode=0
signal arrived during cgo execution
goroutine 1 [syscall, locked to thread]:
runtime.cgocall(0x409fb40, 0xc420051dd0, 0xc420051df8)
/usr/local/go/src/runtime/cgocall.go:132 +0xe4 fp=0xc420051da0 sp=0xc420051d60 pc=0x4004ba4
gocv.io/x/gocv._Cfunc_CascadeClassifier_DetectMultiScale(0xa529fa0, 0xa5492c0, 0x0, 0x0)
gocv.io/x/gocv/_obj/_cgo_gotypes.go:674 +0x57 fp=0xc420051dd0 sp=0xc420051da0 pc=0x409b3e7
gocv.io/x/gocv.(*CascadeClassifier).DetectMultiScale.func1(0xa529fa0, 0xa5492c0, 0x0, 0x0)
/Users/io/go/src/gocv.io/x/gocv/objdetect.go:53 +0xb5 fp=0xc420051e18 sp=0xc420051dd0 pc=0x409cff5
gocv.io/x/gocv.(*CascadeClassifier).DetectMultiScale(0xc420051f20, 0xa5492c0, 0x0, 0x0, 0x0)
/Users/io/go/src/gocv.io/x/gocv/objdetect.go:53 +0x63 fp=0xc420051e90 sp=0xc420051e18 pc=0x409c6c3
main.main()
/Users/io/go/src/stuff/opencvex.go:49 +0x24b fp=0xc420051f80 sp=0xc420051e90 pc=0x409d78b
runtime.main()
/usr/local/go/src/runtime/proc.go:195 +0x226 fp=0xc420051fe0 sp=0xc420051f80 pc=0x402c206
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:2337 +0x1 fp=0xc420051fe8 sp=0xc420051fe0 pc=0x4054041
rax 0x0
rbx 0x7fff8b7e4340
rcx 0x7ffeefbfdd78
rdx 0x0
rdi 0x307
rsi 0x6
rbp 0x7ffeefbfddb0
rsp 0x7ffeefbfdd78
r8 0x7ffeefbfdc40
r9 0x5101
r10 0x0
r11 0x206
r12 0x307
r13 0x30
r14 0x6
r15 0x2d
rip 0x7fff52822e3e
rflags 0x206
cs 0x7
fs 0x0
gs 0x0
exit status 2
from gocv.
which demo are you trying to run? I just checked with the latest from go get -u -d -v gocv.io/x/gocv
and demo from cmd/facedetect
with a success.
I think your issue now is that you don't load cascade classifier.
Try this:
$ cd cmd/detect && go build main.go
$ ./main 0 ../../data/haarcascade_frontalface_default.xml
from gocv.
@jkuri I was trying to run my own script but then defaulted to the cmd/facedetect example and still getting the same error. Let me try what you posted above.
from gocv.
@jkuri This the response when I run go build main.go
is below. Please clarify where you want me to run the second command. I run it in the same directory as specified in the first line but then says No such file or directory
# gocv.io/x/gocv
Undefined symbols for architecture x86_64:
"cv::GFTTDetector::create(int, double, double, int, bool, double)", referenced from:
_GFTTDetector_Create in features2d.cpp.o
"cv::SimpleBlobDetector::Params::Params()", referenced from:
_SimpleBlobDetector_Create in features2d.cpp.o
"cv::SimpleBlobDetector::create(cv::SimpleBlobDetector::Params const&)", referenced from:
_SimpleBlobDetector_Create in features2d.cpp.o
"cv::FastFeatureDetector::create(int, bool, int)", referenced from:
_FastFeatureDetector_Create in features2d.cpp.o
"cv::AgastFeatureDetector::create(int, bool, int)", referenced from:
_AgastFeatureDetector_Create in features2d.cpp.o
"cv::ORB::create(int, float, int, int, int, int, int, int, int)", referenced from:
_ORB_Create in features2d.cpp.o
"cv::dnn::experimental_dnn_v3::blobFromImage(cv::_InputArray const&, double, cv::Size_<int> const&, cv::Scalar_<double> const&, bool, bool)", referenced from:
_Net_BlobFromImage in dnn.cpp.o
"cv::dnn::experimental_dnn_v3::readNetFromCaffe(cv::String const&, cv::String const&)", referenced from:
_Net_ReadNetFromCaffe in dnn.cpp.o
"cv::dnn::experimental_dnn_v3::readNetFromTensorflow(cv::String const&, cv::String const&)", referenced from:
_Net_ReadNetFromTensorflow in dnn.cpp.o
"cv::dnn::experimental_dnn_v3::Net::forward(cv::String const&)", referenced from:
_Net_Forward in dnn.cpp.o
"cv::dnn::experimental_dnn_v3::Net::setInput(cv::_InputArray const&, cv::String const&)", referenced from:
_Net_SetInput in dnn.cpp.o
"cv::dnn::experimental_dnn_v3::Net::~Net()", referenced from:
_Net_Close in dnn.cpp.o
"cv::KAZE::create(bool, bool, float, int, int, int)", referenced from:
_KAZE_Create in features2d.cpp.o
"cv::MSER::create(int, int, int, double, double, int, double, double, int)", referenced from:
_MSER_Create in features2d.cpp.o
"cv::AKAZE::create(int, int, int, float, int, int, int)", referenced from:
_AKAZE_Create in features2d.cpp.o
"cv::BRISK::create(int, int, float)", referenced from:
_BRISK_Create in features2d.cpp.o
"cv::dnn::experimental_dnn_v3::Net::empty() const", referenced from:
_Net_Empty in dnn.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
from gocv.
@jkuri I just pulled the latest about 20 minutes ago, I can do it again but I'm sensing I'm gonna get the same results. Also the snippet in the beginning of the thread, the export CGO part, this, I'm assuming, I would change for the OSX version or is it for all of them? I would like clarification on this if this still applies. I'm not that experienced in that aspect of development. I wanted to prototype on my laptop before going to a board. Too frustrated and tired right now but will switch to a pi to see if I can get it going there, just confused why this keeps happening when it's a fresh install and others have fixed it/got it working with OSX.
from gocv.
about undefined symbols
error. you need to compile OpenCV
with the contribution addons, check here: https://github.com/hybridgroup/gocv/blob/master/Makefile#L13-L27.
then it should work.
from gocv.
@jkuri Thanks! I will try that, back at it today. Will probably try out the Linux side of things shortly as well. Very much appreciate all the help.
from gocv.
Right but in this file it specifies wget and I'm running OSX unless I'm missing something. Ok, I'm back at the original error, what the hell, how did that happen?????
imgproc.cpp:23:26: error: expected '(' for function-style cast or type construction
So yeah I'm convinced this may not be possible with OSX unless I'm missing something. I did brew install opencv --with-contrib
and there was no change. I'm just going to boot up a Linux box and do that, really frustrated since that will cut down productivity. I'm assuming someone has gotten it working with OSX, maybe it has to do with the specific OS.
I will try two things
- I'm gonna wipe homebrew and opencv again, install with the contrib specifically and the extras per this website (https://www.learnopencv.com/install-opencv-3-on-yosemite-osx-10-10-x/)
- I'll set it up clean from linux and see what happens, I assume it will work smoothly.
Thanks for the patience with this, just super confused why I'm in this feedback loop.
from gocv.
Hi, all. Just to chime in, the standard homebrew recipe for OpenCV includes the contrib extensions:
https://github.com/Homebrew/homebrew-core/blob/master/Formula/opencv.rb
You for sure want to only have a single version of OpenCV installed, and that version should be the latest 3.4 installed by homebrew.
from gocv.
Howdy @deadprogram ! Thank you for the link. Currently I am running one version of OpenCV, that which was installed using brew install opencv
without a specific version, it downloaded 3.4.0_1. Is this just because I need 3.4.0 and not 3.4.0_1? Will try this.
from gocv.
@deadprogram After a fresh install of brew again, installed openCV and inside the make file of gocv it is the exact copy of what you pasted above but it's install 3.4.0_1. Versions is deprecated with homebrew so I can't figure out how to install a different version.
from gocv.
That is the latest version of 3.4 using Homebrew's numbering system.
from gocv.
@deadprogram I get that the current release is 3.4.0 but when I install it using homebrew and inspect the folder, it is labeled 3.4.0_1, not 3.4.0. This being said, the version I currently have does not align with the document that was linked and would assume it would have to be exact for it to work properly. There is no duplicate and this has happened each time after a clean wipe of homebrew and when I tried to install this again. I just really want this to work on osx to save me a fair amount of development time. I've tried this on several OSX operating systems as well (high sierra and sierra) and I've had the same issue on separate devices.
from gocv.
What the OpenCV version calls 3.4.0
is what Homebrew installs as 3.4.0_1
but the are the same version. The env.sh
script accommodates this already. Also remember that the command
source ./env.sh
needs to be run one time per session in order for the ENV varables to be set in that session to point to the OpenCV install. You should not need to change anything in order to compile, if you have installed OpenCV via homebrew, and have run the env.sh
script.
Run this one time to install OpenCV, and you do not need to run again, as long as it works:
brew update opencv
then each session, run:
source ./env.sh
go run ./cmd/version/main.go
Hopefully that helps. One last thing to check, if you are still having troubles, is to make sure you do not have some other version of OpenCV installed that was installed manually not using Homebrew. GoCV is known to work on various macOS versions, I have even run it myself, so you are probably close.
from gocv.
Related Issues (20)
- How to parse blob?
- Memory leak in ORB detector
- triangulatePoints
- Error installing OpenCV libtbb2 and libdc1394-22-dev not found HOT 1
- Issue using gocv 0.35.0 in combination with opencv 4.8.1 in docker HOT 1
- Update to Support Additional Fonts from HersheyFont HOT 1
- MinMaxIdx function does not return the correct index. HOT 2
- BoxPoints, MinAreaRect inconsistent with C++ version of OpenCV, causing precision issues HOT 2
- Why is Mat used for in Range instead of a scalar wit hsv? And how can I sat Mat to a lower HSV range? HOT 2
- Consider adding VideoWriterFileWithAPI?
- Compilation yields "/bin/sh: line 0: cd: OLDPWD not set" on MacOS HOT 2
- Severe Memory Leak During Conversion between Image and gocv.Mat HOT 1
- go run . doesn't work on macos sonoma 14.2.1 (23C71) HOT 3
- Missing ArUco when installing OpenCV Debian Repository HOT 2
- building a static binary with ` gocv/opencv:4.9.0-static` fails HOT 3
- Not able to run simple example HOT 1
- Skew Correction
- Unable to complete install with CUDA (make install_cuda) HOT 3
- make install BUILD_SHARED_LIBS=OFF fails on Ubuntu 22.04 HOT 1
- windows error: invalid cast from type 'pthread_t' {aka 'ptw32_handle_t'} to type 'void* HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gocv.