You may have mixed ABIs. There are currently several ABIs for ARM processors in common use, due to the variety in ARM CPUs. Check that you have a gnueabihf binary, and not a gnueabi binary. You can install both kinds of binaries on the same system, but you can't link both kinds of libraries inside a single executable. It's like 32-bit and 64-bit executables on x86 systems.

With LD_LIBRARY_PATH, the right command to add the variable in the environment for the duration of the ldd command is

LD_LIBRARY_PATH=/usr/lib/arm-linux-gnueabihf/ ldd /path/to/binary

You wrote ldd LD_LIBRARY_PATH=/usr/lib/arm-linux-gnueabihf/ /path/to/binary which tells ldd to act on a file called LD_LIBRARY_PATH=/usr/lib/arm-linux-gnueabihf/.

Answer from Gilles 'SO- stop being evil' on askubuntu.com
🌐
GitHub
github.com › void-linux › void-packages › issues › 11693
cross-arm-linux-gnueabihf-libc: missing symlink from /usr/arm-linux-gnueabihf/lib -> usr/lib · Issue #11693 · void-linux/void-packages
May 13, 2019 - System xuname: output of xuname (part of xtools) package: cross-arm-linux-gnueabihf-libc-0.30_1 Expected behavior Have this symlink as with e.g. cross-aarch64-linux-gnu-libc Actual behavior arm-linux-gnueabihf-gcc test.c /usr/lib/gcc/arm...
Author   void-linux
🌐
GitHub
github.com › openethereum › parity-ethereum › issues › 10274
Error with -ludev when cross compiling for ARMv7 · Issue #10274 · openethereum/parity-ethereum
February 1, 2019 - Compiling parity-ethereum v2.2.7 (/home/thevidoja/Desktop/parity-ethereum-2.2.7) Building [=====================================================> ] 490/491: parity(bin) error: linking with arm-linux-gnueabihf-gcc failed: exit code: 1 | = note: "arm-linux-gnueabihf-gcc" "-Wl,--as-needed" ... "/home/thevidoja/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/libcompiler_builtins-d0572f7a936161bf.rlib" "-Wl,-Bdynamic" "-ludev" "-lstdc++" "-lstdc++" "-lutil" "-lutil" "-ldl" "-lrt" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil" = note: /usr/lib/gcc-cross/arm-linux-gnueabihf/7/../../../../arm-linux-gnueabihf/bin/ld: cannot find -ludev collect2: error: ld returned 1 exit status error: aborting due to previous error error: Could not compile parity-ethereum.
Author   openethereum
🌐
GitHub
github.com › eclipse-paho › paho.mqtt.c › issues › 844
arm-none-linux-gnueabi/bin/ld: cannot find -lpaho-mqtt3c · Issue #844 · eclipse-paho/paho.mqtt.c
April 18, 2020 - root@mindlogic-VirtualBox:/home/mindlogic/octane_etk_sample-6.0.0.240# make arm mkdir -p ./bin arm-none-linux-gnueabi-g++ \ -Wno-write-strings \ -Iinclude \ speedway_embedded_example.cpp -L/home/mindlogic/octane_etk-6.0.0.240/paho.mqtt.c/build/src/ -lpaho-mqtt3c \ -Llib \ -static -lltkcpp_atmel -lltkcppimpinj_atmel -lxml2_atmel \ -lssl_atmel -lcrypto_atmel -ldl_atmel \ -o bin/speedwayr_arm /home/mindlogic/octane_etk-6.0.0.240/arm-toolchain/bin/../lib/gcc/arm-none-linux-gnueabi/4.8.1/../../../../arm-none-linux-gnueabi/bin/ld: cannot find -lpaho-mqtt3c
Author   eclipse-paho
Find elsewhere
🌐
The Mail Archive
mail-archive.com › linaro-toolchain@lists.linaro.org › msg04243.html
Prebuilt Linaro 2014.04 arm-linux-gnueabihf: cannot find /lib/ld-linux-armhf.so.3
May 26, 2014 - Hi, I've been having this issue with latest binary Linaro 2014.04 toolchain from http://releases.linaro.org/14.04/components/toolchain/binaries/gcc-linaro-arm-linux-gnueabihf-4.8-2014.04_linux.tar.xz · It comes with own sysroot, but linker fails to locate /lib/ld-linux-armhf.so.3 $ make ...
🌐
Stack Exchange
raspberrypi.stackexchange.com › questions › 92468 › trying-to-compile-arm-binary-using-dockerfile-failing
cross compilation - Trying to compile arm binary using Dockerfile, failing - Raspberry Pi Stack Exchange
December 31, 2018 - FROM ubuntu:16.04 WORKDIR /build # install tools and dependencies RUN apt-get -y update && \ apt-get install -y \ curl udev git make g++-4.8-multilib-arm-linux-gnueabihf g++ gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf \ libc6-dev-armhf-cross wget file ca-certificates libudev-dev cmake build-essential \ binutils-arm-linux-gnueabihf lib32z1-dev gcc-arm* && apt-get clean # install rustup RUN curl https://sh.rustup.rs -sSf | sh -s -- -y # rustup directory ENV PATH /root/.cargo/bin:$PATH ENV RUST_TARGETS="arm-unknown-linux-gnueabihf" # multirust add arm--linux-gnuabhf toolchain RUN rustup targe
🌐
Linaro
lists.linaro.org › archives › list › linaro-toolchain@lists.linaro.org › thread › KVVU5WE7ON4Z5W734AP2HJ7CNEZADIYT
Prebuilt Linaro 2014.04 arm-linux-gnueabihf: cannot find /lib/ld-linux-armhf.so.3 - linaro-toolchain - lists.linaro.org
I've been having this issue with latest binary Linaro 2014.04 toolchain from http://releases.linaro.org/14.04/components/toolchain/binaries/gcc-linaro-ar... It comes with own sysroot, but linker fails to locate /lib/ld-linux-armhf.so.3 · $ make arm-linux-gnueabihf-gcc -I/tmp/include/libnl3/ ...
🌐
Stack Overflow
stackoverflow.com › questions › 37487070 › where-can-i-find-a-manpage-for-arm-linux-gnueabihf-ld-let-alone-a-well-written
c++ - Where can I find a manpage for arm-linux-gnueabihf-ld, let alone a well-written one, that includes -rpath and -rpath-link? - Stack Overflow
May 27, 2016 - It turns out that the problem was that the output of arm-linux-gnueabihf-ldd (which I ran from Cygwin, because the Ubuntu installation doesn't include it and can't find it through apt-file), and which I read through at least three times, showed me that ld-linux-armhf.so.3 was not found, and I finally realized that this is not ld-linux.so.3, so I created a soft link and now get /lib/libc.so.6: version `GLIBC_2.15' not found.
Top answer
1 of 2
2

The problem is simple. It is in the --sysroot option. The value of this option is /usr/arm-linux-gnueabihf/ and it is used by the linker and the resulting library folder becomes /usr/arm-linux-gnueabihf/usr/arm-linux-gnueabihf/lib/

I removed the --sysroot option from line 68 in the file GNUmakefile-cross and everything compiled and linked OK.

However, I couldn't run the example on my BeagleBone Black because of mismatch of some shared libraries versions. But this wasn't a real problem for me, because in my application I link crypto++ statically, not dynamically.

2 of 2
0

Based on Crosswalking's research I think I can explain what is going on. I don't think I agree with the assessment "The problem is simple. It is in the --sysroot option" since the Crypto++ environment script and makefile are doing things as expected.

I think Crosswalking's answer could be how to work around it; but see open questions below. The following is from Crypto++ Issue 134: setenv-embedded.sh and GNUmakefile-cross:

I think this another distro problem, similar to g++-arm-linux-gnueabi cannot compile a C++ program with --sysroot. It might be a Ubuntu problem or a Debian problem if it is coming from upstream.

When cross-compiling, we expect the following (using ARMHF):

  • SYSROOT is /usr/arm-linux-gnueabihf
  • INCLUDEDIR is /usr/arm-linux-gnueabihf/include
  • LIBDIR is /usr/arm-linux-gnueabihf/lib
  • BINDIR is /usr/arm-linux-gnueabihf/bin

How LIBDIR morphed into into /usr/arm-linux-gnueabihf/usr/arm-linux-gnueabihf/lib/ (i.e., $SYSROOT/$SYSROOT/lib) is a mystery. But in all fairness, building GCC is not a trivial task.

You should probably file a bug report with Debian or Ubuntu (or whomever provides the toolchain).


The open question for me is, since $SYSROOT/lib is messed up, then is $SYSROOT/include messed up, too?

If the include directory is also messed up, then the cross compile is using the host's include files, and not the target include files. That will create hard to diagnose problems later.

If both $SYSROOT/include and $SYSROOT/lib are messed up, then its not enough to simply remove --sysroot. Effectively, this is what has to be done:

Copy# Exported by setenv-embedded
export=ARM_EMBEDDED_SYSROOT=/usr/arm-linux-gnueabihf

# Used by the makefile
-I $ARM_EMBEDDED_SYSROOT/$ARM_EMBEDDED_SYSROOT/include
-L $ARM_EMBEDDED_SYSROOT/$ARM_EMBEDDED_SYSROOT/lib

Which means we should be able to do the following:

Copy# Exported by setenv-embedded
export=ARM_EMBEDDED_SYSROOT=/usr/arm-linux-gnueabihf/usr/arm-linux-gnueabihf

# Used by the makefile
--sysroot="$ARM_EMBEDDED_SYSROOT"

Finally, this looks a lot like Ubuntu's Bug 1375071: g++-arm-linux-gnueabi cannot compile a C++ program with --sysroot. The bug report specifically calls out ... the built-in paths use an extra "/usr/arm-linux-gnueabi".

We need the paths:

A) /usr/arm-linux-gnueabi/include/c++/4.7.3
B) /usr/arm-linux-gnueabi/include/c++/4.7.3/arm-linux-gnueabi

But the built-in paths tries to use:

C) /usr/arm-linux-gnueabi/usr/arm-linux-gnueabi/include/c++/4.7.3
D) /usr/arm-linux-gnueabi/usr/arm-linux-gnueabi/include/c++/4.7.3/arm-linux-gnueabi/sf E) /usr/arm-linux-gnueabi/usr/arm-linux-gnueabi/include/c++/4.7.3/backward

Notice the built-in paths use an extra "/usr/arm-linux-gnueabi"