I built the libfreenect (Open Kinect) library from sorce, but the libraries and headers are nowhere to be found. I have checked the paths specified in the configuration step, i.e., /usr/local, /usr/local/lib, usr/local/include.
Has anyone faced this problem with libfreenect or any other library?
~/libfreenect/build\ $ cmake -L .. -DBUILD_AUDIO=ON -DBUILD_CV=ON
-- The C compiler identification is GNU 4.8.2
-- The CXX compiler identification is GNU 4.8.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Operating system is Linux
-- Got System Processor x86_64
-- Linux x86_64 Detected
-- libfreenect will be installed to /usr/local
-- Headers will be installed to /usr/local/include/libfreenect
-- Libraries will be installed to /usr/local/lib
-- Found libusb-1.0:
-- - Includes: /usr/include/libusb-1.0
-- - Libraries: /usr/lib/x86_64-linux-gnu/libusb-1.0.so
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Using unsigned short
-- Check if the system is big endian - little endian
-- Found PythonInterp: python2 (found version "2.7.6")
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found X11: /usr/lib/x86_64-linux-gnu/libX11.so
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libGL.so
-- Found GLUT: /usr/lib/x86_64-linux-gnu/libglut.so
-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:
BUILD_AUDIO
-- Build files have been written to: /home/rohit/libfreenect/build
-- Cache values
BUILD_AS3_SERVER:BOOL=OFF
BUILD_CPACK_DEB:BOOL=OFF
BUILD_CPACK_RPM:BOOL=OFF
BUILD_CPACK_TGZ:BOOL=OFF
BUILD_CPP:BOOL=ON
BUILD_CV:BOOL=ON
BUILD_C_SYNC:BOOL=ON
BUILD_EXAMPLES:BOOL=ON
BUILD_FAKENECT:BOOL=ON
BUILD_OPENNI2_DRIVER:BOOL=OFF
BUILD_PYTHON:BOOL=OFF
BUILD_REDIST_PACKAGE:BOOL=ON
CMAKE_BUILD_TYPE:STRING=
CMAKE_INSTALL_PREFIX:PATH=/usr/local
LIBUSB_1_INCLUDE_DIR:PATH=/usr/include/libusb-1.0
LIBUSB_1_LIBRARY:FILEPATH=/usr/lib/x86_64-linux-gnu/libusb-1.0.so
OpenCV_DIR:PATH=/usr/local/share/OpenCV
~/libfreenect/build\ $ make
Scanning dependencies of target freenect
[ 2%] Building C object src/CMakeFiles/freenect.dir/core.c.o
[ 5%] Building C object src/CMakeFiles/freenect.dir/tilt.c.o
[ 8%] Building C object src/CMakeFiles/freenect.dir/cameras.c.o
[ 11%] Building C object src/CMakeFiles/freenect.dir/flags.c.o
[ 14%] Building C object src/CMakeFiles/freenect.dir/usb_libusb10.c.o
[ 17%] Building C object src/CMakeFiles/freenect.dir/registration.c.o
[ 20%] Building C object src/CMakeFiles/freenect.dir/audio.c.o
[ 23%] Building C object src/CMakeFiles/freenect.dir/loader.c.o
/home/rohit/libfreenect/src/loader.c:82:12: warning: ‘check_version_string’ defined but not used [-Wunused-function]
static int check_version_string(fnusb_dev* dev) {
^
Linking C shared library ../lib/libfreenect.so
[ 23%] Built target freenect
Scanning dependencies of target freenectstatic
[ 26%] Building C object src/CMakeFiles/freenectstatic.dir/core.c.o
[ 29%] Building C object src/CMakeFiles/freenectstatic.dir/tilt.c.o
[ 32%] Building C object src/CMakeFiles/freenectstatic.dir/cameras.c.o
[ 35%] Building C object src/CMakeFiles/freenectstatic.dir/flags.c.o
[ 38%] Building C object src/CMakeFiles/freenectstatic.dir/usb_libusb10.c.o
[ 41%] Building C object src/CMakeFiles/freenectstatic.dir/registration.c.o
[ 44%] Building C object src/CMakeFiles/freenectstatic.dir/audio.c.o
[ 47%] Building C object src/CMakeFiles/freenectstatic.dir/loader.c.o
/home/rohit/libfreenect/src/loader.c:82:12: warning: ‘check_version_string’ defined but not used [-Wunused-function]
static int check_version_string(fnusb_dev* dev) {
^
Linking C static library ../lib/libfreenect.a
[ 47%] Built target freenectstatic
Scanning dependencies of target freenect-camtest
[ 50%] Building C object examples/CMakeFiles/freenect-camtest.dir/camtest.c.o
Linking C executable ../bin/freenect-camtest
[ 50%] Built target freenect-camtest
Scanning dependencies of target freenect-chunkview
[ 52%] Building C object examples/CMakeFiles/freenect-chunkview.dir/chunkview.c.o
Linking C executable ../bin/freenect-chunkview
[ 52%] Built target freenect-chunkview
Scanning dependencies of target freenect_sync
[ 55%] Building C object wrappers/c_sync/CMakeFiles/freenect_sync.dir/libfreenect_sync.c.o
Linking C shared library ../../lib/libfreenect_sync.so
[ 55%] Built target freenect_sync
Scanning dependencies of target freenect-glpclview
[ 58%] Building C object examples/CMakeFiles/freenect-glpclview.dir/glpclview.c.o
Linking C executable ../bin/freenect-glpclview
[ 58%] Built target freenect-glpclview
Scanning dependencies of target freenect-glview
[ 61%] Building C object examples/CMakeFiles/freenect-glview.dir/glview.c.o
Linking C executable ../bin/freenect-glview
[ 61%] Built target freenect-glview
Scanning dependencies of target freenect-hiview
[ 64%] Building C object examples/CMakeFiles/freenect-hiview.dir/hiview.c.o
Linking C executable ../bin/freenect-hiview
[ 64%] Built target freenect-hiview
Scanning dependencies of target freenect-micview
[ 67%] Building C object examples/CMakeFiles/freenect-micview.dir/micview.c.o
Linking C executable ../bin/freenect-micview
[ 67%] Built target freenect-micview
Scanning dependencies of target freenect-regtest
[ 70%] Building C object examples/CMakeFiles/freenect-regtest.dir/regtest.c.o
Linking C executable ../bin/freenect-regtest
[ 70%] Built target freenect-regtest
Scanning dependencies of target freenect-regview
[ 73%] Building C object examples/CMakeFiles/freenect-regview.dir/regview.c.o
Linking C executable ../bin/freenect-regview
[ 73%] Built target freenect-regview
Scanning dependencies of target freenect-tiltdemo
[ 76%] Building C object examples/CMakeFiles/freenect-tiltdemo.dir/tiltdemo.c.o
Linking C executable ../bin/freenect-tiltdemo
[ 76%] Built target freenect-tiltdemo
Scanning dependencies of target freenect-wavrecord
[ 79%] Building C object examples/CMakeFiles/freenect-wavrecord.dir/wavrecord.c.o
Linking C executable ../bin/freenect-wavrecord
[ 79%] Built target freenect-wavrecord
Scanning dependencies of target fakenect
[ 82%] Building C object fakenect/CMakeFiles/fakenect.dir/fakenect.c.o
Linking C shared library ../lib/fakenect/libfreenect.so
[ 82%] Built target fakenect
Scanning dependencies of target fakenect-record
[ 85%] Building C object fakenect/CMakeFiles/fakenect-record.dir/record.c.o
Linking C executable ../bin/fakenect-record
[ 85%] Built target fakenect-record
Scanning dependencies of target freenect_sync_static
[ 88%] Building C object wrappers/c_sync/CMakeFiles/freenect_sync_static.dir/libfreenect_sync.c.o
Linking C static library ../../lib/libfreenect_sync.a
[ 88%] Built target freenect_sync_static
Scanning dependencies of target freenect-cpp_pcview
[ 91%] Building CXX object wrappers/cpp/CMakeFiles/freenect-cpp_pcview.dir/cpp_pc_view.cpp.o
Linking CXX executable ../../bin/freenect-cpp_pcview
[ 91%] Built target freenect-cpp_pcview
Scanning dependencies of target freenect-cppview
[ 94%] Building CXX object wrappers/cpp/CMakeFiles/freenect-cppview.dir/cppview.cpp.o
Linking CXX executable ../../bin/freenect-cppview
[ 94%] Built target freenect-cppview
Scanning dependencies of target freenect_cv
[ 97%] Building C object wrappers/opencv/CMakeFiles/freenect_cv.dir/libfreenect_cv.c.o
Linking CXX shared library ../../lib/libfreenect_cv.so
[ 97%] Built target freenect_cv
Scanning dependencies of target freenect-cvdemo
[100%] Building C object wrappers/opencv/CMakeFiles/freenect-cvdemo.dir/cvdemo.c.o
Linking CXX executable ../../bin/freenect-cvdemo
[100%] Built target freenect-cvdemo
To find where your library has been built, from the build directory call:
find -name \*.so (dynamic libraries, that seems to be the case) or find -name \*.a (static libraries).
Anyway, if you do sudo make install, your libraries will be installed in /usr/local/lib as stated in your cmake output.
Related
I am trying to install the following C library:
https://github.com/kwhat/libuiohook
I did the described steps which seem to work with no error.
$ git clone https://github.com/kwhat/libuiohook
$ cd uiohook
$ mkdir build && cd build
$ cmake -S .. -D BUILD_SHARED_LIBS=ON -D BUILD_DEMO=ON -DCMAKE_INSTALL_PREFIX=../dist
$ cmake --build . --parallel 2 --target install
The problem is I don't know what to do next.
I tried to copy the code from the simple hook example and tried to execute the code in a different executable with the following CMakeLists.txt.
cmake_minimum_required(VERSION 3.20)
project(libuihook_test)
include_directories("/Users/ahoehne/libuiohook/dist/include")
find_library(lib uiohook)
if(NOT lib)
message(FATAL_ERROR "uiohook library not found")
endif()
set(CMAKE_CXX_STANDARD 17)
add_executable(libuihook_test main.cpp)
target_link_libraries(libuihook_test lib)
which doesn't work and results in a
CMake Error at CMakeLists.txt:9 (message):
uiohook library not found
the log from installing is the following:
[ 14%] Building C object CMakeFiles/uiohook.dir/src/darwin/input_helper.c.o
[ 14%] Building C object CMakeFiles/uiohook.dir/src/logger.c.o
[ 21%] Building C object CMakeFiles/uiohook.dir/src/darwin/input_hook.c.o
[ 28%] Building C object CMakeFiles/uiohook.dir/src/darwin/post_event.c.o
[ 35%] Building C object CMakeFiles/uiohook.dir/src/darwin/system_properties.c.o
[ 42%] Linking C shared library libuiohook.dylib
[ 42%] Built target uiohook
[ 57%] Building C object CMakeFiles/demo_post.dir/demo/demo_post.c.o
[ 57%] Building C object CMakeFiles/demo_properties.dir/demo/demo_properties.c.o
[ 71%] Linking C executable demo_properties
[ 71%] Linking C executable demo_post
[ 71%] Built target demo_post
[ 71%] Built target demo_properties
[ 78%] Building C object CMakeFiles/demo_hook.dir/demo/demo_hook.c.o
[ 85%] Building C object CMakeFiles/demo_hook_async.dir/demo/demo_hook_async.c.o
[ 92%] Linking C executable demo_hook
[100%] Linking C executable demo_hook_async
[100%] Built target demo_hook
[100%] Built target demo_hook_async
Install the project...
-- Install configuration: ""
-- Installing: /Users/ahoehne/libuiohook/dist/lib/libuiohook.1.2.0.dylib
-- Up-to-date: /Users/ahoehne/libuiohook/dist/lib/libuiohook.1.dylib
-- Up-to-date: /Users/ahoehne/libuiohook/dist/lib/libuiohook.dylib
-- Up-to-date: /Users/ahoehne/libuiohook/dist/include/uiohook.h
-- Installing: /Users/ahoehne/libuiohook/dist/lib/cmake/uiohook/uiohook-config.cmake
-- Installing: /Users/ahoehne/libuiohook/dist/lib/cmake/uiohook/uiohook-config-noconfig.cmake
-- Installing: /Users/ahoehne/libuiohook/dist/bin/demo_hook
-- Installing: /Users/ahoehne/libuiohook/dist/bin/demo_hook_async
-- Installing: /Users/ahoehne/libuiohook/dist/bin/demo_post
-- Installing: /Users/ahoehne/libuiohook/dist/bin/demo_properties
-- Installing: /Users/ahoehne/libuiohook/dist/lib/pkgconfig/uiohook.pc
I consulted the CMAKE Docs but honestly right now confuses me more than it helps. I am sure at some point I will have an aha moment and connect the dots. Most tutorials do an excellent job of explaining you C/C++ but they all lack the more advanced stuff around build tools, testing, debugging, and so on, everything you basically need to build more complex projects. So I am also grateful for book/video suggestions.
I also tried different combinations of include_directories, add, link library also an absolute path but nothing seems to work and I get a library not found error or uiohook.h not found.
I am well aware that C and C++ are completely different languages and different practices apply I am not sure If I could have fixed this question to one. But basically try to learn C++ but need to access a lot of C libs.
As the library provides a uiohook-config.cmake you should use that to link to the library via find_package rather than using find_library.
Something like this should work:
set(CMAKE_PREFIX_PATH /Users/ahoehne/libuiohook/dist/lib/cmake/uiohook/)
find_package(uiohook REQURIED)
target_link_libraries(libuihook_test uiohook)
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 ...
Talking about a Qt 5.3.2 project which is buildt using cmake.
This is a calling order problem between UIC execution and target_link_libraries... unfortunately not in that order.
Below this text you will find
1.) a (still functional) excerpt section of my CMakeLists.txt and
2.) an excerpt of the the output of the command 'cmake .'
3.) the output of a following call to 'make' without using the
generated headers like 'ui_main.h'.
If (in the source of my library libqt.a) I require 'ui_main.h' the
make process crashes not finding the header. Looking at the
non-crashing make output shows why:
[..]
Scanning dependencies of target qt
[ 29%] Building CXX object CMakeFiles/qt.dir/home/kochmn/projects/sentinel/src/qt/form_main.cpp.o
[ 35%] Building CXX object CMakeFiles/qt.dir/qt_automoc.cpp.o
Linking CXX static library libqt.a
[..]
[ 52%] Generating ui_main.h
[..]
Make would generate libqt.a before generating the required header file.
So I experimented using code like
target_link_libraries(sentinel
${Qt5Widgets_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Core_LIBRARIES})
add_library(optimization "${DIR_SRC}/optimization/linalg.cpp")
add_library(qt "${DIR_SRC}/qt/form_main.cpp")
target_link_libraries(sentinel qt optimization)
to no avail. The question: How can I motivate cmake to first run UIC generating the ui-header files and then compiling my libqt.a?
Appendix
# 2.8.11 instead of 2.8 required for automatic linking to the qtmain.lib
# library if this ever should expand to Windows.
# (http://doc.qt.io/qt-5/cmake-manual.html)
cmake_minimum_required(VERSION 2.8.11)
project(sentinel)
set( CMAKE_AUTOMOC ON )
# CMake uses uic in order to generate header files from .ui forms from designer.
set ( CMAKE AUTOUIC ON )
# Auto-generating functions write their headers into the build directory.
# Hence the build directory should be included.
set( CMAKE_INCLUDE_CURRENT_DIR ON )
#> Getting the Qt essentials. ----------------------------------------
# Widgets finds its own dependencies (QtGui and QtCore).
find_package(Qt5Widgets REQUIRED)
message ("Found Qt5Widgets Version ${Qt5Widgets_VERSION_STRING}")
# All those darling variables are explained here:
# http://doc.qt.io/qt-5/cmake-manual.html
message("Core FOUND: ${Qt5Core_FOUND}")
message("Gui FOUND: ${Qt5Gui_FOUND}")
message("Widgets FOUND: ${Qt5Widgets_FOUND}")
message("Core VERSION: ${Qt5Core_VERSION_STRING}")
message("Gui VERSION: ${Qt5Gui_VERSION_STRING}")
message("Widgets VERSION: ${Qt5Widgets_VERSION_STRING}")
message("Core INCLUDE: ${Qt5Core_INCLUDE_DIRS}")
message("Gui INCLUDE: ${Qt5Gui_INCLUDE_DIRS}")
message("Widgets INCLUDE: ${Qt5Widgets_INCLUDE_DIRS}")
message("Core LIBRARIES: ${Qt5Core_LIBRARIES}")
message("Gui LIBRARIES: ${Qt5Gui_LIBRARIES}")
message("Widgets LIBRARIES: ${Qt5Widgets_LIBRARIES}")
message("Core DEFINITIONS: ${Qt5Core_DEFINITIONS}")
message("Gui DEFINITIONS: ${Qt5Gui_DEFINITIONS}")
message("Widgets DEFINITIONS: ${Qt5Widgets_DEFINITIONS}")
message("Core COMPILE_DEFINITIONS: ${Qt5Core_COMPILE_DEFINITIONS}")
message("Gui COMPILE_DEFINITIONS: ${Qt5Gui_COMPILE_DEFINITIONS}")
message("Widgets COMPILE_DEFINITIONS: ${Qt5Widgets_COMPILE_DEFINITIONS}")
message("Core EXECUTABLE_COMPILE_FLAGS: ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}")
message("Gui EXECUTABLE_COMPILE_FLAGS: ${Qt5Gui_EXECUTABLE_COMPILE_FLAGS}")
message("Widgets EXECUTABLE_COMPILE_FLAGS: ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
include_directories(
${Qt5Widgets_INCLUDE_DIRS} ${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS})
add_definitions(${Qt5Widgets_DEFINITIONS})
#add_definitions(${Qt5Core_DEFINITIONS}) # Unnecessary. In Widgets.
#add_definitions(${Qt5Gui_DEFINITIONS}) # Unnecessary. In Widgets.
#< -------------------------------------------------------------------
set (DEBUG 1)
set (SENTINEL_NAME "Sentinel GL")
set (SENTINEL_VERSION_MAJOR "0")
set (SENTINEL_VERSION_MINOR "1")
set (SENTINEL_VERSION "${SENTINEL_VERSION_MAJOR}.${SENTINEL_VERSION_MINOR}")
## Compiler flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
# ${Qt5Core_EXECUTABLE_COMPILE_FLAGS} ${Qt5Gui_EXECUTABLE_COMPILE_FLAGS} #<-- redundant.
if(CMAKE_COMPILER_IS_GNUCXX)
message("Using GnuCXX compiler.")
add_definitions("-O0 -std=c++0x -lSOIL -llapacke -lblas")
endif()
if (DEBUG MATCHES 1)
message("\nBuilding DEBUG build.")
add_definitions(-Wall)
set(CMAKE_BUILD_TYPE Debug)
endif()
set(DIR_BASE "${PROJECT_SOURCE_DIR}/..")
set(DIR_SRC "${PROJECT_SOURCE_DIR}/../src")
set(DIR_RES "${PROJECT_SOURCE_DIR}/../resources")
set(DIR_BUILD "${PROJECT_SOURCE_DIR}/../build")
# Generated using uic FormMain.ui > ui_FormMain.h
set(qt_H
"${DIR_BUILD}/ui_main.h" "${DIR_BUILD}/ui_dialog_setup_game.h")
# Generated using the trusty QtDesigner.
set(qt_UI
"${DIR_SRC}/ui/main.ui" "${DIR_SRC}/ui/dialog_setup_game.ui")
# My own hand-written XML describing the internal resources.
set(qt_QRC "${DIR_RES}/application.qrc")
# generate rules for building source files that moc generates
QT5_WRAP_CPP(qt_H_MOC ${qt_H})
# generate rules for building header files from the ui files
QT5_WRAP_UI(qt_UI_H ${qt_UI})
# Resource Handling. QRC: "Qt Resource Collection"
QT5_ADD_RESOURCES(qt_RCCS ${qt_QRC})
# btw.: rcc generates a C program from ./resources/application.qrc
# However, this is not needed. cmake sees to that. :-)
#< -------------------------------------------------------------------
include_directories("${DIR_SRC}/include" "${PROJECT_SOURCE_DIR}")
add_executable(sentinel "${DIR_SRC}/sentinel.cpp" ${qt_H_MOC} ${qt_UI_H} ${qt_RCCS})
# Available modules are listed here: http://doc.qt.io/qt-5/qtmodules.html
# find /usr/lib/x86_64-linux-gnu/cmake -iname "*.cmake*" | less
# Note: http://stackoverflow.com/questions/20266235/cmake-error-qglwidget-no-such-file-or-directory
qt5_use_modules(sentinel Widgets Gui Core)
add_library(optimization "${DIR_SRC}/optimization/linalg.cpp")
add_library(qt "${DIR_SRC}/qt/form_main.cpp")
target_link_libraries(sentinel
${Qt5Widgets_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Core_LIBRARIES}
qt optimization
)
kochmn#Ulyss:~/projects/sentinel/build$ cmake .
-- The C compiler identification is GNU 4.9.2
-- The CXX compiler identification is GNU 4.9.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
Found Qt5Widgets Version 5.3.2
Core FOUND: 1
Gui FOUND: 1
Widgets FOUND: 1
Core VERSION: 5.3.2
Gui VERSION: 5.3.2
Widgets VERSION: 5.3.2
Core INCLUDE: /usr/include/x86_64-linux-gnu/qt5/;/usr/include/x86_64-linux-gnu/qt5/QtCore;/usr/lib/x86_64-linux-gnu/qt5//mkspecs/linux-g++-64
Gui INCLUDE: /usr/include/x86_64-linux-gnu/qt5/;/usr/include/x86_64-linux-gnu/qt5/QtGui;/usr/include/x86_64-linux-gnu/qt5/QtCore;/usr/lib/x86_64-linux-gnu/qt5//mkspecs/linux-g++-64
Widgets INCLUDE: /usr/include/x86_64-linux-gnu/qt5/;/usr/include/x86_64-linux-gnu/qt5/QtWidgets;/usr/include/x86_64-linux-gnu/qt5/QtGui;/usr/include/x86_64-linux-gnu/qt5/QtCore;/usr/lib/x86_64-linux-gnu/qt5//mkspecs/linux-g++-64
Core LIBRARIES: Qt5::Core
Gui LIBRARIES: Qt5::Gui
Widgets LIBRARIES: Qt5::Widgets
Core DEFINITIONS: -DQT_CORE_LIB
Gui DEFINITIONS: -DQT_GUI_LIB;-DQT_CORE_LIB
Widgets DEFINITIONS: -DQT_WIDGETS_LIB;-DQT_GUI_LIB;-DQT_CORE_LIB
Core COMPILE_DEFINITIONS: QT_CORE_LIB
Gui COMPILE_DEFINITIONS: QT_GUI_LIB;QT_CORE_LIB
Widgets COMPILE_DEFINITIONS: QT_WIDGETS_LIB;QT_GUI_LIB;QT_CORE_LIB
Core EXECUTABLE_COMPILE_FLAGS: -fPIE
Gui EXECUTABLE_COMPILE_FLAGS: -fPIE
Widgets EXECUTABLE_COMPILE_FLAGS: -fPIE
Using GnuCXX compiler.
Building DEBUG build.
Sentinel GL -- C++ Project V 0.1.
(c) Markus-Hermann Koch, mhk#markuskoch.eu, 2015/04/28-?
Primary directory is /home/kochmn/projects/sentinel/build
System is Linux
Generating configuration header: "/home/kochmn/projects/sentinel/build/../build/mhk_cmake_config.h"
-- Configuring done
-- Generating done
-- Build files have been written to: /home/kochmn/projects/sentinel/build
kochmn#Ulyss:~/projects/sentinel/build$ make
Scanning dependencies of target optimization_automoc
[ 5%] Automatic moc for target optimization
[ 5%] Built target optimization_automoc
Scanning dependencies of target optimization
[ 11%] Building CXX object CMakeFiles/optimization.dir/home/kochmn/projects/sentinel/src/optimization/linalg.cpp.o
[ 17%] Building CXX object CMakeFiles/optimization.dir/optimization_automoc.cpp.o
Linking CXX static library liboptimization.a
[ 17%] Built target optimization
Scanning dependencies of target qt_automoc
[ 23%] Automatic moc for target qt
[ 23%] Built target qt_automoc
Scanning dependencies of target qt
[ 29%] Building CXX object CMakeFiles/qt.dir/home/kochmn/projects/sentinel/src/qt/form_main.cpp.o
[ 35%] Building CXX object CMakeFiles/qt.dir/qt_automoc.cpp.o
Linking CXX static library libqt.a
[ 35%] Built target qt
Scanning dependencies of target sentinel_automoc
[ 41%] Automatic moc for target sentinel
[ 41%] Built target sentinel_automoc
[ 47%] Generating qrc_application.cpp
[ 52%] Generating ui_main.h
[ 58%] Generating moc_ui_main.cpp
/home/kochmn/projects/sentinel/build/ui_main.h:0: Note: No relevant classes found. No output generated.
[ 64%] Generating ui_dialog_setup_game.h
[ 70%] Generating moc_ui_dialog_setup_game.cpp
/home/kochmn/projects/sentinel/build/ui_dialog_setup_game.h:0: Note: No relevant classes found. No output generated.
Scanning dependencies of target sentinel
[ 76%] Building CXX object CMakeFiles/sentinel.dir/home/kochmn/projects/sentinel/src/sentinel.cpp.o
[ 82%] Building CXX object CMakeFiles/sentinel.dir/moc_ui_main.cpp.o
[ 88%] Building CXX object CMakeFiles/sentinel.dir/moc_ui_dialog_setup_game.cpp.o
[ 94%] Building CXX object CMakeFiles/sentinel.dir/qrc_application.cpp.o
[100%] Building CXX object CMakeFiles/sentinel.dir/sentinel_automoc.cpp.o
Linking CXX executable sentinel
[100%] Built target sentinel
CMake generation order is computed from dependencies between files and targets. If your qt library depends on headers generated from .ui files, then you have to add ${qt_UI_H} in inputs of target qt:
QT5_WRAP_UI(qt_UI_H ${qt_UI})
[...]
add_library(qt "${DIR_SRC}/qt/form_main.cpp" ${qt_UI_H})
And CMake should normally execute UIC on .ui files before compiling libqt
By the way using target_link_libraries only set dependencies between targets at link time. At compile time, the normal behavior is "All source files should be found". In your case, some headers are generated, so setting these headers as input of a target ensures that the macro which generates them (QT5_WRAP_UI) will be executed before the compilation of the target.
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.
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.