~/$ cd opt/oecore-x86_64/
~/opt/oecore-x86_64/workspace$ source environment-setup-i586-oe-linux
~/opt/oecore-x86_64/workspace$ echo $CC
i586-oe-linux-gcc -m32 -march=i586 --sysroot=/home/christos/opt/oecore-x86_64/sysroots/i586-oe-linux
~/opt/oecore-x86_64/workspace$ which i586-oe-linux
~/opt/oecore-x86_64/workspace$ which i586-oe-linux-gcc/home/christos/opt/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/bin/i586-oe-linux/i586-oe-linux-gcc
~/opt/oecore-x86_64/workspace$ i586-oe-linux-gcc main.c
main.c:1:19: fatal error: stdio.h: No such file or directory
#include <stdio.h>
^
compilation terminated.
~/$ cd opt/oecore-x86_64/
~/opt/oecore-x86_64/workspace$ source environment-setup-i586-oe-linux
~/opt/oecore-x86_64/workspace$ echo $CC
i586-oe-linux-gcc -m32 -march=i586 --sysroot=/home/christos/opt/oecore-x86_64/sysroots/i586-oe-linux
~/opt/oecore-x86_64/workspace$ which i586-oe-linux
~/opt/oecore-x86_64/workspace$ which i586-oe-linux-gcc/home/christos/opt/oecore-x86_64/sysroots/x86_64-oesdk-linux/usr/bin/i586-oe-linux/i586-oe-linux-gcc
~/opt/oecore-x86_64/workspace$ i586-oe-linux-gcc main.c
main.c:1:19: fatal error: stdio.h: No such file or directory
#include <stdio.h>
^
compilation terminated.
~/opt/oecore-x86_64/workspace$ cd ..
~/opt/oecore-x86_64$ find . -name stdio.h
./sysroots/i586-oe-linux/usr/include/stdio.h
./sysroots/i586-oe-linux/usr/include/bits/stdio.h
./sysroots/i586-oe-linux/usr/include/c++/tr1/stdio.h
./sysroots/i586-oe-linux/usr/src/debug/eglibc/2.18-r0/eglibc-2.18/libc/include/stdio.h
./sysroots/i586-oe-linux/usr/src/debug/eglibc/2.18-r0/eglibc-2.18/libc/libio/stdio.h
./sysroots/i586-oe-linux/usr/src/debug/eglibc/2.18-r0/eglibc-2.18/libc/libio/bits/stdio.h
~/opt/oecore-x86_64/workspace$ make
i586-oe-linux-gcc -m32 -march=i586 --sysroot=/home/christos/opt/oecore-x86_64/sysroots/i586-oe-linux -o maintest main.c
~/opt/oecore-x86_64/workspace$ ./maintest
hello world
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
Makefile
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
all: main.c
$(CC) -o maintest main.c
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
main.c
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include <stdio.h>
int main(void){
printf("hello world\n");
return 0;
}
Bottom line... Works from Makefile... doesn't work from bash command line.
environment setup needs some tweeking.