I've managed to cross compile glibc using the following commands
../configure arm-none-linux-gnueabi --host=arm-none-linux-gnueabi --target=arm-linux-gnueabi --prefix=`pwd` --build=i686-pc-linux-gnu` make -j4

As for the program itself, I followed this post and it all seemed to work..Until I realized that none of the changes that I made to glibc were reflecting.

To come up with a test to verify whether the library was infact being linked against, I made the following changes:
I modified include/signal.h and added extern int my_test_fn(void);
I then modified signal/signal.c first and then sysdeps/posix/signal.c and went on to add the function definition as follows:

int my_test_fn() {
    errno=13; //EACCESS

When I tried compiling my program, it threw up
In function `tuning_library_init': /home/guru/workspace/tuning-library/tuning_library.c:1076: undefined reference to `my_test_fn' collect2: error: ld returned 1 exit status make: *** [host] Error 1


1 Answer 1


Before you go to far:

Read this guide on ARM cross-compiling to understand the basic principles. The steps used there are ALWAYS a GENERAL GUIDELINE, regardless of versions used. For something more in-depth that you will learn from, navigate the CLFS Wiki to download or read the current Stable book. Follow the book until you finish building the cross-compiled toolchain, then deviate from the book to start building whatever you need to cross-compile for.

You don't just cross-compile glibc, you need to cross-compile an entire toolchain. Toolchain components are ALWAYS:

  1. BinUtils, for the assembler and linker
  2. A compiler, most likely GCC
  3. A C Library, most likely Glibc or ucLibc for Embedded Platforms
  4. A Debugger, most likely GDB

See: eLinux's Wiki Entry on Toolchains and WikiPedia's Entry on the GNU Toolchain.

They must also be built in a particular order each time you target a new architecture. You'll learn that order by reading either of the links above, although the CLFS Book will provide step by step commands, with rather well written explanations, and the reasoning behind doing so. I recommend starting your process over, after a tall cup of Coffee or Mountain Dew, as the first few times you do this it will take you a few days. As you do it more and the process becomes ingrained, it will take anywhere between 4 - 6 hours.

A common gotcha here, is that people will accidentally mix up their host headers and toolchain with the cross-compiled headers, which may be what you have done. The header files you should include in your cross-compile chain should be stored in someplace like /home/username/usr/local/include so as not to contaminate your host.

  • Your links are broken, can you please quote the relevant parts if you remember?
    – Calmarius
    Mar 22, 2018 at 7:11
  • @Calmarius Links have been fixed.
    – eyoung100
    Mar 22, 2018 at 19:32
  • The book is now hosted in linuxfromscratch.org/lfs/downloads/stable
    – yoonghm
    Feb 12, 2019 at 13:53
  • I assume that instead of building all those things you could use a chroot with a distribution (or other precompiled build environment) that already uses the glibc you want?
    – trr
    Apr 1 at 23:32
  • 1
    @trr That's exactly what LFS (Linux From Scratch) does, uses a host to build a Linux system without a package manager.
    – eyoung100
    Apr 4 at 19:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .