0
votes

I have an issue that is going on for over a month and I can't find any solution for it. I created an Appcelerator Titanium Module, which uses the OpenCV framework. I tried literally everything I found on the internet to make it work, but no sucess. The module compiles, but it crashes when building the App that uses it. To dig deep in the problem, I compile the App via CLI using appc run -p ios -l trace to see the whole thing. This is what I get:

[TRACE] ld: framework not found opencv2 [TRACE] clang: error: linker command failed with exit code 1 (use -v to see invocation)

This happens if I declare the framework in the module.xconfig file, like this:

OTHER_LDFLAGS=$(inherited) -framework opencv2

If I don't declare it in the file, I get:

[TRACE] symbols not found for architecture x86_64 [TRACE] clang: error: linker command failed with exit code 1 (use -v to see invocation)

Well, the opencv2.framework file is inside the /ios folder in the module.

This is what I tried so far, to put the OpenCV Framework in the project:

OpenCV Official Example for XCode

Compiling it from scratch and then adding to the Project

brew install opencv and then adding it to the project

I configured Framework Search Paths like this:

$(inherited) $(PROJECT_DIR) $(SRCROOT)

Header Search Paths like this:

$(inherited) "$(TITANIUM_SDK)/iphone/include" /usr/local/Cellar/opencv/4.4.0/include (this last one, when installed by brew CLI command.

The Other Linker Flags, is configured like this:

This configuration I got from the Tutorial below

This configuration I got from this tutorial: OpenCV on XCode

And finally, I tried adding the .dylib files from the source of the OpenCV Framework in the project by right-clicking the project's name and Add Files.

So, I tried everything I could find to solve it, but I can't get it to work. Sorry for the long question, but I am completly out of ideas on how to make this work.

Please, help me!

2

2 Answers

2
votes

First of all, the opencv2.framework is copied automatically to the XCode /ios folder (if you selected Copy Files if Needed). BUT, Appcelerator needs 3rd party frameworks to be put on /ios/platform folder. So, I moved it there.

Secondly I added -lz to the Other Linker Flags in Build Settings.

This solved the problem. I must thank the team and developers from TiSlack (An Appcelerator platform community), which helped me through this. Michael and Hans, Thanks!

0
votes

Here is a video that helped me install OpenCV4 on my Macbook Pro Mojave 10.14.6. I tried installing OpenCV using another video and it led me to getting a linker error that was similar to yours.

Basically, the problem was the path I specified as for my /lib and /include folders.

https://www.youtube.com/watch?edufilter=NULL&v=HxNZEa7Slyk