OpenWrt Forum Archive

Topic: Eclipse GCC C Cross Compiling not working

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

Hi,
I am following this tutorial : https://downloads.openwrt.org/docs/eclipse.pdf

Chip : MT7620

Toolchain Prefix : mipsel-openwrt-linux-
Toolchain Path : /ligo/openwrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-5.3.0_musl-1.1.14

Code :
#include <stdio.h>
void main()
{
    printf("Hello World");
}


Error :
**** Build of configuration Debug for project hello ****
make all
Building target: hello
Invoking: Cross GCC Linker
mipsel-openwrt-linux-gcc -L/ligo/openwrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-5.3.0_musl-1.1.14/lib -o"hello"  ./main.o   
mipsel-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined
mipsel-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined
/ligo/openwrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-5.3.0_musl-1.1.14/lib/gcc/mipsel-openwrt-linux-musl/5.3.0/../../../../mipsel-openwrt-linux-musl/lib/crt1.o: In function `_start_c':
/ligo/openwrt/build_dir/toolchain-mipsel_24kec+dsp_gcc-5.3.0_musl-1.1.14/musl-1.1.14/crt/crt1.c:17: undefined reference to `main'
/ligo/openwrt/build_dir/toolchain-mipsel_24kec+dsp_gcc-5.3.0_musl-1.1.14/musl-1.1.14/crt/crt1.c:17: undefined reference to `main'
collect2: error: ld returned 1 exit status
make: *** [hello] Error 1

I am a beginner only in both linux and openwrt. Kindly help me.

The discussion might have continued from here.