How do you import a proto file from outside your project with CMake? - cmake

I have a library that is basically just a bunch of proto files in /usr/include/ignition/msgs1/ignition/msgs. I am trying to make a custom message that uses ignition::msgs::Vector3d and ignition::msgs::Quaternion.
Here is my state.proto
syntax = "proto2";
package cdrone.messages;
import "quaternion.proto";
import "vector3d.proto";
message State
{
required int64 time = 1;
required Vector3d position = 2;
required Vector3d velocity = 3;
required Quaternion attitude = 4;
required Vector3d angular_velocity = 5;
}
Here is the CMakeLists.txt I am using to compile the protobufs:
include_directories(${PROTOBUF_INCLUDE_DIRS})
set(PROTOBUF_INCLUDE_DIRS ${PROTOBUF_INCLUDE_DIRS} "/usr/include/ignition/msgs1/ignition/msgs")
set(ProtoFiles
gamepad.proto
motor_power.proto
/usr/include/ignition/msgs1/ignition/msgs/vector3d.proto
/usr/include/ignition/msgs1/ignition/msgs/quaternion.proto
state.proto)
PROTOBUF_GENERATE_CPP(ProtoSources ProtoHeaders ${ProtoFiles})
add_library(messages SHARED ${ProtoSources})
target_link_libraries(messages ${PROTOBUF_LIBRARY})
It looks like it finds the vector3d.proto and quaternion.proto, but when it tries to import another proto inside either vector3d.proto or quaternion.proto, it fails to find that new import.
$ make
[ 5%] Built target cpptoml-parser
[ 10%] Built target cpptoml-build
[ 15%] Built target cpptoml-conversions
[ 21%] Built target parse
[ 23%] Running C++ protocol buffer compiler on state.proto
ignition/msgs/header.proto: File not found.
quaternion.proto: Import "ignition/msgs/header.proto" was not found or had errors.
quaternion.proto:32:12: "Header" is not defined.
vector3d.proto: Import "ignition/msgs/header.proto" was not found or had errors.
vector3d.proto:32:12: "Header" is not defined.
state.proto: Import "quaternion.proto" was not found or had errors.
state.proto: Import "vector3d.proto" was not found or had errors.
state.proto:12:12: "Vector3d" is not defined.
state.proto:13:12: "Vector3d" is not defined.
state.proto:14:12: "Quaternion" is not defined.
state.proto:15:12: "Vector3d" is not defined.
src/common/messages/CMakeFiles/messages.dir/build.make:94: recipe for target 'src/common/messages/state.pb.cc' failed
make[2]: *** [src/common/messages/state.pb.cc] Error 1
CMakeFiles/Makefile2:413: recipe for target 'src/common/messages/CMakeFiles/messages.dir/all' failed
make[1]: *** [src/common/messages/CMakeFiles/messages.dir/all] Error 2
Makefile:151: recipe for target 'all' failed
make: *** [all] Error 2

Related

Intel RealsenseId Python wrappers compile in Ubuntu

I have spent the day trying to get this to build and was hoping someone can help or point me to the right direction.
Using Ubuntu 18.
Python 3.9.13
Gcc 7.5.0
cmake 3.10.2
I have created the build directory and within that directory run the command:
cmake .. -DRSID_PREVIEW=ON -DRSID_SECURE=ON -DRSID_PY=ON
Make files build ok. I then typed:
make
Most of the binaries are compiled such as rsid_cli. However I get the error below which prevents the python wrappers from being built. Can anyone help?
Scanning dependencies of target rsid_py
[ 96%] Building CXX object wrappers/python/CMakeFiles/rsid_py.dir/rsid_py.cc.o
[ 97%] Building CXX object wrappers/python/CMakeFiles/rsid_py.dir/face_auth_py.cc.o
In file included from /usr/include/c++/7/memory:80:0,
from /home/rukshan/Desktop/RealSenseID-0.25.0/build/3rdparty/pybind11/include/pybind11/detail/common.h:162,
from /home/rukshan/Desktop/RealSenseID-0.25.0/build/3rdparty/pybind11/include/pybind11/pytypes.h:12,
from /home/rukshan/Desktop/RealSenseID-0.25.0/build/3rdparty/pybind11/include/pybind11/cast.h:13,
from /home/rukshan/Desktop/RealSenseID-0.25.0/build/3rdparty/pybind11/include/pybind11/attr.h:13,
from /home/rukshan/Desktop/RealSenseID-0.25.0/build/3rdparty/pybind11/include/pybind11/pybind11.h:45,
from /home/rukshan/Desktop/RealSenseID-0.25.0/wrappers/python/rsid_py.h:6,
from /home/rukshan/Desktop/RealSenseID-0.25.0/wrappers/python/face_auth_py.cc:7:
/usr/include/c++/7/bits/unique_ptr.h: In instantiation of ‘typename std::_MakeUniq<_Tp>::__single_object std::make_unique(_Args&& ...) [with _Tp = RealSenseID::FaceAuthenticator; _Args = {}; typename std::_MakeUniq<_Tp>::_single_object = std::unique_ptr<RealSenseID::FaceAuthenticator, std::default_deleteRealSenseID::FaceAuthenticator >]’:
/home/rukshan/Desktop/RealSenseID-0.25.0/wrappers/python/face_auth_py.cc:596:58: required from here
/usr/include/c++/7/bits/unique_ptr.h:821:30: error: no matching function for call to ‘RealSenseID::FaceAuthenticator::FaceAuthenticator()’
{ return unique_ptr<Tp>(new Tp(std::forward<Args>(args)...)); }
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/rukshan/Desktop/RealSenseID-0.25.0/wrappers/python/face_auth_py.cc:5:0:
/home/rukshan/Desktop/RealSenseID-0.25.0/src/../include/RealSenseID/FaceAuthenticator.h:39:14: note: candidate: RealSenseID::FaceAuthenticator::FaceAuthenticator(RealSenseID::SignatureCallback*)
explicit FaceAuthenticator(SignatureCallback* callback);
^~~~~~~~~~~~~~~~~
/home/rukshan/Desktop/RealSenseID-0.25.0/src/../include/RealSenseID/FaceAuthenticator.h:39:14: note: candidate expects 1 argument, 0 provided
In file included from /home/rukshan/Desktop/RealSenseID-0.25.0/build/3rdparty/pybind11/include/pybind11/pybind11.h:48:0,
from /home/rukshan/Desktop/RealSenseID-0.25.0/wrappers/python/rsid_py.h:6,
from /home/rukshan/Desktop/RealSenseID-0.25.0/wrappers/python/face_auth_py.cc:7:
/home/rukshan/Desktop/RealSenseID-0.25.0/build/3rdparty/pybind11/include/pybind11/detail/init.h: In instantiation of ‘Class* pybind11::detail::initimpl::construct_or_initialize(Args&& ...) [with Class = RealSenseID::FaceAuthenticator; Args = {}; typename std::enable_if<(! std::is_constructible<Tp, Args>::value), int>::type = 0]’:
/home/rukshan/Desktop/RealSenseID-0.25.0/build/3rdparty/pybind11/include/pybind11/detail/init.h:175:66: required from ‘pybind11::detail::initimpl::constructor::execute(Class&, const Extra& ...)::<lambda(pybind11::detail::value_and_holder&, Args ...)> [with Class = pybind11::classRealSenseID::FaceAuthenticator; Extra = {}; typename std::enable_if<(! Class:: has_alias), int>::type = 0; Args = {}]’
/home/rukshan/Desktop/RealSenseID-0.25.0/build/3rdparty/pybind11/include/pybind11/detail/init.h:174:29: required from ‘struct pybind11::detail::initimpl::constructor::execute(Class&, const Extra& ...) [with Class = pybind11::classRealSenseID::FaceAuthenticator; Extra = {}; typename std::enable_if<(! Class:: has_alias), int>::type = 0; Args = {}]::<lambda(struct pybind11::detail::value_and_holder&)>’
/home/rukshan/Desktop/RealSenseID-0.25.0/build/3rdparty/pybind11/include/pybind11/detail/init.h:174:9: required from ‘static void pybind11::detail::initimpl::constructor::execute(Class&, const Extra& ...) [with Class = pybind11::classRealSenseID::FaceAuthenticator; Extra = {}; typename std::enable_if<(! Class:: has_alias), int>::type = 0; Args = {}]’
/home/rukshan/Desktop/RealSenseID-0.25.0/build/3rdparty/pybind11/include/pybind11/pybind11.h:1346:9: required from ‘pybind11::class<type, options>& pybind11::class<type, options>::def(const pybind11::detail::initimpl::constructor<Args ...>&, const Extra& ...) [with Args = {}; Extra = {}; type = RealSenseID::FaceAuthenticator; options = {}]’
/home/rukshan/Desktop/RealSenseID-0.25.0/wrappers/python/face_auth_py.cc:594:26: required from here
/home/rukshan/Desktop/RealSenseID-0.25.0/build/3rdparty/pybind11/include/pybind11/detail/init.h:63:64: error: no matching function for call to ‘RealSenseID::FaceAuthenticator::FaceAuthenticator()’
inline Class construct_or_initialize(Args &&...args) { return new Class{std::forward(args)...}; }
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/rukshan/Desktop/RealSenseID-0.25.0/wrappers/python/face_auth_py.cc:5:0:
/home/rukshan/Desktop/RealSenseID-0.25.0/src/../include/RealSenseID/FaceAuthenticator.h:39:14: note: candidate: RealSenseID::FaceAuthenticator::FaceAuthenticator(RealSenseID::SignatureCallback)
explicit FaceAuthenticator(SignatureCallback* callback);
^~~~~~~~~~~~~~~~~
/home/rukshan/Desktop/RealSenseID-0.25.0/src/../include/RealSenseID/FaceAuthenticator.h:39:14: note: candidate expects 1 argument, 0 provided
wrappers/python/CMakeFiles/rsid_py.dir/build.make:86: recipe for target 'wrappers/python/CMakeFiles/rsid_py.dir/face_auth_py.cc.o' failed
make[2]: *** [wrappers/python/CMakeFiles/rsid_py.dir/face_auth_py.cc.o] Error 1
CMakeFiles/Makefile2:1388: recipe for target 'wrappers/python/CMakeFiles/rsid_py.dir/all' failed
make[1]: *** [wrappers/python/CMakeFiles/rsid_py.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

Adding SDL2 to Clion

I am a beginner, I was trying to get SDL2 to work in clion but I failed.
I've searched on youtube and google but nothing worked. I have SDL2.dll in the same folder as main.cpp
My cmake file looks like this:
cmake_minimum_required(VERSION 3.8)
project(sdlTest)
set(CMAKE_CXX_STANDARD 17)
set(SOURCE_FILES main.cpp)
add_executable(sdlTest ${SOURCE_FILES})
add_library(SDL2.dll SHARED main.cpp)
set_target_properties(SDL2.dll PROPERTIES LINKER_LANGUAGE CXX)
I don't know what I'm doing wrong.
I tried running this example code from sdl:
#include "SDL2/SDL.h"
#include <stdio.h>
int main(int argc, char* argv[]) {
SDL_Window *window; // Declare a pointer
SDL_Init(SDL_INIT_VIDEO); // Initialize SDL2
// Create an application window with the following settings:
window = SDL_CreateWindow(
"An SDL2 window", // window title
SDL_WINDOWPOS_UNDEFINED, // initial x position
SDL_WINDOWPOS_UNDEFINED, // initial y position
640, // width, in pixels
480, // height, in pixels
SDL_WINDOW_OPENGL // flags - see below
);
// Check that the window was successfully created
if (window == NULL) {
// In the case that the window could not be made...
printf("Could not create window: %s\n", SDL_GetError());
return 1;
}
// The window is open: could enter program loop here (see SDL_PollEvent())
SDL_Delay(3000); // Pause execution for 3000 milliseconds, for example
// Close and destroy the window
SDL_DestroyWindow(window);
// Clean up
SDL_Quit();
return 0;
}
and I get this error:
CMakeFiles\sdlTest.dir/objects.a(main.cpp.obj): In function `SDL_main':
C:/Users/Dddsasul/CLionProjects/sdlTest/main.cpp:8: undefined reference to
`SDL_Init'
C:/Users/Dddsasul/CLionProjects/sdlTest/main.cpp:18: undefined reference to
`SDL_CreateWindow'
C:/Users/Dddsasul/CLionProjects/sdlTest/main.cpp:23: undefined reference to
`SDL_GetError'
C:/Users/Dddsasul/CLionProjects/sdlTest/main.cpp:29: undefined reference to
`SDL_Delay'
C:/Users/Dddsasul/CLionProjects/sdlTest/main.cpp:32: undefined reference to
`SDL_DestroyWindow'
C:/Users/Dddsasul/CLionProjects/sdlTest/main.cpp:35: undefined reference to
`SDL_Quit'
c:/mingw/bin/../lib/gcc/mingw32/5.3.0/../../../libmingw32.a(main.o):
(.text.startup+0xa0): undefined reference to `WinMain#16'
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[3]: *** [sdlTest.exe] Error 1
CMakeFiles\sdlTest.dir\build.make:95: recipe for target 'sdlTest.exe' failed
CMakeFiles\Makefile2:103: recipe for target 'CMakeFiles/sdlTest.dir/all'
failed
CMakeFiles\Makefile2:115: recipe for target 'CMakeFiles/sdlTest.dir/rule'
failed
mingw32-make.exe[2]: *** [CMakeFiles/sdlTest.dir/all] Error 2
mingw32-make.exe[1]: *** [CMakeFiles/sdlTest.dir/rule] Error 2
mingw32-make.exe: *** [sdlTest] Error 2
Makefile:130: recipe for target 'sdlTest' failed
I've tried both x64 and x86 and it's the same result but at the same time clion doesn't red-text the code, it thinks it's ok:
Any ideas what I'm doing wrong and how to fix? THANKS!
EDIT:
Cmake looks like this
cmake_minimum_required(VERSION 3.8)
project(sdlTest)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
find_package(SDL2 REQUIRED)
set(SOURCE_FILES main.cpp)
add_executable(sdlTest ${SOURCE_FILES})
set(SDL2_LIBRARY SDL2.dll)
target_link_libraries(sdlTest ${SDL2_LIBRARYS})
I get this error:
Found package configuration file:
C:/MinGW/lib/cmake/SDL2/sdl2-config.cmake
but it set SDL2_FOUND to FALSE so package "SDL2" is considered to be NOT
FOUND.
SECOND EDIT:
sdl2-config.cmake:
# sdl2 cmake project-config input for ./configure scripts
set(prefix "/usr/local/x86_64-w64-mingw32")
set(exec_prefix "${prefix}")
set(libdir "${exec_prefix}/lib")
set(SDL2_PREFIX "/usr/local/x86_64-w64-mingw32")
set(SDL2_EXEC_PREFIX "/usr/local/x86_64-w64-mingw32")
set(SDL2_LIBDIR "${exec_prefix}/lib")
set(SDL2_INCLUDE_DIRS "${prefix}/include/SDL2")
set(SDL2_LIBRARIES "-L${SDL2_LIBDIR} -lmingw32 -lSDL2main -lSDL2 -mwindows")
string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES)

Linking a C++ exe to a C lib in cmake

I thought I understood cmake pretty well until I came accross this problem that I just can't figure out. I've built a static library in C, and I'm trying to run a unit test on it in C++, but I can't seem to link to any of the static functions in that library and I can't figure out why. I've reproduced the problem in the skeleton project below:
CMakeLists.txt:
cmake_minimum_required(VERSION 3.6)
project(myproj)
add_library(mylib STATIC mylib.c)
find_package(Boost 1.64.0 COMPONENTS unit_test_framework)
add_executable(mytestapp mytest.cpp)
target_include_directories(mytestapp PRIVATE .)
target_link_libraries(mytestapp mylib)
enable_testing()
add_test( mytest mytestapp)
mylib.c:
int add(int a, int b)
{
return a + b;
}
mylib.h
int add(int a, int b);
mytest.cpp:
#define BOOST_TEST_MODULE mylib_test
#include <boost/test/included/unit_test.hpp>
#include "mylib.h"
BOOST_AUTO_TEST_CASE(mylib_test)
{
BOOST_TEST( add(2,2) == 4);
}
Then my output is:
$ make
Scanning dependencies of target mylib
[ 25%] Building C object CMakeFiles/mylib.dir/mylib.c.o
[ 50%] Linking C static library libmylib.a
[ 50%] Built target mylib
Scanning dependencies of target mytestapp
[ 75%] Building CXX object CMakeFiles/mytestapp.dir/mytest.cpp.o
[100%] Linking CXX executable mytestapp
CMakeFiles/mytestapp.dir/mytest.cpp.o: In function `mylib_test::test_method()':
mytest.cpp:(.text+0x1e411): undefined reference to `add(int, int)'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/mytestapp.dir/build.make:96: mytestapp] Error 1
make[1]: *** [CMakeFiles/Makefile2:105: CMakeFiles/mytestapp.dir/all] Error 2
make: *** [Makefile:95: all] Error 2
If I compile mylib in C++, then it links fine, but not in C. That's a problem for me because I have a huge library in C and I'm trying to use the boost_test_framework (in C++) to load this lib and test it.
Solution:
I needed to import the library with extern "C" like so:
#define BOOST_TEST_MODULE mylib_test
#include <boost/test/included/unit_test.hpp>
extern "C" {
#include "mylib.h"
}
BOOST_AUTO_TEST_CASE(mylib_test)
{
BOOST_TEST( add(2,2) == 4);
}

Build aruco 2.0.5 on Windows 8

I am trying to install aruco on my Windows machine using cmake 3.5.2 as suggested by the aruco developper.
My config:
Windows8
CMake 3.5.2
ArUco 2.0.5
I can configure and generate successfully aruco in cmake.
Then I go to aruco\build -> right click-> open cmd -> type mingw32-make -> get the following error:
C:\aruco-2.0.5\build>mingw32-make
Scanning dependencies of target aruco
[ 2%] Building CXX object src/CMakeFiles/aruco.dir/ar_omp.cpp.obj
[ 4%] Building CXX object src/CMakeFiles/aruco.dir/cameraparameters.cpp.obj
[ 6%] Building CXX object src/CMakeFiles/aruco.dir/cvdrawingutils.cpp.obj
In file included from C:\aruco-2.0.5\src\aruco.h:149:0,
from C:\aruco-2.0.5\src\cvdrawingutils.h:31,
from C:\aruco-2.0.5\src\cvdrawingutils.cpp:28:
C:\aruco-2.0.5\src\markerdetector.h:160:40: warning: "/*" within comment [-Wcomm
ent]
ARUCO_MIP_36h12, //**** recommended
^
C:\aruco-2.0.5\src\markerdetector.h:212:60: warning: unused parameter 'r2' [-Wun
used-parameter]
void setThresholdParamRange(size_t r1 = 0, size_t r2 = 0) {_params. _thresP
aram1_range = r1; }
^
C:\aruco-2.0.5\src\markerdetector.h:267:30: warning: unused parameter 'val' [-Wu
nused-parameter]
void setDesiredSpeed(int val){}
^
In file included from C:\aruco-2.0.5\src\posetracker.h:33:0,
from C:\aruco-2.0.5\src\aruco.h:150,
from C:\aruco-2.0.5\src\cvdrawingutils.h:31,
from C:\aruco-2.0.5\src\cvdrawingutils.cpp:28:
C:\aruco-2.0.5\src\markermap.h: In member function 'void aruco::Marker3DInfo::to
Stream(std::ostream&)':
C:\aruco-2.0.5\src\markermap.h:49:77: warning: comparison between signed and uns
igned integer expressions [-Wsign-compare]
void toStream(std::ostream &str){str<<id<<" "<<size()<<" ";for(int i=0;i<si
ze();i++) str<<at(i).x<<" "<<at(i).y<<" "<<at(i).z<<" ";}
^
In file included from C:\aruco-2.0.5\src\posetracker.h:33:0,
from C:\aruco-2.0.5\src\aruco.h:150,
from C:\aruco-2.0.5\src\cvdrawingutils.h:31,
from C:\aruco-2.0.5\src\cvdrawingutils.cpp:28:
C:\aruco-2.0.5\src\markermap.h: In member function 'void aruco::Marker3DInfo::fr
omStream(std::istream&)':
C:\aruco-2.0.5\src\markermap.h:50:80: warning: comparison between signed and uns
igned integer expressions [-Wsign-compare]
void fromStream(std::istream &str){int s;str>>id>>s;resize(s);for(int i=0;i
<size();i++) str>>at(i).x>>at(i).y>>at(i).z;}
^
[ 9%] Building CXX object src/CMakeFiles/aruco.dir/dictionary.cpp.obj
In file included from C:\aruco-2.0.5\src\dictionary.cpp:9:0:
C:\aruco-2.0.5\src\markermap.h: In member function 'void aruco::Marker3DInfo::to
Stream(std::ostream&)':
C:\aruco-2.0.5\src\markermap.h:49:77: warning: comparison between signed and uns
igned integer expressions [-Wsign-compare]
void toStream(std::ostream &str){str<<id<<" "<<size()<<" ";for(int i=0;i<si
ze();i++) str<<at(i).x<<" "<<at(i).y<<" "<<at(i).z<<" ";}
^
In file included from C:\aruco-2.0.5\src\dictionary.cpp:9:0:
C:\aruco-2.0.5\src\markermap.h: In member function 'void aruco::Marker3DInfo::fr
omStream(std::istream&)':
C:\aruco-2.0.5\src\markermap.h:50:80: warning: comparison between signed and uns
igned integer expressions [-Wsign-compare]
void fromStream(std::istream &str){int s;str>>id>>s;resize(s);for(int i=0;i
<size();i++) str>>at(i).x>>at(i).y>>at(i).z;}
^
C:\aruco-2.0.5\src\dictionary.cpp: In static member function 'static std::string
aruco::Dictionary::getTypeString(aruco::Dictionary::DICT_TYPES)':
C:\aruco-2.0.5\src\dictionary.cpp:236:11: warning: enumeration value 'ARTAG' not
handled in switch [-Wswitch]
switch(t){
^
C:\aruco-2.0.5\src\dictionary.cpp: In member function 'aruco::MarkerMap aruco::D
ictionary::createMarkerMap(cv::Size, int, int, const std::vector<int>&, bool)':
C:\aruco-2.0.5\src\dictionary.cpp:275:39: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
if (gridSize.height*gridSize.width!=ids.size())throw cv::Exception(9001, "g
ridSize != ids.size()Invalid ", "Dictionary::createMarkerMap", __FILE__, __LINE_
_);
^
C:\aruco-2.0.5\src\dictionary.cpp:284:23: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
for (int i=0;i<ids.size();i++) TInfo[i].id=ids[i];
^
C:\aruco-2.0.5\src\dictionary.cpp:285:13: warning: unused variable 'sizeY' [-Wun
used-variable]
int sizeY=gridSize.height*MarkerSize+(gridSize.height-1)*MarkerDistance
;
^
C:\aruco-2.0.5\src\dictionary.cpp:286:13: warning: unused variable 'sizeX' [-Wun
used-variable]
int sizeX=gridSize.width*MarkerSize+(gridSize.width-1)*MarkerDistance;
^
C:\aruco-2.0.5\src\dictionary.cpp:312:37: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
if (CurMarkerIdx>=ids.size()) throw cv::Exception(999," Fid
ucidalMarkers::createMarkerMapImage_ChessMarkerMap","INTERNAL ERROR. REWRITE THI
S!!",__FILE__,__LINE__);
^
C:\aruco-2.0.5\src\dictionary.cpp:300:13: warning: unused variable 'centerX' [-W
unused-variable]
int centerX=sizeX/2;
^
C:\aruco-2.0.5\src\dictionary.cpp:301:13: warning: unused variable 'centerY' [-W
unused-variable]
int centerY=sizeY/2;
^
C:\aruco-2.0.5\src\dictionary.cpp:303:14: warning: unused variable 'centerData'
[-Wunused-variable]
bool centerData=true;
^
[ 11%] Building CXX object src/CMakeFiles/aruco.dir/ippe.cpp.obj
C:\aruco-2.0.5\src\ippe.cpp: In function 'void IPPE::IPPComputeRotations(double,
double, double, double, double, double, cv::OutputArray, cv::OutputArray)':
C:\aruco-2.0.5\src\ippe.cpp:307:45: warning: variable 'ata10' set but not used [
-Wunused-but-set-variable]
double a00, a01, a10,a11, ata00, ata01, ata10,ata11,b00, b01, b10,b11,binv0
0, binv01, binv10,binv11;
^
C:\aruco-2.0.5\src\ippe.cpp:311:19: warning: variable 'a' set but not used [-Wun
used-but-set-variable]
double b0, b1,a,gamma,dtinv;
^
[ 13%] Building CXX object src/CMakeFiles/aruco.dir/marker.cpp.obj
C:\aruco-2.0.5\src\marker.cpp: In member function 'void aruco::Marker::rotateXAx
is(cv::Mat&)':
C:\aruco-2.0.5\src\marker.cpp:299:22: error: 'M_PI' was not declared in this sco
pe
float angleRad = M_PI / 2;
^
src\CMakeFiles\aruco.dir\build.make:187: recipe for target 'src/CMakeFiles/aruco
.dir/marker.cpp.obj' failed
mingw32-make[2]: *** [src/CMakeFiles/aruco.dir/marker.cpp.obj] Error 1
CMakeFiles\Makefile2:116: recipe for target 'src/CMakeFiles/aruco.dir/all' faile
d
mingw32-make[1]: *** [src/CMakeFiles/aruco.dir/all] Error 2
Makefile:126: recipe for target 'all' failed
mingw32-make: *** [all] Error 2
C:\aruco-2.0.5\build>mingw32-make
Scanning dependencies of target aruco
[ 2%] Building CXX object src/CMakeFiles/aruco.dir/marker.cpp.obj
C:\aruco-2.0.5\src\marker.cpp: In member function 'void aruco::Marker::rotateXAx
is(cv::Mat&)':
C:\aruco-2.0.5\src\marker.cpp:299:22: error: 'M_PI' was not declared in this sco
pe
float angleRad = M_PI / 2;
^
src\CMakeFiles\aruco.dir\build.make:187: recipe for target 'src/CMakeFiles/aruco
.dir/marker.cpp.obj' failed
mingw32-make[2]: *** [src/CMakeFiles/aruco.dir/marker.cpp.obj] Error 1
CMakeFiles\Makefile2:116: recipe for target 'src/CMakeFiles/aruco.dir/all' faile
d
mingw32-make[1]: *** [src/CMakeFiles/aruco.dir/all] Error 2
Makefile:126: recipe for target 'all' failed
mingw32-make: *** [all] Error 2
I have also tried to do it with codeblocks but I get the exact same error.
The developer has released a new version 2.0.7 fixing this issue.
What I have done to have aruco:
download the .zip on sourceforge
unzip it
create a build folder in aruco-2.0.7
open cmake-gui configure and generate
go into your build folder
open a cmd window from there
type mingw32-make
The library should have compiled properly.
If omp.h is missing from your compiler, find the source code on the internet and add it to mingw in MinGW\include. You should be ready to go. Don't forget to add aruco to your path & reboot.
If you are using an ide, you will have to add this library since it is an external library but it is another issue.
Finally, you might have some issues regarding c++11. I am working on it. If someone knows how to allow it on mingw (I haven't find any understandable explanation so far)

How to build dash with CMake?

I'm trying to build dash using Clion and CMake but I get this build error:
/opt/clion-2016.1.1/bin/cmake/bin/cmake --build /home/dac/.CLion2016.1/system/cmake/generated/dash-46b33cad/46b33cad/Debug --target all -- -j 4
[ 3%] Building C object CMakeFiles/main.dir/error.c.o
[ 6%] Building C object CMakeFiles/main.dir/eval.c.o
[ 9%] Building C object CMakeFiles/main.dir/cd.c.o
[ 12%] Building C object CMakeFiles/main.dir/arith_yylex.c.o
In file included from /home/dac/Downloads/dash-0.5.8/dash/error.c:54:0:
/home/dac/Downloads/dash-0.5.8/dash/system.h:65:22: error: static declaration of ‘strtod’ follows non-static declaration
static inline double strtod(const char *nptr, char **endptr)
^
In file included from /home/dac/Downloads/dash-0.5.8/dash/error.c:40:0:
/usr/include/stdlib.h:164:15: note: previous declaration of ‘strtod’ was here
extern double strtod (const char *__restrict __nptr,
^
In file included from /home/dac/Downloads/dash-0.5.8/dash/error.c:54:0:
/home/dac/Downloads/dash-0.5.8/dash/system.h:86:19: error: static declaration of ‘killpg’ follows non-static declaration
static inline int killpg(pid_t pid, int signal)
^
In file included from /home/dac/Downloads/dash-0.5.8/dash/error.c:39:0:
/usr/include/signal.h:134:12: note: previous declaration of ‘killpg’ was here
extern int killpg (__pid_t __pgrp, int __sig) __THROW;
^
In file included from /home/dac/Downloads/dash-0.5.8/dash/error.c:54:0:
/home/dac/Downloads/dash-0.5.8/dash/system.h:97:0: warning: "_SC_CLK_TCK" redefined
#define _SC_CLK_TCK 2
^
In file included from /usr/include/unistd.h:609:0,
from /home/dac/Downloads/dash-0.5.8/dash/error.c:42:
/usr/include/x86_64-linux-gnu/bits/confname.h:78:0: note: this is the location of the previous definition
#define _SC_CLK_TCK _SC_CLK_TCK
^
CMakeFiles/main.dir/build.make:182: recipe for target 'CMakeFiles/main.dir/error.c.o' failed
make[2]: *** [CMakeFiles/main.dir/error.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/home/dac/Downloads/dash-0.5.8/dash/eval.c:51:22: fatal error: builtins.h: No such file or directory
In file included from /home/dac/Downloads/dash-0.5.8/dash/arith_yylex.c:44:0:
/home/dac/Downloads/dash-0.5.8/dash/system.h:65:22: error: static declaration of ‘strtod’ follows non-static declaration
static inline double strtod(const char *nptr, char **endptr)
^
In file included from /home/dac/Downloads/dash-0.5.8/dash/arith_yylex.c:36:0:
/usr/include/stdlib.h:164:15: note: previous declaration of ‘strtod’ was here
extern double strtod (const char *__restrict __nptr,
^
In file included from /home/dac/Downloads/dash-0.5.8/dash/arith_yylex.c:44:0:
/home/dac/Downloads/dash-0.5.8/dash/system.h:86:19: error: static declaration of ‘killpg’ follows non-static declaration
static inline int killpg(pid_t pid, int signal)
^
In file included from /home/dac/Downloads/dash-0.5.8/dash/error.h:38:0,
from /home/dac/Downloads/dash-0.5.8/dash/arith_yylex.c:40:
/usr/include/signal.h:134:12: note: previous declaration of ‘killpg’ was here
extern int killpg (__pid_t __pgrp, int __sig) __THROW;
^
In file included from /home/dac/Downloads/dash-0.5.8/dash/syntax.h:5:0,
from /home/dac/Downloads/dash-0.5.8/dash/arith_yylex.c:43:
/home/dac/Downloads/dash-0.5.8/dash/system.h:102:17: error: expected ‘)’ before ‘c’
int isblank(int c);
^
/home/dac/Downloads/dash-0.5.8/dash/system.h:102:5: error: expected expression before ‘)’ token
int isblank(int c);
^
compilation terminated.
CMakeFiles/main.dir/build.make:206: recipe for target 'CMakeFiles/main.dir/eval.c.o' failed
make[2]: *** [CMakeFiles/main.dir/eval.c.o] Error 1
CMakeFiles/main.dir/build.make:134: recipe for target 'CMakeFiles/main.dir/arith_yylex.c.o' failed
make[2]: *** [CMakeFiles/main.dir/arith_yylex.c.o] Error 1
My CMakeLists.txt looks like this:
cmake_minimum_required (VERSION 2.6)
project (dash)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include config.h -DBSD=1 -DSHELL -DIFS_BROKEN")
add_executable(main main.c alias.c arith_yacc.c arith_yylex.c cd.c error.c eval.c exec.c expand.c histedit.c input.c jobs.c mail.c main.c memalloc.c miscbltin.c mystring.c options.c parser.c redir.c show.c trap.c output.c bltin/printf.c system.c bltin/test.c bltin/times.c var.c alias.h arith_yacc.h bltin/bltin.h cd.h error.h eval.h exec.h expand.h hetio.h init.h input.h jobs.h machdep.h mail.h main.h memalloc.h miscbltin.h myhistedit.h mystring.h options.h output.h parser.h redir.h shell.h show.h system.h trap.h var.h mktokens mkbuiltins builtins.def.in mkinit.c mknodes.c nodetypes nodes.c.pat mksyntax.c mksignames.c)
What can I do to make it build? If I use the makefile and build with make then it builds. But I want to build with CMake.