Can not configure OpenCv and PCL with XCode project on macOS - xcode

I am trying to create a new XCode project. I already configured opencv, but now i need both opencv and pcl libraries. I tried to make a makefile.txt, but i got the following error:
make[2]: *** No rule to make target `/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk/usr/lib/libz.tbd', needed by `SurfaceDetection'. Stop.
make[1]: *** [CMakeFiles/SurfaceDetection.dir/all] Error 2
make: *** [all] Error 2
this is my cmakefile:
cmake_minimum_required(VERSION 3.2.1)
project (SurfaceDetection)
find_package(PCL REQUIRED COMPONENTS)
find_package(OpenCV REQUIRED)
include_directories(${PCL_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
add_executable (SurfaceDetection main.cpp)
target_link_libraries (SurfaceDetection ${PCL_LIBRARIES} ${OpenCV_LIBS})

I found out what caused this error. You can check out what system version is your macos, once updated to macos 11.1, you have to reinstall command line tools and redirect the sdks of the project.

Related

nvcc fatal : Unknown option 'pthread'

I am trying to install Elemental. I cloned it from the GitHub directory. Made a build directory and ran cmake command in it. But when I do a make, it shows the following error message:
[ 73%] Linking CUDA device code
CMakeFiles/EntrywiseMap.dir/cmake_device_link.o
nvcc fatal : Unknown option 'pthread'
tests/CMakeFiles/EntrywiseMap.dir/build.make:99: recipe for target
'tests/CMakeFiles/EntrywiseMap.dir/cmake_device_link.o' failed
make[2]: *** [tests/CMakeFiles/EntrywiseMap.dir/cmake_device_link.o]
Error 1
CMakeFiles/Makefile2:1506: recipe for target
'tests/CMakeFiles/EntrywiseMap.dir/all' failed
make[1]: *** [tests/CMakeFiles/EntrywiseMap.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
I am using ubuntu 18, with cuda 10 and cmake version 3.13.4
What's the version of Cmake? This issue seems to be on CMake 3.12 and fixed on CMake 3.13
For me moving to the newer version of CMake 3.14.0 helped get past the issue.

Create a shared lib that depends on dlib using Cmake

I'm building a shared library in C++ that depends on dlib using CMake.
While it has been possible for me to build and install a shared dlib using make and make install, so far I haven't figured out the way to link to this shared dlib library.
The examples of usage given in the DLib website always link to a static library.
This is what I have so far:
cmake_minimum_required(VERSION 2.8.12)
project(face_align)
set(CMAKE_CXX_STANDARD 11)
find_package(dlib)
add_library(face_align SHARED src/mylib.cpp)
target_link_libraries(face_align dlib::dlib)
The linker complains like so:
/usr/bin/ld: cannot find -ldlib::dlib
collect2: error: ld returned 1 exit status
CMakeFiles/face_align.dir/build.make:94: recipe for target 'libface_align.so' failed
make[2]: *** [libface_align.so] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/face_align.dir/all' failed
make[1]: *** [CMakeFiles/face_align.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
If I remove the SHARED from
add_library(face_align SHARED src/mylib.cpp) the project builds successfully. This makes me think that dlib:dlib is pointing to the static library. I see that there is a dlib:dlib_shared but no success linking to this one either.
The answer seems to be (1) linking to dlib as a static library (2) making the code linking to dlib position independent:
cmake_minimum_required(VERSION 2.8.12)
project(face_align)
set(CMAKE_CXX_STANDARD 11)
# Unfortunately, this only links dlib as static library
add_subdirectory(libs/dlib dlib_build)
add_library(face_align SHARED src/mylib.cpp)
# This makes the target position independent, allowing to link an static library to a dynamic one.
set_target_properties(face_align PROPERTIES POSITION_INDEPENDENT_CODE ON) # This made it work
# Link Dlib
target_link_libraries(face_align dlib::dlib)
EDIT:
Also, in Linux (I haven't tested this in other S.O.s) CMake does some magic and, after installing dlib library in shared mode:
$ cd $DLIB
$ mkdir build && cd build
$ cmake ../dlib
$ make && make install
Is possible to simply add the library using target_link_libraries as follows:
cmake_minimum_required(VERSION 2.8.12)
project(face_align)
set(CMAKE_CXX_STANDARD 11)
add_library(face_align SHARED src/mylib.cpp)
# Link Dlib
target_link_libraries(face_align dlib)
Then, in your code, include headers as follows:
#include <dlib/your_dlib_header_here.h>

Qt dependencies not found

I am trying to compile the bitcoin-core on my Mac and I want to use QT to develop the project also. Here is the instruction on GitHub:
https://github.com/bitcoin/bitcoin/blob/0.14/doc/build-osx.md
And I have set up my QT:
$ qmake --version
QMake version 3.0
Using Qt version 5.5.1 in /usr/local/Cellar/qt#5.5/5.5.1_1/lib
then when i run
./configure --with-gui
it throws the error below:
checking for Qt5Core Qt5Gui Qt5Network Qt5Widgets... no
checking for QtCore QtGui QtNetwork... no
configure: error: Qt dependencies not found
and i can't run ./src/qt in QT. It throws these error:
make[1]: *** No rule to make target `bitcoin_qt'. Stop.
make: *** [all] Error 2
11:24:14: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project bitocin (kit: Desktop)
When executing step "Make"
My English's bad, hope you could understand. Thank you for help!

Cutecom installation fails on OSX Mavericks

I'm trying to install cutecom on OSX Mavericks but I'm getting some erros.
Here are the steps that I followed.
install qt through brew
brew install qt
update path on .bashprofile
export PATH=/usr/local/Cellar/qt/4.8.6/bin:$PATH
extract files of cutecom
compile source code of cutecom
$ mkdir build
$ cd build
$ cmake ..
$ make
And the output of make is:
[ 20%] Generating ui_cutecommdlg.h
/Users/kc/Downloads/cutecom-0.22.0/cutecommdlg.ui: Warning: The form file has external pixmaps or qPixmapFromMimeSource() set as a pixmap function. This requires Qt 3 support, which is disabled. The resulting code will not compile.
[ 40%] Generating moc_qcppdialogimpl.cxx Scanning dependencies of target cutecom
[ 60%] Building CXX object CMakeFiles/cutecom.dir/main.cpp.o
In file included from /Users/kc/Downloads/cutecom-0.22.0/main.cpp:21:
In file included from /Users/kc/Downloads/cutecom-0.22.0/qcppdialogimpl.h:22:
/Users/kc/Downloads/cutecom-0.22.0/build/ui_cutecommdlg.h:12:10: fatal error:
'Qt3Support/Q3MimeSourceFactory' file not found
#include <Qt3Support/Q3MimeSourceFactory>
^
1 error generated.
make[2]: *** [CMakeFiles/cutecom.dir/main.cpp.o] Error 1
make[1]: *** [CMakeFiles/cutecom.dir/all] Error 2
make: *** [all] Error 2
Any suggestions ?
Thank you very much for your time.
Kostas.
The Qt package you have is missing Qt3Support (on purpose). This component is necessarily for some Qt4 software that still uses deprecated features dating back to Qt3.
Based on the documentation I've been able to find online, you should be able to reinstall Qt4 with the extras you need using a command like this:
brew install --with-qt3support qt

error "ld terminated with signal 6" for theos project after upgrade to Xcode 4.5

I'm using https://github.com/DHowett/theos to implement a tweak for jailbroken iphone.
I followed http://brandontreb.com/beginning-jailbroken-ios-development-getting-the-tools/ and everything worked fine.
Then I upgrade my Xcode to 4.5.
Then when compiling any tweak projects, even a hello world project, it failed with following error:
Making all for tweak PreferenceLoader...
Preprocessing Tweak.xm...
Compiling Tweak.xm...
Linking tweak PreferenceLoader...
collect2: ld terminated with signal 6 [Abort trap: 6]
ld(8724,0x7fff78fd2960) malloc: *** error for object 0x7f89b35003f0: pointer being freed was not allocated
*** set a breakpoint in mallocerror_break to debug
make[2]: *** [obj/PreferenceLoader.dylib] Error 1
make[1]: *** [internal-library-all] Error 2
make: *** [PreferenceLoader.all.tweak.variables] Error 2
I found this http://iphonesdkdev.blogspot.jp/2012/06/how-to-install-thoes-under-xcode-44.html, followed all steps, but still no luck.
Any ideas on the linking tool's crash?
got feedback from https://github.com/DHowett/theos/issues/39
Xcode 4.5 ships with two different versions of the same linker. The one used by gcc (which is deprecated) crashes on armv6 output, and the one used by clang can not generate armv6 output.
There is currently no way to use the 6.0 SDK while targeting iOS versions less than 4.3, or any armv6 platforms.
If you're willing to accept this, please add the following to the top of your Makefile:
export ARCHS=armv7
export TARGET=iphone:latest:4.3
(note from theiostream)
Alternatively, it is possible to use older SDKs and build for both architectures and older deployment targets (up from 3.0). Just force them (if they exist on your Xcode Developer directory), as:
export ARCHS = armv6 armv7
export TARGET=iphone::

Resources