SDL and portability issue - sdl

I compiled simple program on my i386 laptop. Then i try to execute it on amd64 PC and it starting, but then
SDL_Init Error: No available video device
OS: debian 7.6.0 on both computers.
I installed libc6:i386, it didn't help

Related

Install arm64 packages on A amd64 machine

I have A Raspberry Pi 3 device, the arch is arm64. And I have a ubuntu computer, the arch is amd64. I am doing the cross compile. I want to do the cross compile my code on the ubuntu and then copy the executables to the Raspberry to execute. My software depends opencv, ffmpeg...etc. I Have tried the MultiArch solution. When I try to download ffmpeg:arm64, the apt show me this error.
So I tried to download the first dependency libavcodec58, but the result is:
and When I tried to install the dependency glibc, the result is here:
The Apt will remove all the libraries from my current system.
So could anyone can help me about this?

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

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

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?

Docker Centos, Cannot Execute Binary File

I have one C++ binary which is running smoothly on local centos. Recently, I started learning docker and trying to run my C++ application on centos docker.
Firstly, I pulled centos:latest from docker hub and installed my C++ application on it and it ran successfully, without any issue. Now i installed docker on raspberry-pi and pulled centos again and tried to ran the same application on it but it gave me error.
bash : cannot execute binary file
Usually, this error comes when we try to run application on different architecture then the one they are built on. I checked cat etc/centos-release on raspberry-pi and result is CentOS Linux release 7.6.1810 (AltArch),where as result on local centos is CentOS Linux release 7.6.1810 (Core)
uname -a on both devices is as follows
raspberry-pi, centos docker Linux c475f349e7c2 4.14.79-v7+ #1159 SMP Sun Nov 4 17:50:20 GMT 2018 armv7l armv7l armv7l GNU/Linux
centos, centos docker Linux a57f3fc2c1a6 4.15.0-46-generic #49-Ubuntu SMP Wed Feb 6 09:33:07 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
EDIT:
Also, file myapplication
TTCHAIN: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.24, BuildID[sha1]=287b501c8206893f7819f215ee0033586212b143, with debug_info, not stripped
My question is how can i ran the same native application of centos, pulled from docker on raspberry-pi model 3.
Your application has been built for x86-64. Intel x86-64 binaries CAN NOT run on an ARM processor.
You have two paths to pursue:
If you don't have source code for the application, you will need an x86-64 emulator that will run on your Raspberry Pi. Considering the Pi's lesser capabilities and Intel's proclivity to sue anyone who creates an emulator for their processors, I doubt you'll find one that's publicly available.
If you have the source code for the application, you need to rebuild it as a Raspberry Pi executable. You seem to know that it was written in C++. GCC and other toolchains are available for the Raspberry Pi (most likely a "yum install gcc" on your Pi will grab the compiler and tools for you). Building the application should be extremely similar to building it for x86_64.
You could find a cross-compiler that would let you build for the Pi from your x86_64 box, but that can get complicated.
Could be that you are trying to run a 64-bit binary on a 32-bit processor, would need more information to know for sure though.
You can check by using the file command in the shell. You may have to re-compile on the original system with the -m32 flag to gcc.
Please do a "uname -a" on both devices and post the results.
Most likely the processor or library type doesn't match.
I presume (hope) you're not trying to run an x86-compiled app on a Pi. Although Docker is available for both processor types, Docker will not run x86 binaries on Pi or vice versa.
Actually, AltArch currently means one of the following architectures... ppc64, ppc64le, i386, armhfp (arm v7 32-bit), aarch64 (arm v8 64-bit). Core suggests the mainstream x86 and x86_64 builds of CentOS.
Yep, I bet that's what it is...you can't just transfer an x86 binary to a Raspbian and expect it to work. The application must be rebuilt for the platform.

Building openocd on linux for windows requires which winusb drivers

I need to build openocd for windows. I tried building openocd on linux for 64-bit windows by using spec file. Build succeeded but when I tried to use the generated openocd.exe on windows, it gives me the error
“LIBUSB_ERROR_NOT_FOUND”.
On windows, although I have WINUSB drivers which I am using to program MCU, I am still getting same error.
Can anybody help, Does anybody also face the same issue?
Although if I am building openocd through cygwin on windows machine, openocd works properly.
My requirement is to build on linux machine only.
PS: I am using fedora fc25 linux machine