Problem Cross Compiling Beaglebone Black

I I have a Beaglebone black with Linux 3.8.13-bone20 Debian Wheezy 7.0 and I am trying to cross compile wireless drivers from my host machine which is Debian 7.4 Wheezy but i am running into a brick wall, arg! I could use some advice.

This is what I’ve done so far,

sudo dpkg --add-architecture i386
wget -c
tar xf gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux.tar.xz
export CC=pwd/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-
${CC}gcc --version

arm-linux-gnueabihf-gcc (crosstool-NG linaro-1.13.1-4.9-2014.09 - Linaro GCC 4.9-2014.09) 4.9.2 20140904 (prerelease)
Copyright © 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO

git clone

cd linux
git checkout 3.8

Checking out files: 100% (29910/29910), done.
Branch 3.8 set up to track remote branch 3.8 from origin.
Switched to a new branch ‘3.8’

I think I’m missing a step here, do i need to set a path for INSTALL_HDR_PATH
> I tried compiling with arch to arm but i get errors. See log

cd …
git clone

cd rtl8812AU_8821AU_linux/


i may be missing something here but it looks like you are trying to use
i386 things for a arm processor ?

The compile time error says that it is looking for the gcc crosscompiler, and can’t find it.
You seem to have downloaded the linaro crosscompiler, which is different.

Either will work. You need to decide which compiler you want to use, make sure it is
installed in the computer, and build a make file or provide instructions to use that one.

— Graham


I thought I was only using the linaro compiler, I didn’t realize I was trying to use two different compilers.

When I run, ${CC}gcc --version

It says I’m using, arm-linux-gnueabihf-gcc (crosstool-NG linaro-1.13.1-4.9-2014.09 - Linaro GCC 4.9-2014.09) 4.9.2 20140904 (prerelease)

Also is this not the correct way to compile the driver?


Thank you for helping me.


I am sorry that I am not familiar with the linaro cross-compiler, I exclusively use the gcc,
and I let the Eclipse IDE automatically generate the make files.

I can only suggest that you review the installation instructions for the linaro, and make sure
that everything is installed properly in the intended locations. Check that everything are
compatible versions of Linux and the tool chain

The errors are saying that “arm-linux-gnueabihf-gcc-4.6” can’t be located. That is version 4.6 of
the gcc cross compiler. Perhaps linaro actually distributes the gcc. I would go look in those
locations and see what is there. If you see what you are expecting, but Linux says it can not
see it, then it is usually incompatible versions of the support libraries like glibc, preventing
run time dynamic linking.

If it is not there at all, then there is some kind of installation error.

— Graham

Linaro is just a prebuilt gcc, with (I havent paid much attention to which ) prepackaged libc. As the previous poster said, make is complaining that it doesnt know where to find the needed gcc toolchain path. That, and I am guessing you’re following parts of RCN’s cross compiler setup guide for compiling uboot, and the Linux kernel.

Yea you are right, i was trying to follow RCN"S compiler settings.

Can you recommend a guide/tutorial for setting up a cross compiling environment for the new Beaglebone Blacks running Debian?

I have a spare laptop, so I can install whatever flavor of Linux or Windows the tutorial recommends. I just keep hitting dead ends when I try it on my own desktop that runs Debian 7.4.

Ok . . .

make ARCH=arm CROSS_COMPILE=/home/m/qbb/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf- -C /lib/modules/3.2.0-4-amd64/build M=/home/m/qbb/rtl8812AU_8821AU_linux modules

First of all, modules / drivers have to be compiled against a specific kernel, for the specified hardware. Here, this gcc toolchain might possibly be able to handle the task, however you’re linking against the wrong modules( wrong architecture and wrong kernel headers ).

make[1]: Entering directory `/usr/src/linux-headers-3.2.0-4-amd64’ /usr/src/linux-headers-3.2.0-4-common/arch/x86/Makefile:81: stack protector enabled but no compiler support

Unsure about this specific complaint, but you can google the error as easily as I.

make[3]: /home/m/qbb/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-gcc-4.6: Command not found
CC [M] /home/m/qbb/rtl8812AU_8821AU_linux/core/rtw_cmd.o /bin/sh: 1: /home/m/qbb/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-gcc-4.6: not found

Command not found. It is very likely since the path you’ve given is for the gnueabi-4.9* gcc toolchain. So . . . gcc 4.6* is not likely to exist in this path. Meaning: you’re grasping at straws, hoping the toolchain you want / need exists in this location, but it does not.

make[4]: *** [/home/m/qbb/rtl8812AU_8821AU_linux/core/rtw_cmd.o] Error 127
make[3]: *** [module/home/m/qbb/rtl8812AU_8821AU_linux] Error 2
make[2]: *** [sub-make] Error 2
make[1]: *** [all] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.2.0-4-amd64’
make: *** [modules] Error 2

Superfluous errors, likely to clear up once the previous error conditions are taken care of.

So with all the above said, this probably does not help you solve your problem. What would help you fix / understand the problem is understanding how to use the / a gcc toolchain. There are many books on the internet that explain this process. Some of which can be downloaded for free, and are very good.Passed that, you’re going to need a firm grasp of how to compile kernel modules for your hardware.

My suggestion, and actually what I would do in your place would be to compile the kernel modules natively on the beaglebone black. You can make an alternate sdcard, or some form of bootable media / root file system to act as a build / support system for your beaglebone black. This “support” image needs to be the exact same kernel as your “production” image. Going about things this way alleviates the potential cross compiler issues you’re very likely ( and have already met ) to run into. Now, gain, with all that said, there is already a very good chance that the realtech drivers you’re trying to compile already exist in the kernel, but you may need to enable them in the kernel config( no hands on and simply a guess ).

Either way no one without the specific hardware, could tell you 100% for sure how to go about what you need done. And quite honestly there is no incentive for me, or anyone else to go out and buy hardware specifically to tell you how it is done. Let alone take our own time to do so . . . Sorry if that seems harsh, but that is the plain simple truth of the matter.

William thanks for replying so quickly, I appreciate it.

In the past I had no problems compiling on the beaglebone itself, that’s the only way i’m able to do anything, but it takes a long time to compile. Thus my adventure into the world of cross compiling.

When I posted the original post, I did notice it complaining about the x86 headers and module paths I’ve downloaded the beaglebone kernel headers from github, and the arm compiler that apparently works on Debian, to me it looked like it was using my desktop linux headers and not the beaglebone source i downloaded.

Time for bed, thanks again!

I highly recommend Derek Molloy’s Book and his videos on topics like how to set up a
cross compiler on Eclipse/Linux for the BBB.

Get this book:

Exploring BeagleBone: Tools and Techniques for Building with Embedded Linux Paperback – December 31, 2014
by Derek Molloy (Author)
ISBN-13: 978-1118935125 ISBN-10: 1118935128 Edition: 1st

Look at videos on Derek Molloy website. This includes setting up the gcc compiler.

— Graham