OpenWrt Forum Archive

Topic: Compiling bleeding edge: swconfig/cli.c needs linux/switch.h

The content of this topic has been archived on 5 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I'm compiling svnversion 35011 from scratch on a Ubuntu-12.04 VM, targeting an Alfa Hornet-UB board.  The kernel in OpenWRT/trunk is 3.6.11, whereas Ubuntu is running 3.2.0-34.  The default compilation dies in swconfig when cli.c can't find <linux/switch.h>.  This file was apparently added to the kernel sometime between 3.2.0 and 3.6.11, but more importantly, I believe the failure means that the OpenWRT build system isn't redirecting include paths properly -- for some reason, the cross compiler is looking in the system's /usr/include/linux directory rather than OpenWRT/trunk/build_dir/target-mips_r2_uClibc-0.9.33.2/linux-ar71xx_generic/linux-3.6.11/include/linux.

Have I made a stupid error, or is this just something that most developers don't hit because they're running the same kernel on their development boxes as the kernel in the OpenWRT tree?

Thanks!

How did you prepare your build environment?
If you use Buildroot (http://wiki.openwrt.org/doc/howto/buildroot.exigence) then the whole toolchain and libraries are prepared for you. At which point it doesn't matter what your host is running.

As already mentioned above, the kernel version version doesn't matter.  The easiest solution would be just start clean with the build making sure all source files are checked out properly.

I am using a Buildroot, which is why I was surprised to see it looking outside the tree.  I'll try a fresh checkout, and if no luck, will post the compiler invocation for help figuring out what "-I" option is wrong/missing.

Probably you are missing some required compilers or related files.  Does running "make prereq" spit out any messages?

make prereq doesn't complain at all.  However, with a complete fresh download, and following the instructions at buildroot.exigence, I got a clean build (including swconfig).

Not sure what was wrong; I guess it was cruft in my old tree.

Sorry to bother you all!

The discussion might have continued from here.