Different os/abi in program and library - linux

I have an application that is used unittest, written with gtest. My application work fine on Windows platform, several days ago i try run application on linux platform. Linux that is used have following configuration:
cat /etc/*-release
Cluster Manager v7.2
slave
LSB_VERSION=base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Red Hat Enterprise Linux Server release 6.7 (Santiago)
Red Hat Enterprise Linux Server release 6.7 (Santiago)
I start build my application, for build we use cmake, that also include cmake from gcc:
add_subdirectory(/path/gtest/ ${PROJECT_BINARY_DIR})
add_executable(myApplication ${SOURCES})
add_dependencies(myApplication tinyxml2 gtest)
target_link_libraries(myApplication tinyxml2 gtest ${CMAKE_DL_LIBS})
During application build I do not have any error. After build i try execute application and have an error: Segmentation fault
During analysis i found that myApplication and gtest have different OS/ABI version:
myApplication: UNIX - System V
gtest: UNIX - Linux
tinyXML2: UNIX - System V
other binary and library also have: UNIX - System V
Do you know how i can fix this problem?
GCC version: 4.8.2

Related

CX_Freeze: The executable from Arch Linux doesn't work on Ubuntu 20.04 due to GLIBC incompatibility

Arch Linux is on GLIBC version 2.33 : https://archlinux.org/packages/core/x86_64/glibc/
but Ubuntu 20.04 is on GLIBC 2.31:
$/lib/x86_64-linux-gnu/libc.so.6 --version
GNU C Library (Ubuntu GLIBC 2.31-0ubuntu9.2) stable release version 2.31.
So, when I try to run on Ubuntu 20.04 the executable produced by CX_Freeze on my Arch Linux system, I get:
./Documents/exe.linux-x86_64-3.8/myapp: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by ./Documents/exe.linux-x86_64-3.8/myappp
./Documents/exe.linux-x86_64-3.8/myapp: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by ./Documents/exe.linux-x86_64-3.8/myapp)
How to make an executable from Arch linux which works on older Linux system like Ubuntu 20.04 (in term of GLIBC)?
How to make an executable from Arch linux which works on older Linux system like Ubuntu 20.04 (in term of GLIBC)?
Options:
run Ubuntu 20.04 in a virtualized environment and compile it there (ie. docker), or
compile glibc 2.31 from sources and install on archlinux and link your application with it, or
downgrade archlinux to the version with glibc 2.31, or
link statically with glibc or with other C standard library, or
copy compiled glibc libraries and distribute it with your application with a custom configuration and some startup script, or
distribute the whole chroot with archlinux with your application installed (you could use systemd-machine or publish docker image or similar).
TBH just run ubuntu:20.04 in a docker and build your application there. Typically applications are built for each distribution separately anyway.
You need to build a glibc from source and put all the libraries in a folder.
For example, for a Ubuntu 20.04 targeted system (which understands only executables compiled with GLIBC_2.31), put in a GLIBC_LIB folder the 5 produced so files:
ld-2.31.so
ld-linux-x86-64.so.2
libc.so.6
libm.so.6
libpthread.so.0
Then, run CX_Freeze with this:
LD_LIBRARY_PATH=/path/to/GLIBC_LIB python setup.py build
Note: you can't link a specific library file, you need to link a folder where the library is.

Toolchain to crosscompile Applications for BBB

My native machine is ubuntu based 14.04 LTS x86_64 system, I want to cross-compile applications and QT programs for Beaglebone black, which is an armv7 based system running on Debian 2015 distribution.
Which toolchain I should install on my native system, to get this done?
Here is a very usefull link how to set up the crosscompiler, uboot, kernel and the filesystem for a beaglebone black.
If you only want to crosscompiler, then just follow the few code lines in the Crosscompiler chapter
https://eewiki.net/display/linuxonarm/BeagleBone+Black
To cross-compile applications you need to use the ' arm-linux-gnueabihf ' compiler in the Ubuntu. Ubuntu 14.04 LTS was released with gcc-4.8.2. It is really important that the version of this GCC compiler matches the version deployed on the beaglebone black image. The reason for this is that different compilers have different libc versions, and version mismatching causes linker errors that are very tricky to solve.
You can try running,
gcc --version
on both your native Ubuntu system and the Beaglebone Black and see if the gcc version matches. If yes, you are good to go. Otherwise, install the appropriate toolchains.

Cuda - compile local and run remote

I want to compile my program locally and next run on server, because I haven't cuda capable graphics card.
My computer:
Kubuntu 12.04 x32
Nvidia display driver - lack
Nvcc - v6.01
Gcc - 4.6.3
Server:
Ubuntu 13.10 x64
Graphics card - GF GTX 480
Nvidia display driver - 337.xx
Nvcc - v6.01
Gcc - 4.8.1
Compilation on local computer:
nvcc kernel.cu
Running on server:
./a.out
But I get following error - "Cuda driver version is insufficient for cuda runtime version."
What's wrong? When I compile my code on server it work without problem.
The problem might be caused by the fact that you compile on x32 but execute on x64 architecture.
This problem is also described here: https://devtalk.nvidia.com/default/topic/555955/32-bit-executable-fails-with-insufficient-driver-version-on-64-bit-linux-os/
The solution provided there is to install the missing 32bit gcc libraries, which in your case (Ubuntu) should possible through:
sudo apt-get install lib32stdc++6

Install a GCC ARM Embedded toolchain

I would like to load a very simple, hello world program, on an Embedded ARM processor. For this, I would like to install a toolchain in order to cross compile my code. I am currently working on a 64-bit Linux OS. Does anyone know of a GCC ARM embedded toolchain that I can download? I've downloaded a pre-built version of Linaro GCC but it only runs on a 32-bit Linux machine and I can't install the ia32-libs package because my Linux machine has no internet connection.
The gcc-arm toolchain I'm using for ARM Cortex-M processors can be found here-
https://launchpad.net/gcc-arm-embedded
It also builds for Cortex-A targets, which should cover the majority of embedded ARM systems.
You can download standalone distributions for many operating systems, including linux.
There are also 64bit builds of Linaro toolchain here. Just download the x86_64 and not the i686 version.

ELF file OS ABI invalid

I am recently doing some experiment on building a cluster system for computing tasks. My server is Suse Linux Enterprise 11, and one of the client is Redhat Enterprise Linux 5. I compiled openmpi on Suse, and it runs fine alone. Then I shared /usr/local(where the openmpi was installed) to my Redhat client, and tried to do mpirun, the following error popped up: error while loading shared libraries: /usr/local/openmpi/lib/libopen-rte.so.0: ELF file OS ABI invalid. Does this mean that I have to compile openmpi on redhat separately? Thanks!

Resources