I am trying to install mosquitto broker on a cRIO-9030.
If I use the command opkg install mosquitto, I get a response saying Couldn't find anythign to satisfy mosquitto.
I am building the tar.gz file on a virtual machine Ubuntu 18.01.1 LTS.
When I run
make WITH_UUID=no WITH_websockets=yes WITH=TLS=no
in the mosquitto directory, I get an error g++: command not found.
I installed oecore-x86_64-core2-64-toolchain-5.0.sh to the directory above mosquitto, but that didn't fix the issue.
which gcc responds with /usr/bin/gcc
but i get nothing back when i run which g++.
I think i can cross compile this from windows using eclipse c/c++, but this method should work too.
Briefly looking over the Mosquito's Makefiles (e.g. https://github.com/eclipse/mosquitto/blob/master/lib/Makefile#L92), it seems like you need to define CROSS_COMPILE to something like /path/to/sysroots/x86_64-nilrtsdk-linux/usr/bin/x86_64-nilrt-linux/x86_64-nilrt-linux- .
Thanks. That worked but now I get an error saying
mosquittopp.cpp:17:19: fatal error: cstdlib: No such file or directory
The toolchain you installed provides headers for common libraries like glibc at /path/to/sysroots/x86_64-nilrt-linux/usr/include/ . You'll need to pass some arguments to cc/gcc/g++/etc to add this directory to the search path. Consult gcc documentation for exact flags to use. You should be able to pass these options to Mosquito by setting the LIB_CFLAGS variable.
Thanks for the quick response.
The only thing in /path/to/sysroots/x86_64-nilrt-linux/usr/include/ is a python2.7 folder which wouldn't contain the c++ folder. However I did find c++ headers in /path/to/sysroots/core2-64-nilrt-linux/usr/include/c++/4.9.2/. But that didn't work. I am not 100% sure I set up my make command correctly.
In the documentation I had a hard time telling the difference between what the command should be in the make file (which I don't want to edit), in the c++ code, or if it is in the make command.
So my make command was
make [WITH_UUID.... all the stuff I wrote above] -I /path/to/sysroots/core2-64-nilrt-linux/usr/include/c++/4.9.2/
But I am not confident with this or if I should just point to the include folder and not all the way to c++. It is also possible I'm way off base here too.
I am playing with the syntax to get it correct and I put in make .... LIB_CFLAGS=-I/path/to/sysroots/core2-64-nilrt-linux/usr/include/c++/4.9.2/ I get a new error.
IT says /path/to/sysroots/x86_64-nilrtsdk-linux/usr/bin/x86_64-nilrt-linux/x86_64-nilrt-linux-cc: Command not found
You might consider simply setting --sysroot and --isysroot to /path/to/sysroots/core2-64-nilrt-linux/ . (g)cc and it's ld should figure out the details with those two breadcrumbs, like which set of /usr/include/... subdirs to search for header. That might be easier than constructing compiler and linker search paths yourself. However, I have not tested this and I'm not completely sure it'll work.
I'll have to look into that, but right now how I am constructing it seems to be moving me forward.
My current error says
config.h: No such file or directory
So I am looking into this. I saw somewhere say I should have ran config.mk (which I didn't do) because it throws a lot of errors like
WITH_TLS_PSK:=yes: command not found
But I guess I have to run config.mk now and fix those problems.
Using generated code (config headers, makefiles, etc) is fairly common workflow in many projects. There's no clear standard for doing this. Autotools is one of the more widely used build systems out there. It seems this project rolled their own. In any case, the workflow is fairly ubiquitous and is exactly what you observed.. first run a script (or sometimes multiple scripts) to configure the source then run `make`. I highly recommend reading over build instructions to figure out their configuration process, then modify it as needed for cross compile.
This is the build instructions from the readme.md
I'll take a look at it again and see if I misunderstood something.
To build from source the recommended route for end users is to download the archive from http://mosquitto.org/download/.
On Windows and Mac, use
cmake to build. On other platforms, just run
make to build. For Windows, see also
If you are building from the git repository then the documentation will not already be built. Use
make binary to skip building the man pages, or install
docbook-xsl on Debian/Ubuntu systems.