NLOPT importing and using C++ - c++

I have been trying on and off for the past year to import the NLopt library into my work. I have been unsuccessful, and I am desperate for help.
Here is some of my CMAKE file
cmake_minimum_required(VERSION 3.21)
project(DynamicRRT)
set(CMAKE_CXX_STANDARD 17)
set(CONAN_CMAKE_CXX_STANDARD 17)
include_directories(/opt/homebrew/Cellar/eigen/3.4.0_1/include/eigen3/)
find_library(nlopt /Users/brandon/Extern/nlopt_install/ NAMES libnlopt nlopt NLopt)
include_directories(/Users/brandon/Extern/nlopt_install/include/ )
link_directories(/Users/brandon/Extern/nlopt_install/include/ )
#INCLUDE_DIRECTORIES(/Users/brandon/CLionProjects/nlopt/)
#INCLUDE_DIRECTORIES(/opt/homebrew/Cellar/nlopt/2.7.1/include/)
#include_directories(/usr/local/include/)
#add_library(nlopt /Users/brandon/Extern/nlopt_install/include)
#add_compile_options(-Wa,-mbig-obj)¡
add_executable(DynamicRRT main.cpp utilities.cpp utilities.h rrt_star.cpp rrt_star.h tree.cpp tree.h Nodes.cpp Nodes.h Obstacles.cpp Obstacles.h macro_rrt_star.cpp macro_rrt_star.h collisions.cpp collisions.h dynamic_rrt_star.cpp dynamic_rrt_star.h trajectory.cpp trajectory.h transformer.cpp transformer.h print_utilities.cpp print_utilities.h random_utilities.cpp random_utilities.h)# inverse_kinematics.cpp inverse_kinematics.h)# rrt_star.cpp rrt_star.h)#rrt_star_util.cpp rrt_star_util.h
target_link_libraries(DynamicRRT nlopt)
You can see that I've commented out a number of attempts at getting this imported. CMake does not throw any errors. However, if I try building the project, I get:
/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake --build /Users/brandonmeng/CLionProjects/DynamicRRT/cmake-build-default-gcc --target all -- -j 8
[ 14%] Building CXX object CMakeFiles/DynamicRRT.dir/Obstacles.cpp.o
[ 14%] Building CXX object CMakeFiles/DynamicRRT.dir/utilities.cpp.o
[ 35%] Building CXX object CMakeFiles/DynamicRRT.dir/rrt_star.cpp.o
[ 35%] Building CXX object CMakeFiles/DynamicRRT.dir/macro_rrt_star.cpp.o
[ 35%] Building CXX object CMakeFiles/DynamicRRT.dir/Nodes.cpp.o
[ 42%] Building CXX object CMakeFiles/DynamicRRT.dir/main.cpp.o
[ 50%] Building CXX object CMakeFiles/DynamicRRT.dir/tree.cpp.o
[ 57%] Building CXX object CMakeFiles/DynamicRRT.dir/collisions.cpp.o
[ 64%] Building CXX object CMakeFiles/DynamicRRT.dir/dynamic_rrt_star.cpp.o
[ 71%] Building CXX object CMakeFiles/DynamicRRT.dir/trajectory.cpp.o
[ 78%] Building CXX object CMakeFiles/DynamicRRT.dir/transformer.cpp.o
[ 85%] Building CXX object CMakeFiles/DynamicRRT.dir/print_utilities.cpp.o
[ 92%] Building CXX object CMakeFiles/DynamicRRT.dir/random_utilities.cpp.o
[100%] Linking CXX executable bin/DynamicRRT
ld: library not found for -lnlopt
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [bin/DynamicRRT] Error 1
make[1]: *** [CMakeFiles/DynamicRRT.dir/all] Error 2
make: *** [all] Error 2

link_directories(/Users/brandon/Extern/nlopt_install/include/ )
The library to link with is likely not in the include directory with the header files. It's more likely they're in a lib directory:
link_directories(/Users/brandon/Extern/nlopt_install/lib)

Related

GLM fails to build when using Clion

I am using the experimental GLM hash features in a CMake project.
Everything works fine unless the project is generated by Clion.
When building the Clion generated project GLM raises the error "GLM_GTX_hash requires C++11 standard library support" (see CMake logs) although C++11 is enabled.
Building the same, clion generated, project from a terminal fails with the same error.
However, when generating and building the project with cmake 'manually' (without Clion even knowing about it) everything works fine. As expected.
GLM is not directly included in the CMakeList. GLFW includes/imports it.
Example CMakeLists.txt
(...)
set(CMAKE_CXX_STANDARD 11)
add_executable(Test main.cpp)
(...)
add_subdirectory("glfw" ${CMAKE_CURRENT_BINARY_DIR}/glfw)
target_include_directories(Test PUBLIC ${GLFW_INCLUDE_DIRS})
target_link_libraries(Test ${GLFW_LIBRARIES} glfw)
Example main.cpp
#define GLM_FORCE_RADIANS
#define GLM_FORCE_DEPTH_ZERO_TO_ONE
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#define GLM_ENABLE_EXPERIMENTAL
#include <glm/gtx/hash.hpp>
int main() {
return 0;
}
Clion build output:
/usr/bin/cmake --build /home/lukas/Test/cmake-build-debug --target Test -- -j 2
[ 89%] Built target glfw
Scanning dependencies of target Test
[ 94%] Building CXX object CMakeFiles/Test.dir/main.cpp.o
In file included from /home/lukas/Test/main.cpp:8:
/usr/include/glm/gtx/hash.hpp:46:3: error: "GLM_GTX_hash requires C++11 standard library support"
# error "GLM_GTX_hash requires C++11 standard library support"
^
1 error generated.
make[3]: *** [CMakeFiles/Test.dir/build.make:63: CMakeFiles/Test.dir/main.cpp.o] Error 1
make[2]: *** [CMakeFiles/Makefile2:73: CMakeFiles/Test.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:85: CMakeFiles/Test.dir/rule] Error 2
make: *** [Makefile:118: Test] Error 2
Terminal output (as expected)
$ cmake -H. -Bbuild -G "Unix Makefiles" && cmake --build build
Scanning dependencies of target glfw
[ 5%] Building C object glfw/src/CMakeFiles/glfw.dir/context.c.o
[ 10%] Building C object glfw/src/CMakeFiles/glfw.dir/init.c.o
[ 15%] Building C object glfw/src/CMakeFiles/glfw.dir/input.c.o
[ 21%] Building C object glfw/src/CMakeFiles/glfw.dir/monitor.c.o
[ 26%] Building C object glfw/src/CMakeFiles/glfw.dir/vulkan.c.o
[ 31%] Building C object glfw/src/CMakeFiles/glfw.dir/window.c.o
[ 36%] Building C object glfw/src/CMakeFiles/glfw.dir/x11_init.c.o
[ 42%] Building C object glfw/src/CMakeFiles/glfw.dir/x11_monitor.c.o
[ 47%] Building C object glfw/src/CMakeFiles/glfw.dir/x11_window.c.o
[ 52%] Building C object glfw/src/CMakeFiles/glfw.dir/xkb_unicode.c.o
[ 57%] Building C object glfw/src/CMakeFiles/glfw.dir/posix_time.c.o
[ 63%] Building C object glfw/src/CMakeFiles/glfw.dir/posix_thread.c.o
[ 68%] Building C object glfw/src/CMakeFiles/glfw.dir/glx_context.c.o
[ 73%] Building C object glfw/src/CMakeFiles/glfw.dir/egl_context.c.o
[ 78%] Building C object glfw/src/CMakeFiles/glfw.dir/osmesa_context.c.o
[ 84%] Building C object glfw/src/CMakeFiles/glfw.dir/linux_joystick.c.o
[ 89%] Linking C static library libglfw3.a
[ 89%] Built target glfw
Scanning dependencies of target Test
[ 94%] Building CXX object CMakeFiles/Test.dir/main.cpp.o
[100%] Linking CXX executable Test
[100%] Built target Test
Now I am actually curious about rather I messed up somewhere or if it is simply a bug. And if so, where should I report it?
[Clion/Jetbrains?, GLM?, GLFW?, CMake?]
Thanks in advance
Update
I am using the latest available (for me) builds:
CMake version: 3.14.4
Operating System: Arch Linux 5.0.18-1 x86_64 GNU/Linux
GLFW version/commit: d834f01c
GLM version/commit: fce2abd0
Clion: 2019.1.3
Clion EAP: 2019.2 EAP
Final update / 'Solution'
I just discovered that the problem is Clang, not Clion or anything else.
Clion simply defaulted to Clang (instead of GCC).
There are bug reports for GLM and Clang already existing (with potential fixes!):
https://github.com/g-truc/glm/issues/620
https://github.com/g-truc/glm/issues/646
Thank you very much everyone ~

AttributeError: 'module' object has no attribute 'xfeatures2d' [python/opencv 3.1.0 dev]

To resolve this error I tried to add extra module opencv-contrib-master from https://github.com/opencv/opencv_contrib.git I followed the steps given in the readme.md file but while running 'make' I am getting the following output:
[ 4%] Built target libwebp
[ 4%] Built target opencv_core_pch_dephelp
[ 4%] Built target pch_Generate_opencv_core
Scanning dependencies of target opencv_core
[ 4%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/system.cpp.o
Linking CXX shared library ../../lib/libopencv_core.so
[ 7%] Built target opencv_core
[ 7%] Built target opencv_ts_pch_dephelp
[ 7%] Built target pch_Generate_opencv_ts
[ 7%] Built target opencv_imgproc_pch_dephelp
[ 8%] Built target pch_Generate_opencv_imgproc
Linking CXX shared library ../../lib/libopencv_imgproc.so
[ 11%] Built target opencv_imgproc
[ 11%] Built target opencv_imgcodecs_pch_dephelp
[ 11%] Built target pch_Generate_opencv_imgcodecs
Linking CXX shared library ../../lib/libopencv_imgcodecs.so
[ 12%] Built target opencv_imgcodecs
[ 12%] Built target opencv_videoio_pch_dephelp
[ 12%] Built target pch_Generate_opencv_videoio
Linking CXX shared library ../../lib/libopencv_videoio.so
[ 13%] Built target opencv_videoio
[ 13%] Built target opencv_highgui_pch_dephelp
[ 13%] Built target pch_Generate_opencv_highgui
Linking CXX shared library ../../lib/libopencv_highgui.so
[ 14%] Built target opencv_highgui
[ 14%] Built target opencv_ts
[ 14%] Built target opencv_perf_core_pch_dephelp
[ 14%] Built target pch_Generate_opencv_perf_core
Linking CXX executable ../../bin/opencv_perf_core
[ 16%] Built target opencv_perf_core
[ 16%] Built target opencv_test_core_pch_dephelp
[ 16%] Generating test_precomp.hpp.gch/opencv_test_core_RELEASE.gch
In file included from <command-line>:0:0:
/usr/include/stdc-predef.h:1:0: fatal error: can’t create precompiled header /home/chandu/Opencv/opencv/release/modules/core/test_precomp.hpp.gch/opencv_test_core_RELEASE.gch: Permission denied
/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
^
compilation terminated.
Preprocessed source stored into /tmp/cchn5Yvk.out file, please attach this to your bugreport.
ERROR: Cannot create report: [Errno 17] File exists: '/var/crash/_usr_lib_gcc_x86_64-linux-gnu_4.9_cc1plus.1000.crash'
make[2]: *** [modules/core/test_precomp.hpp.gch/opencv_test_core_RELEASE.gch] Error 1
make[1]: *** [modules/core/CMakeFiles/pch_Generate_opencv_test_core.dir/all] Error 2
make: *** [all] Error 2
Somewhere it was told that there may be problem in gcc version but I updated gcc version but no success. I am using gcc of version 4.9.4 and ubuntu of version 14.04.1. Before 'make' step I ran:
cmake -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules /usr/local .. -DWITH_IPP=OFF -DWITH_OPENGL=ON -DWITH_QT=ON -DBUILD_EXAMPLES=ON
I approached many resources but no results. Any kind of help is appreciable.
Did you tried prepending the command with sudo?
The problem is that xfeatures2d was not being exported from opencv-contrib module. So, when I was running 'make' command it was not able to add that module to opencv build module.
I ran the following command followed by make command:
export xfeatures2d=/path/to/opencv_contrib/modules/
It worked for me.

No libclang.a after successfull build for iOS?

I've extracted official llvm/clang sources for 3.7 release, did some minor patching (NSGetEnviron()), configured and build for iOS with cmake:
cmake ../llvm_37_ios \
-DCMAKE_INSTALL_PREFIX=/Volumes/Transcend/dev/src/llvm_37_ios_armv7_installed \
-DLLVM_ENABLE_TERMINFO=OFF \
-DLLVM_ENABLE_THREADS=OFF \
-DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk \
-DCMAKE_C_FLAGS="-stdlib=libc++ -arch armv7 -mios-version-min=8.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk" \
-DCMAKE_CXX_FLAGS="-stdlib=libc++ -arch armv7 -mios-version-min=8.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk" \
-DCMAKE_CROSSCOMPILING=True \
-DLLVM_TABLEGEN=/Volumes/Transcend/dev/src/llvm_37_local_build/bin/llvm-tblgen \
-DCLANG_TABLEGEN=/Volumes/Transcend/dev/src/llvm_37_local_build/bin/clang-tblgen \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_TARGETS_TO_BUILD="ARM;X86"
However i did not find libclang.a but found another libclang*.a libs:
MBA-Anton:llvm_37_ios_armv7_build asmirnov$ find . -name "libclang.a"
MBA-Anton:llvm_37_ios_armv7_build asmirnov$ find . -name "libclang*.a"
./lib/libclangBasic.a
./lib/libclangLex.a
./lib/libclangASTMatchers.a
./lib/libclangParse.a
./lib/libclangDynamicASTMatchers.a
./lib/libclangAnalysis.a
./lib/libclangEdit.a
./lib/libclangRewrite.a
./lib/libclangAST.a
./lib/libclangDriver.a
./lib/libclangCodeGen.a
./lib/libclangSerialization.a
./lib/libclangRewriteFrontend.a
./lib/libclangSema.a
./lib/libclangFrontendTool.a
./lib/libclangARCMigrate.a
./lib/libclangToolingCore.a
./lib/libclangFrontend.a
./lib/libclangIndex.a
./lib/libclangTooling.a
./lib/libclangFormat.a
./lib/libclangStaticAnalyzerFrontend.a
./lib/libclangStaticAnalyzerCore.a
./lib/libclangStaticAnalyzerCheckers.a
For some reason shared library was created but static was not:
Linking CXX executable ../../../../bin/clang
[ 98%] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CIndexDiagnostic.cpp.o
[ 98%] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CIndexHigh.cpp.o
[ 98%] Built target clang
[ 98%] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CIndexInclusionStack.cpp.o
[ 98%] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CIndexUSRs.cpp.o
[ 98%] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CIndexer.cpp.o
[ 98%] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CXComment.cpp.o
[ 98%] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CXCursor.cpp.o
[ 98%] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CXCompilationDatabase.cpp.o
[ 98%] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CXLoadedDiagnostic.cpp.o
[100%] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CXSourceLocation.cpp.o
[100%] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CXStoredDiagnostic.cpp.o
[100%] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CXString.cpp.o
[100%] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CXType.cpp.o
[100%] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/IndexBody.cpp.o
[100%] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/IndexDecl.cpp.o
[100%] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/IndexTypeSourceInfo.cpp.o
[100%] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/Indexing.cpp.o
[100%] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/IndexingContext.cpp.o
Linking CXX shared library ../../../../lib/libclang.dylib
[100%] Built target libclang
Did i miss something or it's clang configuration bug?
libclang is built as a shared library by default because it simplifies consumption from other languages such as Python using FFI or similar mechanisms.
To build a static library use LIBCLANG_BUILD_STATIC CMake option defined in clang/tools/libclang/CMakeLists.txt:
option(LIBCLANG_BUILD_STATIC
"Build libclang as a static library (in addition to a shared one)" OFF)
You can use it as follows:
cmake -DLIBCLANG_BUILD_STATIC=ON ...

can not find <execinfo.h> when setup mlpack

I tried to install mlpack in cygwin and I have already installed armadillo, but I encountered following problems:
After running cmake ../ I run the make command and here is the process:
$ make
Scanning dependencies of target mlpack_headers
Moving header files to include/mlpack/
[ 0%] Built target mlpack_headers
Scanning dependencies of target mlpack
[ 0%] Building CXX object src/mlpack/CMakeFiles/mlpack.dir/core/dists/discrete_distribution.cpp.o
[ 1%] Building CXX object src/mlpack/CMakeFiles/mlpack.dir/core/dists/gaussian_distribution.cpp.o
[ 2%] Building CXX object src/mlpack/CMakeFiles/mlpack.dir/core/dists/laplace_distribution.cpp.o
[ 3%] Building CXX object src/mlpack/CMakeFiles/mlpack.dir/core/kernels/epanechnikov_kernel.cpp.o
[ 4%] Building CXX object src/mlpack/CMakeFiles/mlpack.dir/core/kernels/pspectrum_string_kernel.cpp.o
[ 5%] Building CXX object src/mlpack/CMakeFiles/mlpack.dir/core/math/lin_alg.cpp.o
[ 6%] Building CXX object src/mlpack/CMakeFiles/mlpack.dir/core/math/random.cpp.o
[ 6%] Building CXX object src/mlpack/CMakeFiles/mlpack.dir/core/optimizers/aug_lagrangian/aug_lagrangian_test_functions.cpp.o
[ 7%] Building CXX object src/mlpack/CMakeFiles/mlpack.dir/core/optimizers/lbfgs/test_functions.cpp.o
[ 8%] Building CXX object src/mlpack/CMakeFiles/mlpack.dir/core/optimizers/lrsdp/lrsdp.cpp.o
[ 9%] Building CXX object src/mlpack/CMakeFiles/mlpack.dir/core/optimizers/lrsdp/lrsdp_function.cpp.o
[ 10%] Building CXX object src/mlpack/CMakeFiles/mlpack.dir/core/optimizers/sgd/test_function.cpp.o
[ 11%] Building CXX object src/mlpack/CMakeFiles/mlpack.dir/core/tree/cosine_tree/cosine_tree.cpp.o
[ 12%] Building CXX object src/mlpack/CMakeFiles/mlpack.dir/core/tree/mrkd_statistic.cpp.o
[ 12%] Building CXX object src/mlpack/CMakeFiles/mlpack.dir/core/util/cli.cpp.o
[ 13%] Building CXX object src/mlpack/CMakeFiles/mlpack.dir/core/util/cli_deleter.cpp.o
[ 14%] Building CXX object src/mlpack/CMakeFiles/mlpack.dir/core/util/log.cpp.o
/home/Administrator/mlpack-1.0.11/mlpack-1.0.11/src/mlpack/core/util/log.cpp:24:24: 致命错误:execinfo.h:No such file or directory
#include <execinfo.h>
编译中断。
src/mlpack/CMakeFiles/mlpack.dir/build.make:425: recipe for target 'src/mlpack/CMakeFiles/mlpack.dir/core/util/log.cpp.o' failed
make[2]: * [src/mlpack/CMakeFiles/mlpack.dir/core/util/log.cpp.o] Error 1
CMakeFiles/Makefile2:119: recipe for target 'src/mlpack/CMakeFiles/mlpack.dir/all' failed
make[1]: * [src/mlpack/CMakeFiles/mlpack.dir/all] Error 2
Makefile:116: recipe for target 'all' failed
make: * [all] Error 2
I don't know how to deal with this problem.
Cygwin's gnulib does not provide execinfo.h, possibly due to compatibility issues with the underlying (Windows) system.
From the gnulib documentation:
This header file is missing on some platforms: Mac OS X 10.3, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin, mingw, MSVC 9, Interix 3.5, BeOS.
You may want to try a WinAPI function like CaptureStackBackTrace instead.

How to install OpenCV on OS X Lion using brew

i'm trying to install opencv libraries using brew.
i tried:
sudo brew install opencv
this is the output:
user$ sudo brew install opencv
sudo: /var/db/sudo writable by non-owner (040777), should be mode 0700
WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.
To proceed, enter your password, or type Ctrl-C to abort.
Password:
/usr/local/Library/Homebrew/global.rb:64: warning: Insecure world writable dir /opt/local in PATH, mode 040777
/usr/local/bin/brew:74: warning: Insecure world writable dir /opt/local in PATH, mode 040777
Warning: It appears you have MacPorts or Fink installed.
Software installed with other package managers causes known problems for
Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again.
/usr/local/Library/Homebrew/build.rb:7: warning: Insecure world writable dir /opt/local in PATH, mode 040777
==> Downloading http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.3.1/OpenCV-2.3.1a.tar.bz2
File already downloaded in /Library/Caches/Homebrew
==> Patching
patching file modules/highgui/src/grfmt_exr.hpp
==> cmake . -DCMAKE_INSTALL_PREFIX='/usr/local/Cellar/opencv/2.3.1a' -DCMAKE_BUILD_TYPE=None -Wno-dev -DPYTHON_LIBRARY='/System/Library/Frameworks/Python.framework/Versions/2.7/Python' -DP
==> make
Scanning dependencies of target opencv_core
[ 1%] [ 1%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/arithm.o
Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/alloc.o
[ 1%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/array.o
[ 1%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/cmdparser.o
[ 1%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/convert.o
[ 2%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/copy.o
[ 2%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/datastructs.o
[ 2%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/drawing.o
[ 2%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/dxt.o
[ 3%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/lapack.o
[ 3%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/mathfuncs.o
[ 3%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/matmul.o
[ 3%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/matop.o
[ 4%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/matrix.o
[ 4%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/out.o
[ 4%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/persistence.o
[ 4%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/precomp.o
[ 5%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/rand.o
[ 5%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/stat.o
[ 5%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/system.o
[ 5%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/tables.o
Linking CXX shared library ../../lib/libopencv_core.dylib
[ 5%] Built target opencv_core
Scanning dependencies of target opencv_flann
[ 6%] Building CXX object modules/flann/CMakeFiles/opencv_flann.dir/src/flann.o
Scanning dependencies of target opencv_imgproc
[ 6%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/accum.o
In file included from /tmp/homebrew-opencv-2.3.1a-dWXV/OpenCV-2.3.1/modules/flann/src/flann.cpp:29:
In file included from /tmp/homebrew-opencv-2.3.1a-dWXV/OpenCV-2.3.1/modules/flann/src/precomp.hpp:17:
In file included from /tmp/homebrew-opencv-2.3.1a-dWXV/OpenCV-2.3.1/modules/flann/include/opencv2/flann/all_indices.h:42:
/tmp/homebrew-opencv-2.3.1a-dWXV/OpenCV-2.3.1/modules/flann/include/opencv2/flann/lsh_index.h:89:81: error: no matching constructor for initialization of 'cvflann::LshIndexParams'
LshIndex(const Matrix<ElementType>& input_data, const IndexParams& params = LshIndexParams(),
^
/tmp/homebrew-opencv-2.3.1a-dWXV/OpenCV-2.3.1/modules/flann/include/opencv2/flann/lsh_index.h:59:5: note: candidate constructor not viable: requires 3 arguments, but 0 were provided
LshIndexParams(unsigned int table_number, unsigned int key_size, unsigned int multi_probe_level)
^
/tmp/homebrew-opencv-2.3.1a-dWXV/OpenCV-2.3.1/modules/flann/include/opencv2/flann/lsh_index.h:57:8: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 0 were provided
struct LshIndexParams : public IndexParams
^
In file included from /tmp/homebrew-opencv-2.3.1a-dWXV/OpenCV-2.3.1/modules/flann/src/flann.cpp:29:
In file included from /tmp/homebrew-opencv-2.3.1a-dWXV/OpenCV-2.3.1/modules/flann/src/precomp.hpp:10:
In file included from /tmp/homebrew-opencv-2.3.1a-dWXV/OpenCV-2.3.1/modules/flann/include/opencv2/flann/index_testing.h:39:
In file included from /tmp/homebrew-opencv-2.3.1a-dWXV/OpenCV-2.3.1/modules/flann/include/opencv2/flann/nn_index.h:39:
In file included from /tmp/homebrew-opencv-2.3.1a-dWXV/OpenCV-2.3.1/modules/flann/include/opencv2/flann/params.h:33:
/tmp/homebrew-opencv-2.3.1a-dWXV/OpenCV-2.3.1/modules/flann/include/opencv2/flann/any.h:88:67: error: call to function 'operator<<' that is neither visible in the template definition nor found by argument-dependent lookup
virtual void print(std::ostream& out, void* const* src) { out << *reinterpret_cast<T const*>(*src); }
^
/tmp/homebrew-opencv-2.3.1a-dWXV/OpenCV-2.3.1/modules/flann/include/opencv2/flann/any.h:136:44: note: in instantiation of member function 'cdiggins::anyimpl::big_any_policy<cdiggins::anyimpl::empty_any>::print' requested here
static typename choose_policy<T>::type policy;
^
/tmp/homebrew-opencv-2.3.1a-dWXV/OpenCV-2.3.1/modules/flann/include/opencv2/flann/any.h:159:18: note: in instantiation of function template specialization 'cdiggins::anyimpl::get_policy<cdiggins::anyimpl::empty_any>' requested here
: policy(anyimpl::get_policy<anyimpl::empty_any>()), object(NULL)
^
/tmp/homebrew-opencv-2.3.1a-dWXV/OpenCV-2.3.1/modules/flann/include/opencv2/flann/any.h:276:22: note: 'operator<<' should be declared prior to the call site or in namespace 'cdiggins::anyimpl'
inline std::ostream& operator <<(std::ostream& out, const any& any_val)
^
2 errors generated.
make[2]: *** [modules/flann/CMakeFiles/opencv_flann.dir/src/flann.o] Error 1
make[1]: *** [modules/flann/CMakeFiles/opencv_flann.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 7%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/approx.o
[ 7%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/canny.o
[ 7%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/color.o
[ 7%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/contours.o
[ 8%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/convhull.o
[ 8%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/corner.o
[ 8%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/cornersubpix.o
[ 8%] [ 9%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/deriv.o
Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/distransform.o
[ 9%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/emd.o
[ 9%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/featureselect.o
[ 9%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/featuretree.o
[ 10%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/filter.o
[ 10%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/floodfill.o
[ 10%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/geometry.o
[ 10%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/grabcut.o
[ 11%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/histogram.o
[ 11%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/hough.o
[ 11%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/imgwarp.o
[ 11%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/inpaint.o
[ 12%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/kdtree.o
[ 12%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/linefit.o
[ 12%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/lsh.o
[ 12%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/matchcontours.o
[ 12%] [ 13%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/moments.o
Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/morph.o
[ 13%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/precomp.o
[ 13%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/pyramids.o
[ 13%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/pyrsegmentation.o
[ 14%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/rotcalipers.o
[ 14%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/samplers.o
[ 14%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/segmentation.o
[ 14%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/shapedescr.o
[ 15%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/smooth.o
[ 15%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/spilltree.o
[ 15%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/subdivision2d.o
[ 15%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/sumpixels.o
[ 16%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/tables.o
[ 16%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/templmatch.o
[ 16%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/thresh.o
[ 16%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/undistort.o
[ 17%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/utils.o
Linking CXX shared library ../../lib/libopencv_imgproc.dylib
[ 17%] Built target opencv_imgproc
make: *** [all] Error 2
CMakeCache.txt was copied to /Users/turchijacopo/Library/Logs/Homebrew
==> Exit Status: 2
http://github.com/mxcl/homebrew/blob/master/Library/Formula/opencv.rb#L76
==> Environment
HOMEBREW_VERSION: 0.8.1
HEAD: 3b771d09e48f4dfa88ef4c5d32f3b84ca2ae18ec
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
Hardware: dual-core 64-bit penryn
OS X: 10.7.3
Kernel Architecture: x86_64
Xcode: 4.3.1
GCC-4.0: N/A
GCC-4.2: N/A
LLVM: build 2336
Clang: 3.0 build 211
MacPorts or Fink? /opt/local/bin/port
X11: /usr/X11
System Ruby: 1.8.7-249
/usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
Which Perl: /usr/bin/perl
Which Python: /usr/bin/python
Which Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
==> Build Flags
CC: /usr/bin/clang
CXX: /usr/bin/clang++ => /usr/bin/clang
LD: /usr/bin/clang
CFLAGS: -Os -w -pipe -march=native -Qunused-arguments
CXXFLAGS: -Os -w -pipe -march=native -Qunused-arguments
MAKEFLAGS: -j2
Error: Failed executing: make
These existing issues may help you:
https://github.com/mxcl/homebrew/issues/10862
Otherwise, please report the bug:
https://github.com/mxcl/homebrew/wiki/checklist-before-filing-a-new-issue
what can i do ?
You can start by reading the error message:
These existing issues may help you:
https://github.com/mxcl/homebrew/issues/10862
That's probably not your problem, but one idea is to try to install OpenCV 32-bits:
brew install opencv --32-bit
And if that doesn't work:
please report the bug:
https://github.com/mxcl/homebrew/wiki/checklist-before-filing-a-new-issue
You can always download OpenCV source code and compile it yourself. It's what I did on Mac OS X.