Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 5944

WSL Ubuntu: How to setup gcc to cross-compile for arm with a specific glibc version?

$
0
0

I'm not really an expert of linux, so i'm feeling a bit lost.

I'm running an Ubuntu 22.04.3 LTS image in WSL, as i need to cross-compile a program for an ARM linux pc (a BeagleBone Black, "BBB" from now) using a Windows PC. That image was automagically installed by the Powershell command WSL.exe --install and i'm fine with it.

I've been able to add the armhf architecture, the gcc-arm-linux-gnueabihf and to build my program but i've got a glibc version error from the BBB.

So i tried to install the same GCC version that's on the BBB, which is the 10, but no luck. Tried the 9 and same result.


This is how i have installed everything on the WSL UBUNTU (omitting all the update/upgrade):

    sudo bash -c "echo 'deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports       jammy main restricted universe multiverse'>  /etc/apt/sources.list.d/armhf.list"    sudo bash -c "echo 'deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports       jammy-updates main restricted universe multiverse'>> /etc/apt/sources.list.d/armhf.list"    sudo bash -c "echo 'deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports       jammy-security main restricted universe multiverse'>> /etc/apt/sources.list.d/armhf.list"    sudo bash -c "echo 'deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports       jammy-backports main restricted universe multiverse'>> /etc/apt/sources.list.d/armhf.list"    sudo dpkg --add-architecture armhf    sudo apt install build-essential checkinstall -y    sudo apt install  gcc-9-arm-linux-gnueabihf g++-9-arm-linux-gnueabihf -y    sudo update-alternatives --install \                          /usr/bin/arm-linux-gnueabihf-gcc          arm-gcc          /usr/bin/arm-linux-gnueabihf-gcc-9 \                100 \                --slave   /usr/bin/arm-linux-gnueabihf-cc           arm-cc           /usr/bin/arm-linux-gnueabihf-gcc-9 \                --slave   /usr/bin/arm-linux-gnueabihf-c++          arm-c++          /usr/bin/arm-linux-gnueabihf-g++-9 \                --slave   /usr/bin/arm-linux-gnueabihf-cpp          arm-cpp          /usr/bin/arm-linux-gnueabihf-cpp-9 \                --slave   /usr/bin/arm-linux-gnueabihf-g++          arm-g++          /usr/bin/arm-linux-gnueabihf-g++-9 \                --slave   /usr/bin/arm-linux-gnueabihf-gcov         arm-gcov         /usr/bin/arm-linux-gnueabihf-gcov-9 \                --slave   /usr/bin/arm-linux-gnueabihf-gcov-dump    arm-gcov-dump    /usr/bin/arm-linux-gnueabihf-gcov-dump-9 \                --slave   /usr/bin/arm-linux-gnueabihf-gcov-tool    arm-gcov-tool    /usr/bin/arm-linux-gnueabihf-gcov-tool-9 \                --slave   /usr/bin/arm-linux-gnueabihf-lto-dump     arm-lto-dump     /usr/bin/arm-linux-gnueabihf-lto-dump-9 \                --slave   /usr/bin/arm-linux-gnueabihf-gcc-ar       arm-gcc-ar       /usr/bin/arm-linux-gnueabihf-gcc-ar-9 \                --slave   /usr/bin/arm-linux-gnueabihf-gcc-nm       arm-gcc-nm       /usr/bin/arm-linux-gnueabihf-gcc-nm-9 \                --slave   /usr/bin/arm-linux-gnueabihf-gcc-ranlib   arm-gcc-ranlib   /usr/bin/arm-linux-gnueabihf-gcc-ranlib-9    sudo apt install libgtk-3-dev:armhf -y

Now, instead of building my project, which takes too much time, I've built the sample code in the accepted answer of this question both on the UBUNTU and the BBB.

The one built on the BBB outputs:

GNU libc version: 2.31

The one build on the PC always output this error:

./glibc-version-ARM: /lib/arm-linux-gnueabihf/libc.so.6: version `GLIBC_2.34' not found (required by ./glibc-version-ARM)

So, i am clearly missing something which is not related to the GCC version. Could someone help me making my cross-compiling working?


Viewing all articles
Browse latest Browse all 5944

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>