Build C++ RTMAPS package on Ubuntu 16.04 & Ubuntu 18.04 - c++

I'm working on a C++ project that should support Ubuntu 18 & Ubuntu 16.
I'm actually working on QT (but I'm not sure this is useful information): QT 5.13.2 GCC 64bit
With a C++ compiler: GCC(C++, x86 64bit in /usr/bin)
This project uses a library that I acquired when installing the RTMAPS SDK.
So when I compile it and use it in a PC with Ubuntu 18.04 it works fine. When I try using it in a PC with Ubuntu 16.04 I get the error:
Error: Unable to load package /path/: it was built for another operating system (Ubuntu 18.4)
I have compiled this same project in a Ubuntu 16.04 PC and it runs in the that PC.
Questions:
Is there a way to compile on Ubuntu 18.04 targeting 16.04? (or in general different versions?)
If the library is also a problem, can I just copy paste one generated in Ubuntu 16.04?
Can I have RTMAPS's libraries for both OSs in the smae environement?

Related

How to invoke clang to use current OS GLIBC?

I am building an application in which the application is using GN and ninja to build files. The application is currently building on Ubuntu 20.04 and I am using clang to compile files. But the issue is when I try to build and execute the executable in Ubuntu 18.04, it is giving me this error:-
./application: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /path/to/lib.so)
So, this basically means that clang is not able to build the files according to the current OS. Is there any flag I need to use to make it work with the current OS? or is there any other to overcome this issue?

Device memory allocation fails on WSL2

I am trying to run a simple c++ program, with Cuda Thrust functions, on WSL2. It seems that program fails in runtime to allocate device memory. I use Thrust with Microsoft visual studio all the time, and I don’t get any errors.
CMakeLists.txt:
cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
project(proj LANGUAGES CXX CUDA)
add_executable(proj
proj.cu
)
proj.cu:
#include<thrust/host_vector.h>
#include<thrust/device_vector.h>
#include<thrust/fill.h>
int main()
{
//thrust::host_vector<int> h_vec(10);
//thrust::fill(h_vec.begin(), h_vec.end(), 1);
thrust::device_vector<int> d_vec(10);
//thrust::fill(d_vec.begin(), d_vec.end(), 1);
return 1;
}
output:
terminate called after throwing an instance of 'thrust::system::system_error'
what(): get_max_shared_memory_per_block :failed to cudaGetDevice: unknown error
Aborted (core dumped)
If I comment the device_vector line, and use the host vector instead, it runs with no errors.
Additional info:
GeForce GTX 950M
Windows 11 Home. build 22000.51.
WSL2: Ubuntu-18.04
Cuda compilation tools, release 9.1, V9.1.85
Before I post the question, I had already seen the instructions in here , and both downloaded and installed the CUDA driver for WSL, and joined the windows insider program and upgraded to windows 11 build. It did not work though.
But I also had Ubuntu 18.04 installed. I think it was installing Ubuntu 20.4 instead that made the program run without errors in the end!
So, this is what I did to solve this:
-installed Ubuntu 20.04 from Microsoft store (It asked me to download and run a WSL fix first, which I did)
-In powershell, I removed Ubuntu 18.04
wsl --unregister Ubuntu-18.04
Replace Ubuntu-18.04 with the name of your distribution. You can get its name in powershell by
wsl --list
-installed cmake and g++-9 (gcc-9 was already installed)
-downloaded the cuda toolkit using the instructions in here
Then
cmake -DCMAKE_CUDA_COMPILER=/usr/local/cuda-11.0/bin/nvcc ..
make
./proj

Selecting cross compiler for Raspberry Pi

Looking for cross compiler that could help me build application for Raspberry Pi on my Ubuntu 20.04 machine. I found official tools on Github and I suppose that folder arm-bcm2708 contains cross compilers:
arm-bcm2708hardfp-linux-gnueabi
arm-bcm2708-linux-gnueabi
arm-linux-gnueabihf -> arm-rpi-4.9.3-linux-gnueabihf
arm-rpi-4.9.3-linux-gnueabihf
gcc-linaro-arm-linux-gnueabihf-raspbian
gcc-linaro-arm-linux-gnueabihf-raspbian-x64
I'm confused what directories names is trying to tell me? I know following words:
arm - processor type used on Pi
bcm2708 - processor model used on pi
gnueabi - cross-compiler for armel architecture (you can build binary for ARM on PC)
linaro - company that creates multimedia for ARM
4.9.3 - I suppose is GCC compiler version (why it is so old?)
Which of compilers I should use for my Pi3 and Pi4?
You can use one of the toolchains provided by ARM for your RPI3/4.
If you are running a 32 bit Linux on your RPI3/4, use one of the arm-none-linux-gnueabihf toolchains, if use are running a 64 bit Linux on your RPI3/4, use one of the aarch64-none-linux-gnu one.
Both 10.2 and 9.2 versions of the two toolchains are working fine on my own Ubuntu 20.04.1 LTS x86_64 system. Of course, you can cross-compile programs with the arm-none-linux-gnueabihf toolchain and run them on the 64 bit Linux running on your RPI3/4 as well.

Missing file in OpenCV 3.1.0 for Ubuntu 14.04

I am trying to run this code Domain Transform Filter on Ubuntu 14.04. This code has been originally written on Windows 7 Visual studio. When I try to run this code on Ubuntu, I get the error
error: opencv2/core/internal.hpp: No such file or directory
I tried to download this file for Ubuntu but this is specifically related to Windows.
Is there any way to get this file for Ubuntu ?
Install an older OpenCV.
The file is for instance contained in libopencv-core-dev 2.3.1 on Ubuntu 12.04. (So it is not related to Windows.)
If that is not an option, you probably need to correct your existing code for OpenCV 3.

Cross-compiling python extensions under Linux using distutils

Is there any way to compile both Windows and Linux versions of Python/distutils/SWIG/C++ extensions under Linux? As far as I understand the problem is at least in obtaining windows version of python-dev.
Thank you.
You could do it in two ways:
Install MingW on your linux system, and cross-compile the extension using it
Compile it in a Windows Virtual Machine (eg. Windows7 on VirtualBox)
I prefer the second option as it gives the opportunity to test that your program is working