Hello world example doesn't compile in Poky distro 1.7.1

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Hello world example doesn't compile in Poky distro 1.7.1

2,022 Views
manjunathjoshi
Contributor V

Hello all,

Steps followed:

$ vi hello.c

$ source /opt/poky/1.7.1/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi

Can anyone tell me what's the problem here.

pga@pga-ThinkCentre-A85:~/helloworld$ arm-poky-linux-gnueabi-gcc -o hello hello.c

hello.c:1:18: fatal error: stdio.h: No such file or directory

#include<stdio.h>

                  ^

compilation terminated.

pga@pga-ThinkCentre-A85:~/helloworld$ arm-poky-linux-gnueabi-gcc -v

Using built-in specs.

COLLECT_GCC=arm-poky-linux-gnueabi-gcc

COLLECT_LTO_WRAPPER=/opt/pga_qt5_toolchain/poky/1.7.1/sysroots/i686-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/../../libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.9.1/lto-wrapper

Target: arm-poky-linux-gnueabi

Configured with: /home/pga/projects/fsl-community-bsp/build_toolchain/tmp/work-shared/gcc-4.9.1-r0/gcc-4.9.1/configure --build=i686-linux --host=i686-pokysdk-linux --target=arm-poky-linux-gnueabi --prefix=/opt/poky/1.7.1/sysroots/i686-pokysdk-linux/usr --exec_prefix=/opt/poky/1.7.1/sysroots/i686-pokysdk-linux/usr --bindir=/opt/poky/1.7.1/sysroots/i686-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi --sbindir=/opt/poky/1.7.1/sysroots/i686-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi --libexecdir=/opt/poky/1.7.1/sysroots/i686-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi --datadir=/opt/poky/1.7.1/sysroots/i686-pokysdk-linux/usr/share --sysconfdir=/opt/poky/1.7.1/sysroots/i686-pokysdk-linux/etc --sharedstatedir=/opt/poky/1.7.1/sysroots/i686-pokysdk-linux/com --localstatedir=/opt/poky/1.7.1/sysroots/i686-pokysdk-linux/var --libdir=/opt/poky/1.7.1/sysroots/i686-pokysdk-linux/usr/lib/arm-poky-linux-gnueabi --includedir=/opt/poky/1.7.1/sysroots/i686-pokysdk-linux/usr/include --oldincludedir=/opt/poky/1.7.1/sysroots/i686-pokysdk-linux/usr/include --infodir=/opt/poky/1.7.1/sysroots/i686-pokysdk-linux/usr/share/info --mandir=/opt/poky/1.7.1/sysroots/i686-pokysdk-linux/usr/share/man --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot=/home/pga/projects/yocto/pga/fsl-community-bsp/build_toolchain/tmp/sysroots/i686-nativesdk-pokysdk-linux --with-gnu-ld --enable-shared --enable-languages=c,c++ --enable-threads=posix --enable-multilib --enable-c99 --enable-long-long --enable-symvers=gnu --enable-libstdcxx-pch --program-prefix=arm-poky-linux-gnueabi- --without-local-prefix --enable-target-optspace --enable-lto --enable-libssp --disable-bootstrap --disable-libmudflap --with-system-zlib --with-linker-hash-style=gnu --enable-linker-build-id --with-ppl=no --with-cloog=no --enable-checking=release --enable-cheaders=c_global --with-gxx-include-dir=/opt/poky/1.7.1/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/c++/4.9.1 --with-build-time-tools=/home/pga/projects/yocto/pga/fsl-community-bsp/build_toolchain/tmp/sysroots/i686-linux/usr/arm-poky-linux-gnueabi/bin --with-sysroot=/opt/poky/1.7.1/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi --with-build-sysroot=/home/pga/projects/yocto/pga/fsl-community-bsp/build_toolchain/tmp/sysroots/imx6qsabresd --enable-poison-system-directories --with-mpfr=/home/pga/projects/yocto/pga/fsl-community-bsp/build_toolchain/tmp/sysroots/i686-nativesdk-pokysdk-linux --with-mpc=/home/pga/projects/yocto/pga/fsl-community-bsp/build_toolchain/tmp/sysroots/i686-nativesdk-pokysdk-linux --enable-nls --with-arch=armv7-a

Thread model: posix

gcc version 4.9.1 (GCC)

This means i have gcc. I am fed up of this. Please anyone reply.

Regards,

Manju

Labels (4)
0 Kudos
3 Replies

728 Views
markusbraitner
Contributor IV

Hello Manju,

I had the same problem and as far as I could find out, compilation works with

a) using the hard-float compiler option (-mfloat-abi=hard) or

b) invoking the compiler using

$CC <c-file>

Hope this helps...

Kind regards,

Markus

0 Kudos

728 Views
manjunathjoshi
Contributor V

Hello Markus ,

Thanks for your reply. It seems that compiling step

$ arm-poky***-gcc -o hello hello.c

doesn't work and making hard float is not recommended as far as i know.

One needs to follow what autotools do in order to effectively compile helloworld or any other c file.

So

1. $ source /opt/poky/1.7.1/environment****

2. make a directory helloworld .

3. make a hello.c, makefile.am, configure.in or configure.ac

4. $ aclocal

5. $ autoconf

6. $ automake -a

7. $ ./configure ${CONFIGURE_FLAGS}

8. $ make

are the steps that i followed to make things work.

This link might be of help.

https://developer.gnome.org/anjuta-build-tutorial/stable/create-autotools.html.en

Once again thanks Markus. You may follow the link or the steps and then see if it works.

With best regards,

Manju

0 Kudos

728 Views
markusbraitner
Contributor IV

Hello Manju,

ok - great you found a solution!

And thanks for letting me know, how it looks like - there's always something one can learn!

Kind regards,

Markus

0 Kudos