OpenWrt Forum Archive

Topic: Need help to cross compile opnwrt for different motherboard toolchain

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

Hi,
I Need to cross compile opnwrt for different motherboard toolchain. I am facing lot of challenges during cross compilation of openwrt.

1st approach :
1) Is below mentioned link for one program or for cross compiling toolchain of other motherborad.
http://wiki.openwrt.org/doc/devel/crosscompile
If it is applicable for other motherboards also then please let me know "what is meaning of 5th point :: Download and unpack the code to be compiled, change into the unpacked directory". have already downloaded openwrt code and compiled and booted on x86 PC and I am having already toolchain of other motherboard then what is need for downloading code again (if yes then which code)
2) What is meaning of below mentioned statement when I have compiled and flashed the same code on normal x86 PC.
"Follow the build instructions outlined in OpenWrt Buildroot – Usage"


2nd approach :
I am replacing opnewrt toolchain with other motherboard (i686) toolchain then faing lot of challenges and issues.

Please help me out what should I do ?

That link is not for cross compiling the toolchain or OpenWRT. It is about taking some program not already on OpenWRT and compiling it so it can run on an OpenWRT target.

If you want to build OpenWRT start with: http://wiki.openwrt.org/doc/start#building_openwrt

(Last edited by DBAA on 13 Jul 2015, 00:55)

Hi All,
I am really frustrated by doing cross-copilation of openwrt. I am new in cross-compilation and in openwrt.

during the search of cross-compilation tutorial, I got
http://wiki.openwrt.org/doc/devel/crosscompile
where I have followed step1 : PATH=$PATH:(your toolchain/bin directory here) and step2: STAGING_DIR=(your toolchain directory here)
but when I go to 3rd step ./configure --build=x86_64-unkown-linux-gnu --host=i686-cm-linux

then I am not able to search right configuration file(path). I can run this command.

Note : I have downloaded fresh code from trunk (svn co svn://svn.openwrt.org/openwrt/trunk/)
and run ./scripts/feeds update -a, ./scripts/feeds install -a
So I don't have build_dir folder till now.

My questions are given below:
Q1: Should I first compile my whole code first before cross-compilation?
Q2: Should I need to delete toolchain of openwrt and need to replace my toolchain in the same place ?
Q3: Is there any video/document available where cross-compilation has been done successfully ? (step by step till the cross-compilation done successfully) ?
Q4 : Is there any body who can help me till cross-compilation done successfully ?

Please tell me video link or share my screen if available.

I have approached as below mentioned:
Step 1) PATH=/home/hclintel/pankaj/openwrt_compiled/trunk/staging_dir/toolchain-i386_i486_gcc-4.8-linaro_musl-1.1.10/bin
Step 2) export PATH
Step3 ) STAGING_DIR=/home/hclintel/pankaj/openwrt_compiled/trunk/staging_dir/toolchain-i386_i486_gcc-4.8-linaro_musl-1.1.10
Step4)export STAGING_DIR
step 5)
Now in step 5 ./configure --build=x86_64-unkown-linux-gnu  --host=mips-openwrt-linux-uclibc is provided  but configure file is not available.

Please help me out with example.

when I replace openwrt toolchain with i686's mother board toolchain then I get below mentioned logs :

pankaj_1@pankaj_1-ThinkCentre-M73:~/pankaj/openwrt_june/trunk$ sudo make V=99
Makefile:53: warning: overriding commands for target `clean'
toolchain/Makefile:113: warning: ignoring old commands for target `clean'
Makefile:53: warning: overriding commands for target `clean'
toolchain/Makefile:113: warning: ignoring old commands for target `clean'
Makefile:53: warning: overriding commands for target `clean'
toolchain/Makefile:113: warning: ignoring old commands for target `clean'
make[1]: Entering directory `/home/pankaj_1/pankaj/openwrt_june/trunk'
Makefile:53: warning: overriding commands for target `clean'
toolchain/Makefile:113: warning: ignoring old commands for target `clean'
make[2]: Entering directory `/home/pankaj_1/pankaj/openwrt_june/trunk'
Makefile:53: warning: overriding commands for target `clean'
toolchain/Makefile:113: warning: ignoring old commands for target `clean'
make[3]: Entering directory `/home/pankaj_1/pankaj/openwrt_june/trunk/target/linux'
make[4]: Entering directory `/home/pankaj_1/pankaj/openwrt_june/trunk/target/linux/x86'
/home/pankaj_1/pankaj/openwrt_june/trunk/scripts/kconfig.pl  + + /home/pankaj_1/pankaj/openwrt_june/trunk/target/linux/generic/config-3.18 /home/pankaj_1/pankaj/openwrt_june/trunk/target/linux/x86/config-3.18 /home/pankaj_1/pankaj/openwrt_june/trunk/target/linux/x86/generic/config-default > /home/pankaj_1/pankaj/openwrt_june/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.17/.config.target
awk '/^(#[[:space:]]+)?CONFIG_KERNEL/{sub("CONFIG_KERNEL_","CONFIG_");print}' /home/pankaj_1/pankaj/openwrt_june/trunk/.config >> /home/pankaj_1/pankaj/openwrt_june/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.17/.config.target
echo "# CONFIG_KALLSYMS_EXTRA_PASS is not set" >> /home/pankaj_1/pankaj/openwrt_june/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.17/.config.target
echo "# CONFIG_KALLSYMS_ALL is not set" >> /home/pankaj_1/pankaj/openwrt_june/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.17/.config.target
echo "# CONFIG_KALLSYMS_UNCOMPRESSED is not set" >> /home/pankaj_1/pankaj/openwrt_june/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.17/.config.target
/home/pankaj_1/pankaj/openwrt_june/trunk/scripts/metadata.pl kconfig /home/pankaj_1/pankaj/openwrt_june/trunk/tmp/.packageinfo /home/pankaj_1/pankaj/openwrt_june/trunk/.config 3.18 > /home/pankaj_1/pankaj/openwrt_june/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.17/.config.override
/home/pankaj_1/pankaj/openwrt_june/trunk/scripts/kconfig.pl 'm+' '+' /home/pankaj_1/pankaj/openwrt_june/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.17/.config.target /dev/null /home/pankaj_1/pankaj/openwrt_june/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.17/.config.override > /home/pankaj_1/pankaj/openwrt_june/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.17/.config
mv /home/pankaj_1/pankaj/openwrt_june/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.17/.config /home/pankaj_1/pankaj/openwrt_june/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.17/.config.old
grep -v INITRAMFS /home/pankaj_1/pankaj/openwrt_june/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.17/.config.old > /home/pankaj_1/pankaj/openwrt_june/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.17/.config
echo 'CONFIG_INITRAMFS_SOURCE=""' >> /home/pankaj_1/pankaj/openwrt_june/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.17/.config
rm -rf /home/pankaj_1/pankaj/openwrt_june/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/modules
export MAKEFLAGS= ; [ -d /home/pankaj_1/pankaj/openwrt_june/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.17/user_headers ] || make -C /home/pankaj_1/pankaj/openwrt_june/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.17 HOSTCFLAGS="-O2 -I/home/pankaj_1/pankaj/openwrt_june/trunk/staging_dir/host/include -I/home/pankaj_1/pankaj/openwrt_june/trunk/staging_dir/host/usr/include -Wall -Wmissing-prototypes -Wstrict-prototypes" CROSS_COMPILE="i686-cm-linux-gcc" ARCH="x86" KBUILD_HAVE_NLS=no CONFIG_SHELL="bash" V='' CC="i686-cm-linux-gccgcc" INSTALL_HDR_PATH=/home/pankaj_1/pankaj/openwrt_june/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.17/user_headers headers_install
. /home/pankaj_1/pankaj/openwrt_june/trunk/include/shell.sh; grep '=[ym]' /home/pankaj_1/pankaj/openwrt_june/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.17/.config | LC_ALL=C sort | md5s > /home/pankaj_1/pankaj/openwrt_june/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.17/.vermagic
touch /home/pankaj_1/pankaj/openwrt_june/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.17/.configured
rm -f /home/pankaj_1/pankaj/openwrt_june/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.17/vmlinux /home/pankaj_1/pankaj/openwrt_june/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.17/System.map
make -C /home/pankaj_1/pankaj/openwrt_june/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.17 HOSTCFLAGS="-O2 -I/home/pankaj_1/pankaj/openwrt_june/trunk/staging_dir/host/include -I/home/pankaj_1/pankaj/openwrt_june/trunk/staging_dir/host/usr/include -Wall -Wmissing-prototypes -Wstrict-prototypes" CROSS_COMPILE="i686-cm-linux-gcc" ARCH="x86" KBUILD_HAVE_NLS=no CONFIG_SHELL="bash" V='' CC="i686-cm-linux-gccgcc" modules
make[5]: Entering directory `/home/pankaj_1/pankaj/openwrt_june/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.17'
arch/x86/Makefile:114: stack-protector enabled but compiler support broken
Makefile:657: Cannot use CONFIG_CC_STACKPROTECTOR_REGULAR: -fstack-protector not supported by compiler
make[5]: i686-cm-linux-gccgcc: Command not found
scripts/kconfig/conf --silentoldconfig Kconfig
net/sched/Kconfig:43: warning: menuconfig statement without prompt
*
* Restart config...
*
*
* x86 CPU frequency scaling drivers
*
Intel P state control (X86_INTEL_PSTATE) [N/y/?] n
Processor Clocking Control interface driver (X86_PCC_CPUFREQ) [N/m/y/?] n
ACPI Processor P-States driver (X86_ACPI_CPUFREQ) [N/m/y/?] n
Intel Enhanced SpeedStep (deprecated) (X86_SPEEDSTEP_CENTRINO) [N/m/y/?] (NEW) n
Intel Pentium 4 clock modulation (X86_P4_CLOCKMOD) [N/m/y/?] n
*
* shared options
*
#
# configuration written to .config
#
make[5]: Leaving directory `/home/pankaj_1/pankaj/openwrt_june/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.17'
make[5]: Entering directory `/home/pankaj_1/pankaj/openwrt_june/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.17'
arch/x86/Makefile:114: stack-protector enabled but compiler support broken
Makefile:657: Cannot use CONFIG_CC_STACKPROTECTOR_REGULAR: -fstack-protector not supported by compiler
make[5]: i686-cm-linux-gccgcc: Command not found
  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CC      kernel/bounds.s
/bin/sh: 1: i686-cm-linux-gccgcc: not found
make[6]: *** [kernel/bounds.s] Error 127
make[5]: *** [prepare0] Error 2
make[5]: Leaving directory `/home/pankaj_1/pankaj/openwrt_june/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.17'
make[4]: *** [/home/pankaj_1/pankaj/openwrt_june/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.17/.modules] Error 2
make[4]: Leaving directory `/home/pankaj_1/pankaj/openwrt_june/trunk/target/linux/x86'
make[3]: *** [compile] Error 2
make[3]: Leaving directory `/home/pankaj_1/pankaj/openwrt_june/trunk/target/linux'
make[2]: *** [target/linux/compile] Error 2
make[2]: Leaving directory `/home/pankaj_1/pankaj/openwrt_june/trunk'
make[1]: *** [/home/pankaj_1/pankaj/openwrt_june/trunk/staging_dir/target-i386_i486_musl-1.1.10/stamp/.target_compile] Error 2
make[1]: Leaving directory `/home/pankaj_1/pankaj/openwrt_june/trunk'
make: *** [world] Error 2
pankaj_1@pankaj_1-ThinkCentre-M73:~/pankaj/openwrt_june/trunk$


Please help me out.
Thanks in advance.

Some overall information that would be useful to know:
- What project/software you are trying to cross compile?
- What device are you trying to cross compile for (what device do you want the code to run on)?

You need to compile your toolchain first. Starting at the point of checking out (using Git, use SVN if you like):

git clone git://git.openwrt.org/openwrt.git
cd openwrt
#optional: update feeds and install packages if you like
./scripts/feeds update -a
./scripts/feeds install -a
#end optional steps
#use menuconfig and select your platform, profile and any packages you want in your final image
make menuconfig
#build host tools and toolchain
make tools/install
make toolchain/install

Now you can move on to your steps (check that your paths actually make sense):

Pankaj wrote:

Step 1) PATH=/home/hclintel/pankaj/openwrt_compiled/trunk/staging_dir/toolchain-i386_i486_gcc-4.8-linaro_musl-1.1.10/bin
Step 2) export PATH
Step3 ) STAGING_DIR=/home/hclintel/pankaj/openwrt_compiled/trunk/staging_dir/toolchain-i386_i486_gcc-4.8-linaro_musl-1.1.10
Step4)export STAGING_DIR


step 5)
Now in step 5 ./configure --build=x86_64-unkown-linux-gnu  --host=mips-openwrt-linux-uclibc is provided  but configure file is not available.

A project may or may not ship a configure script. If it doesn't ship one, there is obviously no configure file available. It may use some other tool, e.g. CMake or qmake. Is this project available online, so you can link to its source?

Doing steps 1-4 of yours, and cd to the the project you are trying to compile, you can try this:

make CC=mips-openwrt-linux-musl-gcc LD=mips-openwrt-linux-musl-ld

This will run make (which will read the project Makefile), and use the OpenWrt toolchain if the Makefile lets you override the CC variable. If it doesn't, you will have to fix the Makefile or write your own.

Once you have your compiled file, cd to your openwrt checkout (where you built your toolchain earlier), and do:

mkdir -p files/usr/bin
mv /path/to/project/binaries files/usr/bin/
make

This moves your compiled files (fix the path, obviously) into /usr/bin, adapt to wherever they belong. Make builds your final image with selected packages, and your custom files in files/ will be included in the image.

when I replace openwrt toolchain with i686's mother board toolchain then I get below mentioned logs :
[...]
make[5]: i686-cm-linux-gccgcc: Command not found
  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CC      kernel/bounds.s
/bin/sh: 1: i686-cm-linux-gccgcc: not found
[...]

See questions at top - at first you were trying to cross compile for MIPS, now you are trying to use an i686 toolchain. This does not make sense. I also don't understand what "motherboard toolchain" means. Anyway, the problem here is that make looks for i686-cm-linux-gccgcc. You are probably passing i686-cm-linux-gcc as a variable somewhere, and make appends gcc, because the Makefile says so. The variable in question probably refers to the environment in general (i686-cm-linux), and not a specific binary (i686-cm-linux-gcc). The project documentation likely explains this.

(Last edited by makro on 20 Jul 2015, 14:25)

First of all thanks Makro for reply so quick

makro wrote:

Some overall information that would be useful to know:
- What project/software you are trying to cross compile?
- What device are you trying to cross compile for (what device do you want the code to run on)?

-I am trying to compile for i686 architecture (i686-cm-linux-gcc)
-I am trying to compile for diner toolchain.where directory structure is different from openwrt toolchain.

makro wrote:

See questions at top - at first you were trying to cross compile for MIPS, now you are trying to use an i686 toolchain. This does not make sense. I also don't understand what "motherboard toolchain" means. Anyway, the problem here is that make looks for i686-cm-linux-gccgcc. You are probably passing i686-cm-linux-gcc as a variable somewhere, and make appends gcc, because the Makefile says so. The variable in question probably refers to the environment in general (i686-cm-linux), and not a specific binary (i686-cm-linux-gcc). The project documentation likely explains this.

-Actually I am trying different approaches to compile and I am new in cross-compilation and in openwrt. May be due to that it was showing references related to MIPS architecture. But my end goal to compile for i686 architecture and for atom processor.


Approach 1:
Today I tried to compile by replacing toolchain of openwrt and putting diner toolchain and I got below mentioned error :

pankaj_1@pankaj_1-ThinkCentre-M73:~/pankaj/openwrt_15july/trunk$ sudo make CC=/home/pankaj_1/pankaj/openwrt_15july/trunk/toolchain/i686-linux-elf/bin/i686-cm-linux-gcc LD=/home/pankaj_1/pankaj/openwrt_15july/trunk/toolchain/i686-linux-elf/bin/i686-cm-linux-ld   V=99
Makefile:53: warning: overriding commands for target `clean'
toolchain/Makefile:113: warning: ignoring old commands for target `clean'
Makefile:53: warning: overriding commands for target `clean'
toolchain/Makefile:113: warning: ignoring old commands for target `clean'
Makefile:53: warning: overriding commands for target `clean'
toolchain/Makefile:113: warning: ignoring old commands for target `clean'
make[1]: Entering directory `/home/pankaj_1/pankaj/openwrt_15july/trunk'
Makefile:53: warning: overriding commands for target `clean'
toolchain/Makefile:113: warning: ignoring old commands for target `clean'
make[2]: Entering directory `/home/pankaj_1/pankaj/openwrt_15july/trunk'
Makefile:53: warning: overriding commands for target `clean'
toolchain/Makefile:113: warning: ignoring old commands for target `clean'
make[3]: Entering directory `/home/pankaj_1/pankaj/openwrt_15july/trunk/target/linux'
make[4]: Entering directory `/home/pankaj_1/pankaj/openwrt_15july/trunk/target/linux/x86'
/home/pankaj_1/pankaj/openwrt_15july/trunk/scripts/kconfig.pl  + + /home/pankaj_1/pankaj/openwrt_15july/trunk/target/linux/generic/config-3.18 /home/pankaj_1/pankaj/openwrt_15july/trunk/target/linux/x86/config-3.18 /home/pankaj_1/pankaj/openwrt_15july/trunk/target/linux/x86/generic/config-default > /home/pankaj_1/pankaj/openwrt_15july/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.18/.config.target
awk '/^(#[[:space:]]+)?CONFIG_KERNEL/{sub("CONFIG_KERNEL_","CONFIG_");print}' /home/pankaj_1/pankaj/openwrt_15july/trunk/.config >> /home/pankaj_1/pankaj/openwrt_15july/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.18/.config.target
echo "# CONFIG_KALLSYMS_EXTRA_PASS is not set" >> /home/pankaj_1/pankaj/openwrt_15july/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.18/.config.target
echo "# CONFIG_KALLSYMS_ALL is not set" >> /home/pankaj_1/pankaj/openwrt_15july/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.18/.config.target
echo "# CONFIG_KALLSYMS_UNCOMPRESSED is not set" >> /home/pankaj_1/pankaj/openwrt_15july/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.18/.config.target
/home/pankaj_1/pankaj/openwrt_15july/trunk/scripts/metadata.pl kconfig /home/pankaj_1/pankaj/openwrt_15july/trunk/tmp/.packageinfo /home/pankaj_1/pankaj/openwrt_15july/trunk/.config 3.18 > /home/pankaj_1/pankaj/openwrt_15july/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.18/.config.override
/home/pankaj_1/pankaj/openwrt_15july/trunk/scripts/kconfig.pl 'm+' '+' /home/pankaj_1/pankaj/openwrt_15july/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.18/.config.target /dev/null /home/pankaj_1/pankaj/openwrt_15july/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.18/.config.override > /home/pankaj_1/pankaj/openwrt_15july/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.18/.config
mv /home/pankaj_1/pankaj/openwrt_15july/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.18/.config /home/pankaj_1/pankaj/openwrt_15july/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.18/.config.old
grep -v INITRAMFS /home/pankaj_1/pankaj/openwrt_15july/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.18/.config.old > /home/pankaj_1/pankaj/openwrt_15july/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.18/.config
echo 'CONFIG_INITRAMFS_SOURCE=""' >> /home/pankaj_1/pankaj/openwrt_15july/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.18/.config
rm -rf /home/pankaj_1/pankaj/openwrt_15july/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/modules
export MAKEFLAGS= ; [ -d /home/pankaj_1/pankaj/openwrt_15july/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.18/user_headers ] || make -C /home/pankaj_1/pankaj/openwrt_15july/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.18 HOSTCFLAGS="-O2 -I/home/pankaj_1/pankaj/openwrt_15july/trunk/staging_dir/host/include -I/home/pankaj_1/pankaj/openwrt_15july/trunk/staging_dir/host/usr/include -Wall -Wmissing-prototypes -Wstrict-prototypes" CROSS_COMPILE="i686-cm-linux-" ARCH="x86" KBUILD_HAVE_NLS=no CONFIG_SHELL="bash" V='' CC="i686-cm-linux-gcc" INSTALL_HDR_PATH=/home/pankaj_1/pankaj/openwrt_15july/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.18/user_headers headers_install
. /home/pankaj_1/pankaj/openwrt_15july/trunk/include/shell.sh; grep '=[ym]' /home/pankaj_1/pankaj/openwrt_15july/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.18/.config | LC_ALL=C sort | md5s > /home/pankaj_1/pankaj/openwrt_15july/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.18/.vermagic
touch /home/pankaj_1/pankaj/openwrt_15july/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.18/.configured
rm -f /home/pankaj_1/pankaj/openwrt_15july/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.18/vmlinux /home/pankaj_1/pankaj/openwrt_15july/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.18/System.map
make -C /home/pankaj_1/pankaj/openwrt_15july/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.18 HOSTCFLAGS="-O2 -I/home/pankaj_1/pankaj/openwrt_15july/trunk/staging_dir/host/include -I/home/pankaj_1/pankaj/openwrt_15july/trunk/staging_dir/host/usr/include -Wall -Wmissing-prototypes -Wstrict-prototypes" CROSS_COMPILE="i686-cm-linux-" ARCH="x86" KBUILD_HAVE_NLS=no CONFIG_SHELL="bash" V='' CC="i686-cm-linux-gcc" modules
./scripts/gcc-version.sh: line 25: i686-cm-linux-gcc: command not found
./scripts/gcc-version.sh: line 26: i686-cm-linux-gcc: command not found
make[5]: Entering directory `/home/pankaj_1/pankaj/openwrt_15july/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.18'
arch/x86/Makefile:114: stack-protector enabled but compiler support broken
Makefile:657: Cannot use CONFIG_CC_STACKPROTECTOR_REGULAR: -fstack-protector not supported by compiler
make[5]: i686-cm-linux-gcc: Command not found
scripts/kconfig/conf --silentoldconfig Kconfig
net/sched/Kconfig:43: warning: menuconfig statement without prompt
#
# configuration written to .config
#
make[5]: Leaving directory `/home/pankaj_1/pankaj/openwrt_15july/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.18'
./scripts/gcc-version.sh: line 25: i686-cm-linux-gcc: command not found
./scripts/gcc-version.sh: line 26: i686-cm-linux-gcc: command not found
make[5]: Entering directory `/home/pankaj_1/pankaj/openwrt_15july/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.18'
arch/x86/Makefile:114: stack-protector enabled but compiler support broken
Makefile:657: Cannot use CONFIG_CC_STACKPROTECTOR_REGULAR: -fstack-protector not supported by compiler
make[5]: i686-cm-linux-gcc: Command not found
  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CC      kernel/bounds.s
/bin/sh: 1: i686-cm-linux-gcc: not found
make[6]: *** [kernel/bounds.s] Error 127
make[5]: *** [prepare0] Error 2
make[5]: Leaving directory `/home/pankaj_1/pankaj/openwrt_15july/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.18'
make[4]: *** [/home/pankaj_1/pankaj/openwrt_15july/trunk/build_dir/target-i386_i486_musl-1.1.10/linux-x86_generic/linux-3.18.18/.modules] Error 2
make[4]: Leaving directory `/home/pankaj_1/pankaj/openwrt_15july/trunk/target/linux/x86'
make[3]: *** [compile] Error 2
make[3]: Leaving directory `/home/pankaj_1/pankaj/openwrt_15july/trunk/target/linux'
make[2]: *** [target/linux/compile] Error 2
make[2]: Leaving directory `/home/pankaj_1/pankaj/openwrt_15july/trunk'
make[1]: *** [/home/pankaj_1/pankaj/openwrt_15july/trunk/staging_dir/target-i386_i486_musl-1.1.10/stamp/.target_compile] Error 2
make[1]: Leaving directory `/home/pankaj_1/pankaj/openwrt_15july/trunk'
make: *** [world] Error 2
pankaj_1@pankaj_1-ThinkCentre-M73:~/pankaj/openwrt_15july/trunk$


I don't know what am I missing, after doing lot of efforts, I am not getting result.

[I will post 2nd approach in next post]

2nd Approach:
When I select "Advance Developer" option in "menuconfig"

Advanced configuration options (for developers)  --->  Use external toolchain  --->
(i686-cm-linux-gnu) Target name
(/home/pankaj_1/pankaj/openwrt_june/trunk/toolchain/bin/i686-cm-linux-) Toolchain prefix 
(/home/pankaj_1/pankaj/openwrt_june/trunk/toolchain) Toolchain root
(glibc) Toolchain libc
(./usr/bin ./bin) Toolchain program path
(./usr/include ./include) Toolchain include path
(./usr/lib ./lib) Toolchain library path

then I am getting below mentioned error :


pankaj_1@pankaj_1-ThinkCentre-M73:~/pankaj/20july/trunk$ sudo make V=99
make[1]: Entering directory `/home/pankaj_1/pankaj/20july/trunk'
make[2]: Entering directory `/home/pankaj_1/pankaj/20july/trunk'
make[3]: Entering directory `/home/pankaj_1/pankaj/20july/trunk/target/linux'
make[4]: Entering directory `/home/pankaj_1/pankaj/20july/trunk/target/linux/x86'
/home/pankaj_1/pankaj/20july/trunk/scripts/kconfig.pl  + + /home/pankaj_1/pankaj/20july/trunk/target/linux/generic/config-3.18 /home/pankaj_1/pankaj/20july/trunk/target/linux/x86/config-3.18 /home/pankaj_1/pankaj/20july/trunk/target/linux/x86/generic/config-default > /home/pankaj_1/pankaj/20july/trunk/build_dir/target-i686-cm-linux-gnu/linux-x86_generic/linux-3.18.18/.config.target
awk '/^(#[[:space:]]+)?CONFIG_KERNEL/{sub("CONFIG_KERNEL_","CONFIG_");print}' /home/pankaj_1/pankaj/20july/trunk/.config >> /home/pankaj_1/pankaj/20july/trunk/build_dir/target-i686-cm-linux-gnu/linux-x86_generic/linux-3.18.18/.config.target
echo "# CONFIG_KALLSYMS_EXTRA_PASS is not set" >> /home/pankaj_1/pankaj/20july/trunk/build_dir/target-i686-cm-linux-gnu/linux-x86_generic/linux-3.18.18/.config.target
echo "# CONFIG_KALLSYMS_ALL is not set" >> /home/pankaj_1/pankaj/20july/trunk/build_dir/target-i686-cm-linux-gnu/linux-x86_generic/linux-3.18.18/.config.target
echo "# CONFIG_KALLSYMS_UNCOMPRESSED is not set" >> /home/pankaj_1/pankaj/20july/trunk/build_dir/target-i686-cm-linux-gnu/linux-x86_generic/linux-3.18.18/.config.target
/home/pankaj_1/pankaj/20july/trunk/scripts/metadata.pl kconfig /home/pankaj_1/pankaj/20july/trunk/tmp/.packageinfo /home/pankaj_1/pankaj/20july/trunk/.config 3.18 > /home/pankaj_1/pankaj/20july/trunk/build_dir/target-i686-cm-linux-gnu/linux-x86_generic/linux-3.18.18/.config.override
/home/pankaj_1/pankaj/20july/trunk/scripts/kconfig.pl 'm+' '+' /home/pankaj_1/pankaj/20july/trunk/build_dir/target-i686-cm-linux-gnu/linux-x86_generic/linux-3.18.18/.config.target /dev/null /home/pankaj_1/pankaj/20july/trunk/build_dir/target-i686-cm-linux-gnu/linux-x86_generic/linux-3.18.18/.config.override > /home/pankaj_1/pankaj/20july/trunk/build_dir/target-i686-cm-linux-gnu/linux-x86_generic/linux-3.18.18/.config
mv /home/pankaj_1/pankaj/20july/trunk/build_dir/target-i686-cm-linux-gnu/linux-x86_generic/linux-3.18.18/.config /home/pankaj_1/pankaj/20july/trunk/build_dir/target-i686-cm-linux-gnu/linux-x86_generic/linux-3.18.18/.config.old
grep -v INITRAMFS /home/pankaj_1/pankaj/20july/trunk/build_dir/target-i686-cm-linux-gnu/linux-x86_generic/linux-3.18.18/.config.old > /home/pankaj_1/pankaj/20july/trunk/build_dir/target-i686-cm-linux-gnu/linux-x86_generic/linux-3.18.18/.config
echo 'CONFIG_INITRAMFS_SOURCE=""' >> /home/pankaj_1/pankaj/20july/trunk/build_dir/target-i686-cm-linux-gnu/linux-x86_generic/linux-3.18.18/.config
rm -rf /home/pankaj_1/pankaj/20july/trunk/build_dir/target-i686-cm-linux-gnu/linux-x86_generic/modules
export MAKEFLAGS= ; [ -d /home/pankaj_1/pankaj/20july/trunk/build_dir/target-i686-cm-linux-gnu/linux-x86_generic/linux-3.18.18/user_headers ] || make -C /home/pankaj_1/pankaj/20july/trunk/build_dir/target-i686-cm-linux-gnu/linux-x86_generic/linux-3.18.18 HOSTCFLAGS="-O2 -I/home/pankaj_1/pankaj/20july/trunk/staging_dir/host/include -I/home/pankaj_1/pankaj/20july/trunk/staging_dir/host/usr/include -Wall -Wmissing-prototypes -Wstrict-prototypes" CROSS_COMPILE="/home/pankaj_1/pankaj/openwrt_june/trunk/toolchain/bin/i686-cm-linux-" ARCH="x86" KBUILD_HAVE_NLS=no CONFIG_SHELL="bash" V='' CC="/home/pankaj_1/pankaj/openwrt_june/trunk/toolchain/bin/i686-cm-linux-gcc" INSTALL_HDR_PATH=/home/pankaj_1/pankaj/20july/trunk/build_dir/target-i686-cm-linux-gnu/linux-x86_generic/linux-3.18.18/user_headers headers_install
. /home/pankaj_1/pankaj/20july/trunk/include/shell.sh; grep '=[ym]' /home/pankaj_1/pankaj/20july/trunk/build_dir/target-i686-cm-linux-gnu/linux-x86_generic/linux-3.18.18/.config | LC_ALL=C sort | md5s > /home/pankaj_1/pankaj/20july/trunk/build_dir/target-i686-cm-linux-gnu/linux-x86_generic/linux-3.18.18/.vermagic
touch /home/pankaj_1/pankaj/20july/trunk/build_dir/target-i686-cm-linux-gnu/linux-x86_generic/linux-3.18.18/.configured
rm -f /home/pankaj_1/pankaj/20july/trunk/build_dir/target-i686-cm-linux-gnu/linux-x86_generic/linux-3.18.18/vmlinux /home/pankaj_1/pankaj/20july/trunk/build_dir/target-i686-cm-linux-gnu/linux-x86_generic/linux-3.18.18/System.map
make -C /home/pankaj_1/pankaj/20july/trunk/build_dir/target-i686-cm-linux-gnu/linux-x86_generic/linux-3.18.18 HOSTCFLAGS="-O2 -I/home/pankaj_1/pankaj/20july/trunk/staging_dir/host/include -I/home/pankaj_1/pankaj/20july/trunk/staging_dir/host/usr/include -Wall -Wmissing-prototypes -Wstrict-prototypes" CROSS_COMPILE="/home/pankaj_1/pankaj/openwrt_june/trunk/toolchain/bin/i686-cm-linux-" ARCH="x86" KBUILD_HAVE_NLS=no CONFIG_SHELL="bash" V='' CC="/home/pankaj_1/pankaj/openwrt_june/trunk/toolchain/bin/i686-cm-linux-gcc" modules
i686-cm-linux-gcc: error trying to exec 'cc1': execvp: No such file or directory
i686-cm-linux-gcc: error trying to exec 'cc1': execvp: No such file or directory
make[5]: Entering directory `/home/pankaj_1/pankaj/20july/trunk/build_dir/target-i686-cm-linux-gnu/linux-x86_generic/linux-3.18.18'
arch/x86/Makefile:114: stack-protector enabled but compiler support broken
Makefile:657: Cannot use CONFIG_CC_STACKPROTECTOR_REGULAR: -fstack-protector not supported by compiler
scripts/kconfig/conf --silentoldconfig Kconfig
net/sched/Kconfig:43: warning: menuconfig statement without prompt
#
# configuration written to .config
#
make[5]: Leaving directory `/home/pankaj_1/pankaj/20july/trunk/build_dir/target-i686-cm-linux-gnu/linux-x86_generic/linux-3.18.18'
i686-cm-linux-gcc: error trying to exec 'cc1': execvp: No such file or directory
i686-cm-linux-gcc: error trying to exec 'cc1': execvp: No such file or directory
make[5]: Entering directory `/home/pankaj_1/pankaj/20july/trunk/build_dir/target-i686-cm-linux-gnu/linux-x86_generic/linux-3.18.18'
arch/x86/Makefile:114: stack-protector enabled but compiler support broken
Makefile:657: Cannot use CONFIG_CC_STACKPROTECTOR_REGULAR: -fstack-protector not supported by compiler
  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CC      kernel/bounds.s
i686-cm-linux-gcc: error trying to exec 'cc1': execvp: No such file or directory
make[6]: *** [kernel/bounds.s] Error 1
make[5]: *** [prepare0] Error 2
make[5]: Leaving directory `/home/pankaj_1/pankaj/20july/trunk/build_dir/target-i686-cm-linux-gnu/linux-x86_generic/linux-3.18.18'
make[4]: *** [/home/pankaj_1/pankaj/20july/trunk/build_dir/target-i686-cm-linux-gnu/linux-x86_generic/linux-3.18.18/.modules] Error 2
make[4]: Leaving directory `/home/pankaj_1/pankaj/20july/trunk/target/linux/x86'
make[3]: *** [compile] Error 2
make[3]: Leaving directory `/home/pankaj_1/pankaj/20july/trunk/target/linux'
make[2]: *** [target/linux/compile] Error 2
make[2]: Leaving directory `/home/pankaj_1/pankaj/20july/trunk'
make[1]: *** [/home/pankaj_1/pankaj/20july/trunk/staging_dir/target-i686-cm-linux-gnu/stamp/.target_compile] Error 2
make[1]: Leaving directory `/home/pankaj_1/pankaj/20july/trunk'
make: *** [world] Error 2



I think I need to do some changes in kconfig. Please help me out.
thanks in Advance.

GCC has several sub-programs.

One is the Preprocessor+C-Compiler CC1 see GCC Internals@wikibooks.

This sub program cannot be found in your current configuration.

i686-cm-linux-gcc: error trying to exec 'cc1': execvp: No such file or directory

Why is this happening and how to fix it?
- Check your toolchain / instructions on how to use it
- Check your PATH
- Add a missing path where cc1 is to your PATH
- Create a link


Disable all the hardened build flags. Your toolchain does not seem to support them.

arch/x86/Makefile:114: stack-protector enabled but compiler support broken

Using external toolchains in OpenWrt is painful because many toolchains are buggy, require different configuration/environment setting and are untested.

The discussion might have continued from here.