How to integrate Package with both Cmake and Make files into Buildroot - amazon-web-services

I want to integrate the package amazon kinesis video streams webrtc SDK in buidroot. Can anyone guide me on how can I do this? I am a newbie with buildroot.
The issue is the examples available on the internet only discussion if the package has make the file only, the issue with webrtc SDK is that it has both Cmake and make file.
Executing CMake command builds the build and make command builds the application.
https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-c

Cmake projects generally use make (or some other generated build system) to build the actual code. You should follow the instructions in the buildroot manual for a "Cmake package", and it should generally work out
In the manual, it's section 18.7
https://buildroot.org/downloads/manual/manual.html#_infrastructure_for_cmake_based_packages

Hi I tried adding package:
this is my amazon-kinesis-video-streams-webrtc-sdk-c.mk file:
################################################################################
#
# amazon-kinesis-video-streams-webrtc-sdk-c
#
################################################################################
BR2_PACKAGE_AMAZON_KINESIS_VIDEO_STREAMS_WEBRTC_SDK_C_VERSION = 1.6.0
BR2_PACKAGE_AMAZON_KINESIS_VIDEO_STREAMS_WEBRTC_SDK_C_SITE = $(call github,awslabs,amazon-kinesis-video-streams-webrtc-sdk-c,v$(BR2_PACKAGE_AMAZON_KINESIS_VIDEO_STREAMS_WEBRTC_SDK_C_VERSION))
BR2_PACKAGE_AMAZON_KINESIS_VIDEO_STREAMS_WEBRTC_SDK_C_LICENSE = MIT
BR2_PACKAGE_AMAZON_KINESIS_VIDEO_STREAMS_WEBRTC_SDK_C_LICENSE_FILES = LICENSE-MIT
BR2_PACKAGE_AMAZON_KINESIS_VIDEO_STREAMS_WEBRTC_SDK_C_CONF_OPTS = -DBUILD_DEMOS=ON
BR2_PACKAGE_AMAZON_KINESIS_VIDEO_STREAMS_WEBRTC_SDK_C_INSTALL_STAGING = YES
$(eval $(cmake-package))
and this Config.in file:
config BR2_PACKAGE_AMAZON_KINESIS_VIDEO_STREAMS_WEBRTC_SDK_C
bool "amazon-kinesis-video-streams-webrtc-sdk-c"
depends on !BR2_STATIC_LIBS
depends on BR2_TOOLCHAIN_HAS_THREADS
help
web-rtc
But I am getting an error that CMakeTextfile does not exist.
make amazon-kinesis-video-streams-webrtc-sdk-c-rebuild
rm -f /home/bilal/work/buildroot/output/build/amazon-kinesis-video-streams-webrtc-sdk-c/.stamp_installed
rm -f /home/bilal/work/buildroot/output/build/amazon-kinesis-video-streams-webrtc-sdk-c/.stamp_staging_installed
rm -f /home/bilal/work/buildroot/output/build/amazon-kinesis-video-streams-webrtc-sdk-c/.stamp_target_installed
rm -f /home/bilal/work/buildroot/output/build/amazon-kinesis-video-streams-webrtc-sdk-c/.stamp_images_installed
rm -f /home/bilal/work/buildroot/output/build/amazon-kinesis-video-streams-webrtc-sdk-c/.stamp_host_installed
rm -f /home/bilal/work/buildroot/output/build/amazon-kinesis-video-streams-webrtc-sdk-c/.stamp_built
>>> amazon-kinesis-video-streams-webrtc-sdk-c Extracting
>>> amazon-kinesis-video-streams-webrtc-sdk-c Patching
>>> amazon-kinesis-video-streams-webrtc-sdk-c Configuring
(mkdir -p /home/bilal/work/buildroot/output/build/amazon-kinesis-video-streams-webrtc-sdk-c/ && cd /home/bilal/work/buildroot/output/build/amazon-kinesis-video-streams-webrtc-sdk-c/ && rm -f CMakeCache.txt && PATH="/home/bilal/work/buildroot/output/host/bin:/home/bilal/work/buildroot/output/host/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin" /usr/local/bin/cmake /home/bilal/work/buildroot/output/build/amazon-kinesis-video-streams-webrtc-sdk-c/ -DCMAKE_TOOLCHAIN_FILE="/home/bilal/work/buildroot/output/host/share/buildroot/toolchainfile.cmake" -DCMAKE_INSTALL_PREFIX="/usr" -DCMAKE_COLOR_MAKEFILE=OFF -DBUILD_DOC=OFF -DBUILD_DOCS=OFF -DBUILD_EXAMPLE=OFF -DBUILD_EXAMPLES=OFF -DBUILD_TEST=OFF -DBUILD_TESTS=OFF -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=ON )
CMake Error: The source directory "/home/bilal/work/buildroot/output/build/amazon-kinesis-video-streams-webrtc-sdk-c" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
package/pkg-generic.mk:249: recipe for target '/home/bilal/work/buildroot/output/build/amazon-kinesis-video-streams-webrtc-sdk-c/.stamp_configured' failed
make[1]: *** [/home/bilal/work/buildroot/output/build/amazon-kinesis-video-streams-webrtc-sdk-c/.stamp_configured] Error 1
Makefile:84: recipe for target '_all' failed
make: *** [_all] Error 2

Related

Docker/C++ problem - Compiling Error /usr/bin/ld: cannot open output file server: Is a directory

I'm trying to compile a C++ program using cmake in ubuntu containerized in Docker. Without Docker I can make it work just fine, but with it I seem to get some errors, whowever I can't seem to fix them :/
I've tried resolving to change the path to many different combinations in the hopes that I was just writing in the wrong path.
FROM ubuntu:16.04
# Set the working directory to /app
WORKDIR /app
# Copy the current directory contents into the container at /app
COPY . /app
# Install any needed packages specified in the requirements.txt
RUN apt-get update && apt-get -y install g++ make cmake-curses-gui libsqlite3-dev libmariadb-client-lgpl-dev subversion
# Make port 8078 available to the world outside this container
EXPOSE 8078
# Retrieve EOServ and build it
RUN svn checkout svn://eoserv.net/eoserv/trunk/ /app/eoserv
RUN cd /app/eoserv && mkdir build && cd build
RUN cmake -G "Unix Makefiles" /app/eoserv
RUN make
# Run ./eoserv when the container launches
RUN /app/eoserv/eoserv
# Here I've tried several options like
# RUN ./eoserv
# RUN cd /app/eoserv && ./eoserv
Expected results would be an eoserv binary in desired folder, it works when I don't run it in the docker image, but cmake it all by itself, without Docker.
Actual results are:
[ 91%] Building C object CMakeFiles/eoserv.dir/tu/sha256.c.o
[100%] Linking CXX executable eoserv
/usr/bin/ld: cannot open output file eoserv: Is a directory
collect2: error: ld returned 1 exit status
CMakeFiles/eoserv.dir/build.make:305: recipe for target 'eoserv' failed
make[2]: *** [eoserv] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/eoserv.dir/all' failed
make[1]: *** [CMakeFiles/eoserv.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
The command '/bin/sh -c make' returned a non-zero code: 2
The RUN instruction starts a new shell. So the commands you RUN previously will only be local to that shell, which includes things like cd, and the next RUN instruction will start a new shell without knowledge of the previous.
The instructions
RUN cd /app/eoserv && mkdir build && cd build
RUN cmake -G "Unix Makefiles" /app/eoserv
RUN make
needs to be combined into a single RUN instruction
RUN cd /app/eoserv && mkdir build && cd build && cmake -G "Unix Makefiles" /app/eoserv && make
You could of course write a script which runs the commands, and invoke that script with the RUN instruction.

Unable make wxWidgets-3.0.4 on codeblocks

I am facing a problem when I try to install the wxWidgets-3.0.4 and used it with Code::Blocks. I have searched a lot on the internet for something similar, without success.
I had installed the wxWidgets in the directory C:\wxWidgets-3.0.4
I used the instructions from the site here but when I type
mingw32-make.exe -f makefile.gcc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=0
I get
C:\wxWidgets-3.0.4\build\msw>mingw32-make.exe -f makefile.gcc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=0
if not exist ..\..\lib\gcc_dll\msw mkdir ..\..\lib\gcc_dll\msw
process_begin: CreateProcess(NULL, -c "if not exist ..\..\lib\gcc_dll\msw mkdir ..\..\lib\gcc_dll\msw", ...) failed.
make (e=2): The system cannot find the file specified.
makefile.gcc:5642: recipe for target '..\..\lib\gcc_dll\msw' failed
mingw32-make.exe: *** [..\..\lib\gcc_dll\msw] Error 2
So, I cannot figure out the problem. Why I cannot continue.
I suspect you have some Cygwin/MSYS utilities in your PATH and they don't work with these makefiles which are explicitly intended for being used from DOS-like environments.
If you want to use Cygwin, you should build wxWidgets using configure. Otherwise, type path to see the current value and remove anything containing mkdir.exe from it.

CMake is not found when running through make

I'm trying to build https://github.com/AlbertWerner/cryptonotecoinwallet and facing an issue.
According to the README of the repo, I can run cmake command and it completes without any errors. But then, when I run make, it gives me the below error.
$ make
make: /usr/bin/cmake: Command not found
make: *** [Makefile:5138: cmake_check_build_system] Error 127
I'm using MSYS on Windows and here are the corresponding details.
$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/opt/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/mingw32/bin
$ which cmake
/mingw32/bin/cmake
Seems like it's looking for cmake in the wrong path.
Makefile
cmake_check_build_system:
$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
.PHONY : cmake_check_build_system # <== Line 5139
I'm not sure what's wrong. Please help me out.
Thanks.
Make sure that you launch MSYS2 using the mingw32.exe executable at the top level of your MSYS2 installation, and that you use that environment when you first run cmake. If you ran CMake in a different environment, remove all the files it created. The commands for running cmake and building the project should be something like this, assuming the developers have set it up in a reasonable way:
mkdir build
cd build
cmake .. -G"MSYS Makefiles"
make
I didn't try this myself because I am wary of running random code from the internet, but I found this note in the CMakefile indicating that the developers do not support MSYS2:
if (WIN32)
if (NOT MSVC)
message(FATAL_ERROR "Only MSVC is supported on this platform")
endif ()
...
So you will have to spend some effort on porting the Windows-specific code in this program to GCC if you really want to do this.

building from source Qpid Messaging API (C++, bindings) [Qpid C++ 1.37.0] - missing files

I am trying to build from sources Qpid Messaging API (C++, bindings).
Build is triggered on RHEL and all prerequisites mentioned on link below are installed.
https://git-wip-us.apache.org/repos/asf?p=qpid-cpp.git;a=blob_plain;f=INSTALL.txt;hb=HEAD
yet when reaching step: make all
what i get is this
error:
Linking CXX shared library libqpidclient.so
[ 86%] Built target qpidclient
Scanning dependencies of target qpidmessaging
[ 86%] Building CXX object src/CMakeFiles/qpidmessaging.dir/qpid/messaging/amqp/AddressHelper.cpp.o
In file included from /home/m020390/qpid_cpp/qpid-cpp-1.37.0/src/qpid/messaging/amqp/AddressHelper.cpp:22:0:
/home/m020390/qpid_cpp/qpid-cpp-1.37.0/src/qpid/messaging/amqp/PnData.h:27:27: fatal error: proton/engine.h: No such file or directory
#include <proton/engine.h>
^
compilation terminated.
make[3]: *** [src/CMakeFiles/qpidmessaging.dir/qpid/messaging/amqp/AddressHelper.cpp.o] Error 1
make[2]: *** [src/CMakeFiles/qpidmessaging.dir/all] Error 2
make[1]: *** [examples/messaging/CMakeFiles/client.dir/rule] Error 2
make: *** [client] Error 2
that would indicate that "Qpid proton-c " might be missing but its installed....
any ideas ?
It worked for me using these steps.
$ wget http://apache.claz.org/qpid/proton/0.18.1/qpid-proton-0.18.1.tar.gz
$ tar -xf qpid-proton-0.18.1.tar.gz
$ cd qpid-proton-0.18.1/
$ mkdir bld
$ cd bld
$ cmake .. -DCMAKE_INSTALL_PREFIX=/tmp/testprefix
$ make -j8
$ make install
$ cd ../..
$ wget http://apache.claz.org/qpid/cpp/1.37.0/qpid-cpp-1.37.0.tar.gz
$ tar -xf qpid-cpp-1.37.0.tar.gz
$ cd qpid-cpp-1.37.0/
$ mkdir bld
$ cd bld
$ cmake .. -DCMAKE_INSTALL_PREFIX=/tmp/testprefix
>>>> Here check for "Found Proton" in the cmake output <<<<
$ make -j8
$ make install
Check that proton/engine.h is where you think it should be. In your case, it looks like that would be /usr/local/include/proton/engine.h.
You can use the following command to see what your include search path is.
cpp -v /dev/null -o /dev/null
As stated in the very INSTALL file you provided the link to:
Note: If Proton is installed in a non-standard location, there are two
ways to locate it:
Recommended: use proton 0.7 or later and use the same install prefix for both Proton and Qpid.
Using pkg-config: set the PKG_CONFIG_PATH environment variable to /lib[64]/pkgconfig before running cmake.
I'd go for method 1 and rebuild Proton specifiyng an install prefix to cmake, this way:
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local
Then use the same prefix for Qpid (i.e. run cmake again, just like the above).

Building a Debian package tries to install to real /opt

This is again one these nice Debian packaging problems.
I have an app that installs to /opt (the install location is actually irrelevant, the same problem occurs with /usr):
OPT=1 ./configure && make && make install
I took a working Debian packaging from my other app, that used CMake, but the configuring, build and installation were similar. I modified the rules file a bit to build my new app:
build: build-stamp
build-stamp:
dh_testdir
# Add here commands to compile the package.
OPT=1 ./configure && $(MAKE) -j$(shell cat /proc/cpuinfo | grep processor | wc -l)
touch build-stamp
I left the installation part untouched:
install: build
dh_testdir
dh_testroot
dh_prep
dh_installdirs
# Add here commands to install the package into debian/<packagename>
DESTDIR=`pwd`/debian/`dh_listpackages` $(MAKE) install
Now, the problem is that when I try to build the package, it tries to install
to the real /opt and crashes:
mkdir: cannot create directory ‘/opt/snm’: Permission denied
make[1]: *** [install_target] Error 1
make: *** [install] Error 2
dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 2
debuild: fatal error at line 1361:
dpkg-buildpackage -rfakeroot -D -us -uc -i -b failed
I just can't figure out why my packaging doesn't work with my new app. Or alternatively, why it DID work with the other app :)
It seems that my install step was just ignoring the DESTDIR given by the Debian rules file.