I'm on a mac 10.7.5 trying to work with the OpenCV library in XCode 4.6.2. I'm following this tutorial http://sadeepj.blogspot.co.uk/2012/03/installing-and-configuring-opencv-to.html
So I've downloaded cmake and OpenCV2.3.1 I have written in terminal :
tar xvf OpenCV-2.3.1a.tar.bz2
cd OpenCV-2.3.1
mkdir build
cd build
cmake -G "Unix Makefiles" ..
It all works except at the Unix Makefiles command, where it says CMake Error: Could not create named generator Unix Makefiles..
Anyone know why this is happening or maybe there is another method of getting OpenCV running smoothly in Xcode?
I encourage you to avoid compiling OpenCV by yourself, whenever possible.
You can download the latest OpenCV compiled framework for iOS here, and here you can find some previous versions. To use the framework, just drag the opencv2.framework directory to your XCode project, and you're done.
Related
I have Apple's command line tools version 9.1 installed and am working through an LLVM tutorial. I need to use some libraries like llvm/ADT and llvm/IR but get an error when I run the code.
main.cpp:1:10: fatal error: 'llvm/ADT/APFloat.h' file not found
#include "llvm/ADT/APFloat.h"
^~~~~~~~~~~~~~~~~~~~
1 error generated.
I also don't seem to have tools such as the assembler. Are these things not usable with Apple's version? And can I install LLVM without conflicting with Apple's version?
Apple's fork misses most of the library,headers and command-line tools in the llvm trunk.
I suggest you compile a new llvm copy from trunk.
Conflicting depends on how you configure everything. You can:
Install your new copy to global location, where your $PATH configuration is responsible for choosing which version to use.
Install as a separate Xcode Toolchain.
Here is a build script I've been using:
cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DLLVM_APPEND_VC_REV=on -DLLVM_ENABLE_EH=on -DLLVM_ENABLE_RTTI=on -DLLVM_CREATE_XCODE_TOOLCHAIN=on -DCMAKE_INSTALL_PREFIX=~/Library/Developer/ ../LLVM
Running ninja install will install to global location, otherwise run ninja install-xcode-toolchain to install as a separate toolchain
In your case I suggest installing to global location to avoid the trouble of messing with CFLAGS/LDFLAGS/Header Search Path. Then remove the installation manually after you are done with the tutorial
EDIT: You might also want to check out the official build guide https://llvm.org/docs/CMake.html
For your use case, in-tree building is also a feasible option(Providing you are familiar with write cmake configs)
Actually, there is no need to build the LLVM yourself. You can get prebuilt version for your platform here: http://releases.llvm.org
In your case it would be something like this:
cd /opt
wget http://releases.llvm.org/5.0.0/clang+llvm-5.0.0-x86_64-apple-darwin.tar.xz
tar xvf clang+llvm-5.0.0-x86_64-apple-darwin.tar.xz
mv clang+llvm-5.0.0-x86_64-apple-darwin llvm-5.0.0
After that you will have everything under /opt/llvm-5.0.0, e.g.:
/opt/llvm-5.0.0/bin/clang
/opt/llvm-5.0.0/bin/llvm-config
/opt/llvm-5.0.0/lib/libc++.a
etc.
P.S. I use /opt just as an example, feel free to pick any other directory that fits you best.
I'm building an After Effects plugin on OsX.
The XCode project work fine and now I'm trying to port the XCode projects to Cmake environment.
One of the issues I have:
- The XCode automatically executes Rez utility on .r(esource) files
Any ideas how to build the .r files with cmake?
It seems CMake do not provide automatic resource file support in apple. You should use add_custom_command to run Rez at compile stage.
I am trying to install OpenCV on my Macbook and I tried following this link:
http://www.learnopencv.com/install-opencv-3-on-yosemite-osx-10-10-x/
However when I try to run a sample code: I get the following error:
g++ -ggdb pkg-config --cflags --libs opencv
ld: library not found for -lcrt1.10.5.o
I looked up a few things online and I arrived at the conclusion that there was a problem with my xcode.
https://software.intel.com/en-us/articles/installing-intel-compilers-for-os-x-pre-requisite-xcode-command-line-tools
However, When I tried to install the required software I got an error saying >>source /opt/intel/bin/iccvars.sh intel64
-bash: /opt/intel/bin/iccvars.sh: No such file or directory
I would really appreciate any recommendations.
I have OpenCV in my mac with yosemite and compiles on xcode command line tools.
I followed the following step
Download the latest version of OpenCV binaries from the repository.
Please install MacPort (from here) on which the OpenCV will be installed.
Install CMAKE on your mac.
cd to your OpenCV folder and create a new directory (eg. on terminal mkdir build) and cd build, that is move to build folder. (I recommend you to use terminal)
On terminal type cmake .. (with is dots)
Next, type: make -j8
type: make install
Now OpenCV is installed in your system.
Next open Xcode with Command line tool installed.
Create a new C++ project
On your Left side plane, where the list of folder content is shown (I dont know the name) but where you will see the file main.cpp. Here right click and create a new group and name it OpenCV Frameworks. Next Right Click on this Group and select Add files and a new dialogue box will appear. Please navigate to your installation file and add all the opencv libraries to this group. you will find it either on /usr/local/lib/ or /opt/local/lib . The libaries has name like libopencvxxx.dylib.. (I Kind of forgot but something with that name)
Next go and add your header and lib path to the compiler.
Thats it.
Please try and if you still cant compile than I will add photo shoots of each step.
I am trying to use ZMQ library to communicate between python and c++ code.
I downloaded the source zip from http://zeromq.org/area:download and built it for the windows by using visual studio 2010.
I need to support MAX OS X also. So I tried the same above process by using xcode.
-> I downloaded the code from http://zeromq.org/area:download "POSIX tarball".
-> extract content of zeromq-4.0.4.tar.gz which is downloaded in the above step
-> created the project on xcode
-> included all the files from zeromq-4.0.4/src and zeromq-4.0.4/inc in the xcode project
-> build
Xcode is giving an error while compiling i.e. Unsupported browser in file poller.hpp (77).
I tried to understand from the zmq website but I could not built it.
Can anybody pleas help me building the static lib for the MAC OS X
Thank you.
As per official documentation
brew install zeromq
On the zeromq download page that you reference:
To build on UNIX-like systems
If you have free choice, the most comfortable OS for developing with
ZeroMQ is probably Ubuntu.
Make sure that libtool, autoconf, automake are installed. Check
whether uuid-dev package, uuid/e2fsprogs RPM or equivalent on your
system is installed. Unpack the .tar.gz source archive. Run
./configure, followed by make. To install ZeroMQ system-wide run sudo
make install. On Linux, run sudo ldconfig after installing ZeroMQ. To
see configuration options, run ./configure --help. Read INSTALL for
more details.
Tells you pretty clearly that on Mac OS X compilation uses automake/autoconf. Instead of importing the files into Xcode, install the Xcode command-line tools and do a simple ./configure --enable-static && make to build the static library. The configure script will generate the right headers for you. This is pretty much the default way most libraries that use automake/autoconf are built...
Just use cmake described here:
git clone https://github.com/zeromq/libzmq
mkdir cmake-build && cd cmake-build
cmake .. && make -j 4
make test && make install && sudo ldconfig
I failed 2 test, 1 exception, the other time out.
But building is fine except ldconfig is not on Mac, so need to use dyld
(i am not sure this part)
But it seems working
P.S. Read INSTALL doesn't not give much info
When trying to build an xcode project with the following command line:
./firebreath/prepmac.sh projects/ build/
I get:
Using projects in: /Users/uwecerron/Desktop/Node/projects
Generating build files in: /Users/uwecerron/Desktop/Node/build
NOTE: The build files in /Users/uwecerron/Desktop/Node/build should NEVER be modified directly. Make changes in cmake and re-run this script.
~/Desktop/Node/build ~/Desktop/Node
./firebreath/prepmac.sh: line 10: cmake: command not found
CMake failed. Please check error messages
There are no error messages, and i have cmake 2.8-8 installed. Any suggestions on what to do? this is for a kinect project using depthjs.
When you installed cmake it would have ask you if you wanted to install the command line links; you probably accidentally told it not to. Install cmake again and tell it to install the command-line links and it should work fine.