I'm novice in cross-compiling and just started to cross-compile packages on my linux machine (amd64) for host (NAS) with ARMv5 (linux kernel 2.6.31.8). I installed crosstool-ng and with it created toolchain for compilation for ARM. According to some tutorials online I succeeded to compile x264 package. But now when I try to run it, I was given the following error message
./x264: /lib/libm.so.6: version 'GLIBC_2.15' not found (required by ./x264)
Ok now I see that I need libm library but what it is and how to compile x264 with it?
From the error message: the version of x264 you built requires version of glibc 2.15. The Glibc is built as part of your cross compilation toolchain (through crosstool-ng).
You need to build a new toolchain with the same version of glibc found on your NAS root filesystem (or compatible).
(edited after #NotLikeThat comment)
Related
I'm trying to cross compile a Rust project from x86-64 to armv7 (Raspberry Pi 3B+). That project uses the cxx for some of its functionality.
I set up the toolchain, installed the armv7-unknown-linux-gnueabihf target with rustup, and after some trial and error, I copied the required header files to /usr/arm-none-linux-gnueabihf/include. I also copied the /usr/lib/arm-linux-gnueabihf directory from a live Raspbian to /usr/arm-none-linux-gnueabihf/lib.
Then I executed cargo build --target armv7-unknown-linux-gnueabihf. That gives me the following error: https://pastebin.com/2LVZnQMQ.
I then made sure that libc.so.6 is in /usr/arm-none-linux-gnueabihf/lib and libc_nonshared.a is in /usr/arm-linux-gnueabihf/. That did not solve the issue.
I am lost as to what more the linker wants. What else do I need to copy to successfully compare the binary?
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.
I need to use tools that depend on clang on a Unix machine I remote onto at work. Anything I install is locally installed onto ~/local. I do not have root permissions.
/usr is pretty outdated, with gcc being at version 4.4.7. clang requires gcc 4.7+
I read on linux from scratch that a gcc 6.1 installation requires 8.4 gb. This is not something I can do, because that's huge.
Can someone advise me on the best workaround to install up to date clang on my ~/local?
Please and thanks.
Edit:
Courtesy of Nishant, here is the short answer:
Set up a personal machine running the same linux distro and cross compile using gcc to your specific architecture. For me, I will run a Redhat 6.5 VM and compile using gcc an arm x64 binary. Thanks Nishant!
You can get pre-build binaries for Unix system from LLVM's release website: http://llvm.org/releases/
You can then put the binaries in any local folder you want and source it using the PATH variable, which can be done by modifying your ~/.bashrc file by appending:
export PATH=$PATH:<clang-binary-directory>
Now you will able to use clang from the command line terminal as if it was installed.
If you want to build from source only, you can get older source code of clang which will use gcc 4.4.7 and build it and then use clang to build clang. Or get the latest clang binary and use it to build latest clang.
I wanted to run an OpenCV project on ARDrone (which is powered by arm7l).
So I cross compiled OpenCV for arm processor, moved the .so files to the drone and updated the LD_LIBRARY_PATH.
Now running the cross compiled OpenCV project throws the following error:
/lib/libc.so.6: version `GLIBC_2.15' not found (required by /data/video/opencvlib/libopencv_highgui.so.2.4)
Where do I get this libc.so
As #Notlikethat suggested I tried copying my cros-toolchain's shared libraries to ARM, it solved the above issue but caused other problems.
For a more permanent solution I followed #Chris 's suggestions and recompiled opencv with board's cross compiler.
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.