Getting my own ROS package on Gumstix overo (Bitbake yocto project) - ros

I'm trying to get my own ROS package to work on a Gumstix Overo. The final goal of the project would be to get an image from the Caspa (camera) and stream it with ROS. To do so, I had the most success with the Yocto project: Pocky, which uses the BitBake cross-compile tool chain. To do so, I followed the instructions from the README.md in this GitHub repo: https://github.com/gumstix/Gumstix-YoctoProject-Repo
FYI, the instructions for the actual flashing and installing are clearer on the official Gumstix web site.
I was successful at compiling the BitBake project with all the ROS metadata and extras with the following command:
$ bitbake gumstix-console-image
(takes quite a while and lots and lots of disk space) and later on, flashing and installing.
And here is my package I tried to compile: https://github.com/elikos/groundStationPublic I tried to keep the folder as plain as possible to limit the potential path issues, so everything is at the base dir... (very ugly, I know)
Here is my CMakelist.txt:
cmake_minimum_required(VERSION 2.8.3)
project(groundStationPublic)
## Find catkin and any catkin packages
find_package(catkin REQUIRED COMPONENTS cv_bridge image_transport roscpp rospy std_msgs genmsg)
find_package(OpenCV REQUIRED)
## Declare ROS messages and services
#add_message_files(FILES Num.msg)
#add_service_files(FILES AddTwoInts.srv)
## Generate added messages and services
#generate_messages(DEPENDENCIES std_msgs)
## Declare a catkin package
catkin_package()
include_directories(include ${catkin_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS})
add_executable(talker talker.cpp)
target_link_libraries(talker ${catkin_LIBRARIES})
#add_dependencies(talker beginner_tutorials_generate_messages_cpp)
add_executable(listener listener.cpp)
target_link_libraries(listener ${catkin_LIBRARIES})
#add_dependencies(listener beginner_tutorials_generate_messages_cpp)
add_executable(cornerDetection main.cpp ConerDetection.cpp LineDetection.cpp ImagePublisher.cpp)
target_link_libraries(cornerDetection ${catkin_LIBRARIES} ${OpenCV_LIBRARIES})
add_executable(bonPublisher bonPublisher.cpp)
target_link_libraries(bonPublisher ${catkin_LIBRARIES} ${OpenCV_LIBRARIES})
And here is my BitBake recipe for the package:
DESCRIPTION = "Elikos groundstation code."
SECTION = "devel"
LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://package.xml;beginline=8;endline=8;md5=d566ef916e9dedc494f5f793a6690ba5"
DEPENDS = "roscpp rospy catkin std-msgs"
RDEPENDS_${PN} = "roscpp rospy std-msgs"
SRC_URI = "git://github.com/elikos/groundStationPublic.git"
SRCREV = "${AUTOREV}"
PV = "1.0.0+gitr${SRCPV}"
S = "${WORKDIR}/git"
inherit catkin
ROS_SPN = "groundStationPublic"
I have located it in ~/yocto/poky/meta-ros/recipes-ros/groundStationPublic
If I execute the command bitbake groundStationPublic, everything compiles fine. No errors. (you may get an error from x264_git, but the correct sourcerev is: SRCREV = "ffc3ad4945da69f3caa2b40e4eed715a9a8d9526")
Finally, my questions are:
Where is my package located at in the image?
It's not in the /usr/share/ like I would expect it to be...
How do I run my package if rosrun can't find it? (probably because its simply not there)
I would expect it to be somthing like rosrun groundStationPublic talker

Well, finally found the answer to my own question:
I had to add my package in the image like so in ~/yocto/poky/meta-gumstix-extras/recipies-images/gumstix/gumstix-consol-image.bb:
UTILITIES_INSTALL = " \
[...]
packagegroup-ros-comm \
python-wstool \
python-email \
python-distutils \
git \
git-perltools \
python-rosinstall \
rospy-tutorials \
roscpp-tutorials \
groundStationPublic \
[...]
"
and make sure to have the UTILITIES_INSTALL added to:
IMAGE_INSTALL += " \
[...]
${UTILITIES_INSTALL} \
[...]
"
I also had to change the CMakelist.txt to explicitly tell it where to install the targets, so here is the new CMakelist.txt (note the diff in the last few lines):
cmake_minimum_required(VERSION 2.8.3)
project(groundStationPublic)
## Find catkin and any catkin packages
find_package(catkin REQUIRED COMPONENTS cv_bridge image_transport roscpp rospy std_msgs genmsg)
find_package(OpenCV REQUIRED)
## Declare ROS messages and services
#add_message_files(FILES Num.msg)
#add_service_files(FILES AddTwoInts.srv)
## Generate added messages and services
#generate_messages(DEPENDENCIES std_msgs)
## Declare a catkin package
catkin_package()
include_directories(include ${catkin_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS})
add_executable(talker src/talker.cpp)
target_link_libraries(talker ${catkin_LIBRARIES})
#add_dependencies(talker beginner_tutorials_generate_messages_cpp)
add_executable(listener src/listener.cpp)
target_link_libraries(listener ${catkin_LIBRARIES})
#add_dependencies(listener beginner_tutorials_generate_messages_cpp)
add_executable(cornerDetection src/main.cpp src/ConerDetection.cpp src/LineDetection.cpp src/ImagePublisher.cpp)
target_link_libraries(cornerDetection ${catkin_LIBRARIES} ${OpenCV_LIBRARIES})
add_executable(bonPublisher src/bonPublisher.cpp)
target_link_libraries(bonPublisher ${catkin_LIBRARIES} ${OpenCV_LIBRARIES})
add_executable(exempleSubscriber src/exempleSubscriber.cpp)
target_link_libraries(exempleSubscriber ${catkin_LIBRARIES} ${OpenCV_LIBRARIES})
install(TARGETS talker listener cornerDetection bonPublisher exempleSubscriber
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
Unfortunatly, I'm currently experiencing problems with opencv that's not able to read the image from the caspa (from /dev/video6)... But that's a whole other problem!

Related

Linking opencv 3.2 for cv_bridge in Ubuntu 18.04 Jetson

I need to use cv_bridge and transfer the images to vison wx. I am using makefile to link / compile. The problem I have is I don't know where the header files are for the opencv 3.2 libraries. This is on a Jetson Xavier, opencv 3.2 may have been installed by the SDK Manager, or I may have installed it later. Anyway, I just reinstalled it now using the command
sudo apt-get install --reinstall libopencv-core3.2
To identify the compiler and linker flags, I run the the two pkg-config commands
pkg-config --cflags cv_bridge
-I/opt/ros/melodic/include -I/usr/include/opencv -I/opt/ros/melodic/include
pkg-config --libs cv_bridge
-L/opt/ros/melodic/lib -lcv_bridge /usr/lib/aarch64-linux-gnu/libopencv_core.so.3.2.0 /usr/lib/aarch64-linux-gnu/libopencv_imgproc.so.3.2.0 /usr/lib/aarch64-linux-gnu/libopencv_imgcodecs.so.3.2.0 -lrosconsole -lrosconsole_log4cxx -lrosconsole_backend_interface /usr/lib/aarch64-linux-gnu/liblog4cxx.so /usr/lib/aarch64-linux-gnu/libboost_regex.so /usr/lib/aarch64-linux-gnu/libboost_system.so /usr/lib/aarch64-linux-gnu/libboost_thread.so /usr/lib/aarch64-linux-gnu/libboost_chrono.so /usr/lib/aarch64-linux-gnu/libboost_date_time.so /usr/lib/aarch64-linux-gnu/libboost_atomic.so /usr/lib/aarch64-linux-gnu/libpthread.so -lroscpp_serialization -lrostime /usr/lib/aarch64-linux-gnu/libboost_date_time.so /usr/lib/aarch64-linux-gnu/libboost_system.so /usr/lib/aarch64-linux-gnu/libboost_thread.so /usr/lib/aarch64-linux-gnu/libboost_chrono.so /usr/lib/aarch64-linux-gnu/libboost_atomic.so /usr/lib/aarch64-linux-gnu/libpthread.so -lcpp_common /usr/lib/aarch64-linux-gnu/libboost_system.so /usr/lib/aarch64-linux-gnu/libboost_thread.so /usr/lib/aarch64-linux-gnu/libboost_chrono.so /usr/lib/aarch64-linux-gnu/libboost_date_time.so /usr/lib/aarch64-linux-gnu/libboost_atomic.so /usr/lib/aarch64-linux-gnu/libpthread.so /usr/lib/aarch64-linux-gnu/libconsole_bridge.so.0.4
From the above output, there is a opencv core library at
ls /usr/lib/aarch64-linux-gnu/libopencv_core.so.3.2.0
/usr/lib/aarch64-linux-gnu/libopencv_core.so.3.2.0
The problem is I can't find the header files for opencv 3.2. From the output above, the header files should be in directory
-I/usr/include/opencv
In directory /usr/include/opencv, there is a subdirectory
/usr/include/opencv4/opencv2_orig/core/version.hpp
And that contains the version.hpp file which contains these lines showing the version is version is 4.1.1.
file: /usr/include/opencv4/opencv2_orig/core/version.hpp
#define CV_VERSION_MAJOR 4
#define CV_VERSION_MINOR 1
#define CV_VERSION_REVISION 1
So, how can I install the header files for opencv version 3.2, that go with cv_bridge? Also, there may be a ROS package solution to this question, that may be more appropriate since cv_bridge library is in /opt/ros/melodic/lib.
Hmmm I see there's no tag for cv-bridge. I think that means I'm in the wrong blog. Any suggestion where I should post this question?
Opencv 3.2 can be installed using the command below, and the header files are placed in /usr/include/opencv2. I believe what has occurred is opencv4 was installed, and at that time the header files for opencv 3.2 were removed.
sudo apt install libopencv-dev=3.2.0+dfsg-4ubuntu0.1
Here is an example of linking cpp code step_2 with rosbag, cv_bridge, and opencv (3.2). The include -I/opt/ros/melodic/include is not required, it is generated by the rosbag pkg-config command, but is included for clarity, to identify location of cv_bridge header.
g++ step_2.cpp -o step_2 `pkg-config --cflags --libs rosbag` \
-I/opt/ros/melodic/include \
-L/usr/lib/aarch64-linux-gnu/ -lopencv_core -lopencv_highgui \
-L/opt/ros/melodic/lib -lcv_bridge
ref ros perception

cmake c++ library with opencv addexternal

I would like to build a C++ library using cmake.
The library would require a on-the-fly opencv download and build then this library will be used in an other cmake project as a library.
The project structure is like that:
template_matching_project
|
|-- build
|-- template_matching_project
| |
| |-- template_matching_library
| |
| | -- src
| | -- include
| | -- CMakeLists.txt
|-- main.cpp
|-- CMakeLists.txt
The template_matching_library performs some image processing using opencv, there is the content of its cmake file in template_matching_project/template_matching_library/CMakeLists.txt:
cmake_minimum_required(VERSION 3.0)
set(CMAKE_CXX_STANDARD 11)
project(template_matching)
# third party
include(ExternalProject)
set(EXTERNAL_INSTALL_LOCATION ${CMAKE_BINARY_DIR}/3rdparty)
set(EXTERNAL_DOWNLOAD_LOCATION ${CMAKE_BINARY_DIR}/Download)
# OpenCV
ExternalProject_Add(opencv-contrib
GIT_REPOSITORY https://github.com/opencv/opencv_contrib.git
GIT_TAG e6f32c6
SOURCE_DIR "${EXTERNAL_DOWNLOAD_LOCATION}/opencv-contrib"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
ExternalProject_Add(opencv
GIT_REPOSITORY https://github.com/opencv/opencv.git
GIT_TAG 01b2c5a
SOURCE_DIR "${EXTERNAL_DOWNLOAD_LOCATION}/opencv"
CMAKE_ARGS
-DBUILD_DOCS:BOOL=OFF
...
)
add_dependencies(opencv opencv-contrib)
# set source directories
set(PROJECT_SOURCE_DIR source)
set(INCLUDE_DIR include)
# set source files
file(GLOB_RECURSE SRCS ${PROJECT_SOURCE_DIR}/*)
file(GLOB_RECURSE HEADERS ${INCLUDE_DIR}/*)
# build library
link_directories(${EXTERNAL_INSTALL_LOCATION}/opencv/lib)
include_directories(${EXTERNAL_INSTALL_LOCATION}/opencv/include/opencv4)
include_directories(${INCLUDE_DIR})
add_library(${PROJECT_NAME} SHARED ${SRCS} ${HEADERS})
add_dependencies(${PROJECT_NAME} opencv)
target_link_libraries(${PROJECT_NAME} opencv_core opencv_highgui opencv_imgproc)
target_include_directories(${PROJECT_NAME} PUBLIC ${INCLUDE_DIR})
The template_matching_library is correctly build with this cmake, but the build of the main.cpp executable fails
Here is the template_matching_project/CMakeLists.txt:
cmake_minimum_required(VERSION 3.0)
set(CMAKE_CXX_STANDARD 11)
project(markers)
# include library
add_subdirectory(template_matching_library)
set(EXTERNAL_INSTALL_LOCATION ${CMAKE_BINARY_DIR}/3rdparty)
include_directories(${EXTERNAL_INSTALL_LOCATION}/opencv/include/opencv4)
# add file to compile
set(SRCS main.cpp)
# add executable
add_executable(${PROJECT_NAME} ${SRCS})
# add dependencies
target_link_libraries(${PROJECT_NAME} template_matching)
Then trying the build with the convetional
cd build
cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug
make
I have the following error
[ 95%] Building CXX object CMakeFiles/markers.dir/main.cpp.o
[100%] Linking CXX executable markers
/usr/bin/ld: cannot find -lopencv_core
/usr/bin/ld: cannot find -lopencv_highgui
/usr/bin/ld: cannot find -lopencv_imgproc
collect2: error: ld returned 1 exit status
Any suggestion to solve my problem? Should I change one/both of those CMakeLists.txt.
Thanks.
I have it worked with those two CMakeLists.txt, if some have any suggestions or better solution.
template_matching_project/CMakeLists.txt:
cmake_minimum_required(VERSION 3.0)
set(CMAKE_CXX_STANDARD 11)
project(markers)
add_subdirectory(template_matching_library)
set(SRCS main.cpp)
add_executable(${PROJECT_NAME} ${SRCS})
target_link_libraries(${PROJECT_NAME} template_matching ${OpenCV_LIBS})
template_matching_project/template_matching_library/CMakeLists.txt:
cmake_minimum_required(VERSION 3.0)
set(CMAKE_CXX_STANDARD 11)
project(template_matching)
# third party
include(ExternalProject)
set(EXTERNAL_INSTALL_LOCATION ${CMAKE_BINARY_DIR}/3rdparty)
set(EXTERNAL_DOWNLOAD_LOCATION ${CMAKE_BINARY_DIR}/Download)
# OpenCV
ExternalProject_Add(opencv-contrib
GIT_REPOSITORY https://github.com/opencv/opencv_contrib.git
GIT_TAG e6f32c6
SOURCE_DIR "${EXTERNAL_DOWNLOAD_LOCATION}/opencv-contrib"
...
)
ExternalProject_Add(opencv
GIT_REPOSITORY https://github.com/opencv/opencv.git
GIT_TAG 01b2c5a
SOURCE_DIR "${EXTERNAL_DOWNLOAD_LOCATION}/opencv"
CMAKE_ARGS
-DBUILD_DOCS:BOOL=OFF
...
-DOPENCV_EXTRA_MODULES_PATH:PATH=${EXTERNAL_DOWNLOAD_LOCATION}/opencv-contrib/modules
)
add_dependencies(opencv opencv-contrib)
set(OpenCV_DIR ${EXTERNAL_INSTALL_LOCATION}/opencv/lib/cmake/opencv4)
find_package(OpenCV REQUIRED PATHS ${EXTERNAL_INSTALL_LOCATION}/opencv)
# set source directories
set(PROJECT_SOURCE_DIR source)
set(INCLUDE_DIR include)
# set source files
file(GLOB_RECURSE SRCS ${PROJECT_SOURCE_DIR}/*)
file(GLOB_RECURSE HEADERS ${INCLUDE_DIR}/*)
# build library
include_directories(${EXTERNAL_INSTALL_LOCATION}/opencv/include/opencv4)
include_directories(${INCLUDE_DIR})
add_library(${PROJECT_NAME} SHARED ${SRCS} ${HEADERS})
add_dependencies(${PROJECT_NAME} opencv)
target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS})
target_include_directories(${PROJECT_NAME} PUBLIC ${INCLUDE_DIR})
Nevertheless, using my two CMakeLists.txt, I do have to run twice cmake and make commands, unless I have a links errors with opencv, like the following:
cd build
cmake .. -G "Unix Makefiles
make
cmake .. -G "Unix Makefiles
make
Is there a way to have work with a single run cmake/make?
I try some FetchContent but was not able to make it worked. My cmake version is 3.5.1

Openwrt:What can I do to package bin files into ipk packages?

I've compiled the openwrt source and run it on my device (HC5661).Then I wrote a helloword.cpp (an example, any other name) using Eclipse IDE,helloword.bin was successfully generated by compilation and debugged on the target device using sftp and gdb.Now I want to compile helloword into an ipk package. What can I do to package bin files into ipk packages?
You have to use the SDK. You can follow this steps:
1) Download the OpenWrt-SDK
2) In the OpenWrt-SDK folder run ./scripts/feeds/update -a && ./scripts/feeds/install -a
3) Create a folder called helloworld in the path OpenWrt-SDK/feeds/packages/utils/
4) Inside this folder create a file called Makefile and new folder called src.
5) Inside the src folder put your helloworld.cpp and the Makefile which allows to compile it.
6) Your Makefile in the folder OpenWrt-SDK/scripts/feeds/packages/utils/ should look like the following:
include $(TOPDIR)/rules.mk
# Name and release number of this package
PKG_NAME:=helloworld
PKG_VERSION:=1.0
PKG_RELEASE:=0
# This specifies the directory where we're going to build the program.
# The root build directory, $(BUILD_DIR), is by default the build_mipsel
# directory in your OpenWrt SDK directory
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/uclibc++.mk
include $(INCLUDE_DIR)/package.mk
# Specify package information for this program.
# The variables defined here should be self explanatory.
define Package/helloworld
SECTION:=utils
CATEGORY:=Utilities
TITLE:=helloworld exampke
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
$(CP) ./src/* $(PKG_BUILD_DIR)/
endef
TARGET_CFLAGS += \
-I$(STAGING_DIR)/usr/include \
-D_GNU_SOURCE \
-ggdb3
MAKE_FLAGS += \
CFLAGS="$(TARGET_CFLAGS)" \
LDFLAGS="$(TARGET_LDFLAGS)"
define Build/Compile
$(call Build/Compile/Default, \
CCOPTS="$(TARGET_CFLAGS)" \
INCLUDE="$(EXTRA_CFLAGS)" \
LDFLAGS="$(EXTRA_LDFLAGS)" \
)
endef
define Package/helloworld/install
$(INSTALL_DIR) $(1)/bin
$(CP) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/bin/
endef
# This line executes the necessary commands to compile our program.
# The above define directives specify all the information needed, but this
# line calls BuildPackage which in turn actually uses this information to
# build a package.
$(eval $(call BuildPackage,helloworld))
7) In the OpenWrt-SDK folder run ./scripts/feeds update -i && ./scripts/feeds install helloworld
8) In the same folder run make package/helloworld/compile
9) You can find your .ipk package in OpenWrt-SDK/bin/ar71xx/packages/packages/
PS: You may have to install ccache by typing (Ubuntu) sudo apt-get install ccache. You must not type your makefiles using spaces, you must use tabulator.
If you already have hello.bin,You can put it into hello/src and:
makefile(hello/):
include $(TOPDIR)/rules.mk
PKG_NAME:=hello
PKG_VERSION:=1.0
include $(INCLUDE_DIR)/package.mk
define Package/hello
CATEGORY:=Examples
TITLE:=hello
DEPENDS:=+libstdcpp
endef
define Package/hello/description
hello world
endef
define Package/hello/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) ./src/hello $(1)/usr/bin
endef
$(eval $(call BuildPackage,hello))
makefile(hello/src):
all:hello
If not,You should put hello.cpp into hello/src and:
makefile(hello/):
include $(TOPDIR)/rules.mk
PKG_NAME:=hello
PKG_VERSION:=1.0
include $(INCLUDE_DIR)/package.mk
define Package/hello
CATEGORY:=Examples
TITLE:=hello
DEPENDS:=+libstdcpp
endef
define Package/hello/description
hello world
endef
define Package/hello/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/hello $(1)/usr/bin
endef
$(eval $(call BuildPackage,hello))
makefile(hello/src):
target=hello
all:$(target)
objects=hello.o
hello:$(objects)
$(CXX) -o $(target) $(objects)
clean:
#rm -rf $(objects)

Linking OpenCV with cmake . Adding the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH doesn't work

I am trying to create the script to compile and run as mentioned by emscirpten.
This is the command I wish to create a cmake file for.
./emcc -std=c++11 -O3 -I.. ~/DLIB/dlib-19.4/dlib/all/source.cpp -I/home/akshay/DLIB/dlib-19.4 -I/usr/include/X11/ -lpthread -lX11 -lopencv_imgcodecs -o webca.js ~/DLIB/dlib-19.4/examples/webcam_face_pose_ex.cpp -ldlib `pkg-config opencv --cflags --libs`
So far I have come up with this. This is my CMAKELists.txt file.
cmake_minimum_required(VERSION 3.5.1)
project(DLIB)
SET(CMAKE_BUILD_TYPE_INIT "Release")
set(CMAKE_CXX_STANDARD 11)
if (${CMAKE_SYSTEM_NAME} MATCHES "Emscripten")
set(CMAKE_C_COMPILER "emcc")
endif ()
if(NOT DEFINED OpenCV_PREFIX)
set(OpenCV_PREFIX ${CMAKE_INSTALL_PREFIX})
endif()
set(CMAKE_VERBOSE_MAKEFILE on)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/build.emscripten)
set(DLIB_SRC "/home/akshay/DLIB/dlib-19.4/examples/webcam_face_pose_ex.cpp")
add_library(DLIB_static ${DLIB_SRC})
set(OpenCV_PREFIX /usr/share/OpenCV/OpenCVConfig.cmake)
include_directories(/usr/include/X11 /home/akshay/DLIB/dlib-19.4 /home/akshay/DLIB/dlib-19.4/dlib/all/source.cpp)
set_target_properties(DLIB_static PROPERTIES LINK_FLAGS "-s DEMANGLE_SUPPORT=1 --preload-file assets --bind")
find_package(PkgConfig REQUIRED)
find_package(OpenCV REQUIRED
PATHS ${OpenCV_PREFIX}/lib/cmake/
${OpenCV_PREFIX}/share/OpenCV/
NO_DEFAULT_PATH)
find_library(OpenCV REQUIRED PATHS ${OpenCV_PREFIX}/lib/cmake/
${OpenCV_PREFIX}/share/OpenCV/
NO_DEFAULT_PATH)
set(CMAKE_REQUIRED_FLAGS "-std=c++11 -O3 -lpthread -lX11 -lopencv_imgcodecs -ldlib `pkg-config opencv --cflags --libs`")
#file(GLOB_RECURSE CORE_HDR src/.h)
#file(GLOB_RECURSE CORE_SRC src/.cpp)
add_definitions("-s DEMANGLE_SUPPORT=1 --preload-file ${CMAKE_SOURCE_DIR}/assets --bind")
add_executable(DLIB /home/akshay/DLIB/dlib-19.4/examples/webcam_face_pose_ex.cpp)
When I run this command :cmake -DCMAKE_PREFIX_PATH=/usr/share/OpenCV/OpenCVConfig.cmake -DCMAKE_BUILD_TYPE=Debug -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=/home/akshay/Downloads/emsdk-portable/emscripten/1.37.16/cmake/Modules/Platform/Emscripten.cmake . && make
It gives me an error like so :
CMake Error at CMakeLists.txt:25 (find_package):
Could not find a package configuration file provided by "OpenCV" with any
of the following names:
OpenCVConfig.cmake
opencv-config.cmake
Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set
"OpenCV_DIR" to a directory containing one of the above files. If "OpenCV"
provides a separate development package or SDK, be sure it has been
installed.
It seems to not be able to find the CMAKE_PREFIX_PATH or that I am not setting it correctly.
I have just started fiddling around with CMAKE since yesterday. I may have very little clue about what I have done. Have tried some of the other SO answers as well.
Any help will be appreciated
You simply need to set the OpenCV_DIR to the path where OpenCV is installed, for example:
cmake -DOpenCV_DIR=/usr/local/share/OpenCV ..

How to re-build jna-4.1.0.jar with linux-s390x specific libjnidispatch.so

How can I rebuild jna-4.1.0.jar file to include the linux-s390x specific libjnidispatch.so file.
This is needed by one of my application and failing on the dependency of this libjnidispatch.so file.
Did try to follow this question: How to use JNAerator with multiple dynamic libraries under one header?
Syntax Used:
java -jar jnaerator-0.11-shaded.jar \
> -arch linux-s390x linux-s390x/libjnidispatch.so \
> -mode jna-3.3.0-jenkins-3.jar \
> -jar jna-3.3.0-jenkins-3_updated.jar
Getting below error:
ERROR: JNAeration failed !
#
# Error parsing arguments :
# -arch linux-s390x linux-s390x/libjnidispatch.so -mode jna-3.3.0-jenkins-3.jar -jar jna-3.3.0-jenkins-3_updated.jar : com.ochafik.lang.jnaerator.JNAerator$CommandLineException: Argument 'linux_s390x' is not one of the expected values :
# linux_x64,
# linux_x86,
# armeabi,
# sunos_x86,
# sunos_sparc,
# darwin_universal,
# win32,
# win64
# Please use -h for help on the command-line options available.
Clone the git repository.
Make sure you have a JDK installed, with Apache ant and native build tools (make, gcc, grep, etc).
Then just run ant native; ant jar.
Note that s390x may not be recognized out of the box, but if you look through the build files for how the other platforms are handled it should be straightforward to add in a switch for s390x (see build.xml and native/Makefile).
If you have a package distribution for a previous JNA version, that package may include the necessary packages and if so, consider submitting them to the JNA project as a github pull request to have them incorporating into the project proper.

Resources