libmodbus cross compilation for qnx6.6.0 target - modbus

I have installed qnx6.6.0 as a guest system in VMware workstation 12.
Picture 1. qnx6.6.0 in VMware
Qnx6.6.0 operating system does not have any self-hosting abilities. Thus I use QNX Momentics IDE to cross compile binaries.
In my project I need to link extra libraries libmodbus. I am not able to compile in proper way libmodbus (version 3.0.6). I tried to do it in two ways:
-compile libmodbus in MinGW program(./configure && make), but in the result I got libmodbus.dll.
-compile in Ubuntu OS(./configure && make). In result I got libmodbus.so.5.0.5.
Both binaries are not possible to link into qnx project in Momentics IDE. I assume that the libmodbus compilation process, which I did is not correct. What should I put in arguments to script ./configure ? Is it possible to compile this dynamic library in Windows or Ubuntu system in order to ensure linking to QNX binary?

Related

How to install pybluez in a Python virtual environment?

I'm wondering how to install pybluez library in a Python virtual environment (Linux Ubuntu / Pop! OS).
The problem is simple: there's no bluetooth.h header in the virtual environment, so it fails during installation.
In real environment there's a series of libraries to install to do the work, but I'm unable to do the same in a virtual environment.
You will need to have the bluetooth.h file and the bluez development files available on the system at all (headers and system libraries are never in virtualenvs anyway).
On Ubuntu, apt install libbluetooth-dev should probably do the trick.
I want to ask to myself cause the problem was really singular and I think that someone else could be involved: the problem is that PyCharm IDE was installed through flatpack. So (I don't know the details cause I'm not an expert about this package format) the program run in a sort of vm and it's unable to recognize libraries under the "real" system. Imho this kind of software (ide I mean) should be inatalled directly with a "classic".deb package to avoid problems like this.

why does the error regarding gcc is occuring in matlab?

I have download that code from github.
Whenever that code tries to check mexopencv (a file inside lib folder). It shows an error on Matlab 2017a that is:
[error 3] please make sure gcc >= 4.4 g++ >= 4.4 is installed ...
I am having a gcc version of 8.8.0
Following is the description of system
Window 10
Visual Studio 2012
Matlab 2017a
opencv 2.4.10
mexopencv (install from your folder LIB)
You might lack of standard libraries (.dll in Windows but .lib in Linux). The code was developed under Linux (help is also only provided for Linux systems) and once tested under Windows 7.
The method was tested under OS linux lubuntu 14.04, CPU intel i5 and
16GB of RAM. This guide was written under a linux-based distribution
scope, more precisely debian. Unfortunately we lack experience to
address bugs or any problem that could emerge in non-linux OS, we will
provide only linux OS help regarding execution problems, we apologise.
we tested this code on Windows7. We successfully installed opencv
2.4.10 following this tutorial: [http://www.learnopencv.com/install-opencv3-on-windows/]
This suggests that the mex-function is also linux-based. The error should vanish if you compile the source code yourself on your system, e.g. with MinGW (also GCC), see here.
EDITED:
the README.markdown file (under LIB/mexopencv-master.zip) provides a little guide through the installation process of both, openCV and the mexopencv function for unix (including ubuntu 14.04) and Windows systems. The latter states:
Browse to mexopencv root folder, and type the following in the MATLAB
command window:
>> mexopencv.make
By default, mexopencv assumes the OpenCV library is installed in
C:\opencv. If this is not the case, specify the path as an argument:
>> mexopencv.make('opencv_path', 'c:\your\path\to\opencv')
Note that if you build OpenCV from source, this path specification
might not work out of the box. You need to replace dll files in the
OpenCV package with newly built binaries. Or, you need to modify
+mexopencv/make.m to correctly link your MEX-files with the library.
To remove existing mexopencv binaries, use the following command.
>> mexopencv.make('clean', true)
It requires a standard C++ compiler supported by Matlab (see here), any Visual Studio installation should be OK, as an open-source option MinGW is recommended. Just remember to pick the right system (usually 64-bit).

How do I prepare a Raspberry Pi with Raspbian so I can cross compile Qt5 programs from a Linux host?

I want to setup a cross compile environment on Linux for the Raspberry Pi 1.
Especially I want to try bleeding edge version, i.e. Raspbian testing + Qt5 dev branch.
This question:
How can I create a modern cross compile toolchain for the Raspberry Pi 1?
...explains how to get a gcc compiler, which can create code for the Raspberry Pi 1. Are there changes necessary on Raspbian itself to use it? If so, which ones?
A full toolchain is what you need
A toolchain is a set of tools working together to generate binaries for your system. Depending on how you build your toolchain, it might end up in being only functional for your own image, that's not, in fact a problem, you just clone your image and upgrade it at will.
First, understand what you need:
Functional flagship system. This is your reference board and your reference distro bundle, your packages and your stuff. You might want a standard Raspbian or you might want some extra stuff, like OpenCV or less stuff like removing Xorg. You say you want bleeding edge, so fit your taste.
Sysroot. Ideally this is a copy of your Functional Flagship System with the added development headers. In my case its exactly the same, for Raspbian this is an image of your second partition, the one that hosts /.
Cross compiler. This is a compiler that generates code for ARM while running on x86 or x86_64. This is generally a specialized gcc.
Cross compiled qmake. For Qt you need a cross qmake, this is a qmake that will generate Qt binaries and uses things you need to generate your arm Qt software.
ARM Qt libraries. This is part of your Functional Flagship System, I just enumerate it here for the sake of clarity. They will get compiled by you using your sysroot and your cross compiler.
Qt Libraries for Cross Compiling. This are a product of the steps you will follow when generating your cross compiling qmake and ARM Qt Libraries. This will be installed in your host x86 system.
So how do you get all of this?
Gather Your Very Own Toolchain
Functional Flagship System (FFF). Just get your raspbian image and install your additional software at will, whatever you want to be in, just install it on a live Raspberry.
Sysroot. Once you have your FFF, then use dd to generate an image of your second raspbian partition. Get your card off, insert it into a x86 system and use dd. There are other ways using mount and offsets but this is a lot simpler.
Cross compiler. Unless you really know what you are doing, just refrain from creating it yourself. There are functional cross compilers.
Qmake for cross compiling, ARM Qt and Qt Libraries. This is the interesting part...
Cross Compiling Qt 5
You can go as bleeding edge as you please with Qt as you get it from git. As this is not really a Wiki I will just enumerate the steps. This guide explains it with a lot more detail.
Get your FFF, image and cross compiler working.
git clone your Qt, pick a tag (version)
mount your sysroot
Get ia32-libs if you are under x64
Compile qtbase then make install. IMPORTANT: After you get qtbase it generates it's own qmake, use it from now on.
Use the generated and installed qmake from qtbase to build any other Qt module you want.
Remember to use make install on all Qt modules you build. All these 'installs' will copy those binaries to your sysroot.
Get your Qt into your FFF. Either you copy the folder and avoid messing with permissions, or more easily just umount your sysroot, then use dd to dump the modified image to the very same physical partition you got it from. These are the ARM Qt Libraries.
When building qtbase it will install some stuff into your own x86 system. This is Qmake for cross compiling, use it into Qt Creator to generate cross compiled binaries along with your cross compiler.
Some notes nobody tells you
There seem to be no toolchains ready to download. This is because they depend a lot on your specific setup.
Do not use system or regular qmake to cross compile. Use your generated qmake, as it fits perfectly with your FFF, it has paths and other specific stuff baked in.
I repeat, do not bother creating your cross compiler
What if you need additional development files? Install them on your FFF, then copy your partition to have your new sysroot.
Yes, you can auto-deploy with Qt and even debug remotely on a live Pi.
Installing a bleeding edge development system/toolchain is a bit of a problem... It is a moving target. The following steps did work for me March 2015. If they still 100% work or how long they will work... But if one have read and understood the following 'walktrough' it should not be difficult to adjust the process for future Raspian or Qt5 versions.
Fist step should be to update Raspian. I upgraded to testing. To do this, change the repository in /etc/apt/sources.list to:
deb http://mirrordirector.raspbian.org/raspbian/ testing main contrib
non-free rpi
Followed by the usual 'apt-get update, apt-get upgrade, apt-get dist-upgrade'. Or an analogue aptitude command. After this step one has upgraded to the most recent Raspian. With all the risks and benefits of a testing release.
Next a couple of packages needs to be installed. Probably not all necessary, e.g. xcb does not work on a RPi, and the RPi hat its own set of opengl files. But some Raspian packages don't know this and might pull them in anyways. The packages below allow to compile a Qt5 with QMultimedia and
apt-get install -y "^libxcb.*" libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libicu-dev libxslt1-dev
apt-get install -y libssl-dev libxcursor-dev libxrandr-dev libfontconfig1-dev libcap-dev libbz2-dev libgcrypt11-dev
apt-get install -y libpci-dev libnss3-dev libxtst-dev libasound2-dev libcups2-dev libpulse-dev libudev-dev
apt-get install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libproxy-dev libmtdev-dev libts-dev
apt-get install -y libxkbcommon-x11-dev libxkbcommon-dev libinput-dev libgbm-dev libjpeg8-dev libgif-dev libopenjpeg-dev
apt-get install -y libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev sqlite3 libsqlite3-dev libwayland-dev
apt-get install -y libdirectfb-dev libegl1-mesa-dev libsystemd-journal-dev libharfbuzz-dev xutils-dev libcairo2-dev
apt-get install -y libffi-dev libpam0g-dev
The next and most important step is also the most unpleasant one. A couple of libraries in Raspian are symbolic links with absolute paths. This is bad since those libraries are later on not found when Qt5 is compiled. All symlinks of relevant libs must be turned into symlinks with relative paths. With Google's help a script can be found, which did this almost automatically, but for some reason it did not work for me. Therefore I did it manually. If I have to do this more often, I certainly will write my own. This is also the step, which is most likely to break. Library versions change... so don't blindly copy/paste the commands below.
Not all of the libs below are necessary to compile Qt5, but all of them could be a problem eventually. After this step the Raspberry Pi is ready to be used. Next step is to compile and install Qt5.
EDIT: One of the side effects of writing such a mini-tutorial: One thinks again about certain things one has done. There is a much easier way to convert absolute links into relative links: symlinks.
So:
apt-get install symlinks
And then in /usr/lib/ on the Raspberry Pi:
symlinks -cr .

How to deploy QT5.2 application?

I have QT 5.2 installed on Ubuntu 12.04. I did not build it, but simply downloaded and unzipped from the QT website. My question is how can we package the required libs along with the executable for deployment? The QT documentation says that we should build QT for static linking, but the "configure" file is missing in the QT directory.
Thanks in advance.
Ok. So I finally managed to deploy my Qt app along with its dependencies after countless hours of googling. This was done on Ubuntu 12.04 with Qt 5.2.
This is how I did it:
Statically build Qt from the source using the following command :
./configure -opensource -confirm-license -prefix ./qtbase -make libs -make tools -release -opengl desktop -static -skip qtwebkit -no-icu -nomake tests -nomake examples
make -j -4
You can download the source from http://download.qt-project.org/official_releases/qt/5.2/5.2.1/single/qt-everywhere-opensource-src-5.2.1.tar.gz
You cannot static build the installer version of Qt.
Open your Qt project and rebuild it. The Qt dependencies will be built into the app executable. Check with ldd to see if it was done correctly.
ldd ./<app_executable>
Now when you try to run this on a system without Qt it might ask for other third party dependencies which you see with ldd. Eg: libxcb-...
You could either install these dependencies with apt-get on the target system or supply the libs with your app. That is: put the required .so files and their soft links into a directory named libs along with your executable.
After the lib dependency problems are fixed the App will give an error about missing Qt fonts. Easiest way to fix this is to supply the Qt fonts folder along with the app.
This link gives a good way of doing this:
http://goblincoding.com/2013/11/07/deploying-qt-5-applications-on-ubuntu-12-04/
The summary of the above page is that you need to supply a small bash script to run your app. the script should be as follows:
#~/bin/bash
export LD_LIBRARY_PATH=./libs
export QT_QPA_FONTDIR=./fonts
./<app_executable>
The target system will now find the libs and the fonts from the directories you supplied and will run without issues. Hope this helped.
NOTE: I haven't tried, but this script method should work even if you are supplying the Qt libs as well without statically building the qt source.

How to setup opencv2.4.0 with mingw in Netbeans?

How to setup opencv2.4.0 with mingw in Netbeans? I want to make the setup in windows xp x86 machine?
Updated:
I made a setup as set in this link SO link. My program get compiled properly but while executing, it got crahed.
I also Posted the same in this link-MyPost
User PATH Variables:
C:\ctags;C:\cscope;C:\MinGW\bin;C:\OpenCV2.4.0\build\x86\mingw\bin;
System PATH variable:
./bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\system32\wbem;C:\Program
Files\Intel\WiFi\bin;C:\Program
Files\TortoiseSVN\bin;C:\WINDOWS\system32\gs\gs7.05\bin;C:\cscope;C:\ctags;C:\Program
Files\Vim\vim73;C:\Program Files\QuickTime\QTSystem\;C:\Program
Files\Java\jre6\bin;C:\Program Files\Windows
Imaging\;C:\MinGW\msys\1.0\bin;C:\OpenCV2.4.0\build\x86\mingw\bin;C:\MinGW\bin;
Update:
I tried compiling and adding TBB path in windows 7. Even after adding the PATH I get the same issue and the snap shot of the error is below:
I tried the same in windows XP and I didnt get the above error but the application get crashed as before.
Did you do this?
Since version 2.1, OpenCV use the TBB library to support parallel processing.
If you use MinGW as a compile suite you should compile TBB yourself
http://opencv.willowgarage.com/wiki/TBB
http://opencv.willowgarage.com/wiki/MinGW
After compilation, you need to add its path to system path.
FYI, OpenCV 2.4.2 provided with compiled TBB dll for MingW.