3 Replies Latest reply on Nov 14, 2016 6:00 PM by FGT

    How to compile C++ on Yocto Linux using terminal

    Taric25

      Excuse me if this has been asked and answered. I'm a student at UMass Lowell in Electrical & Computer Engineering. Our Microprocessors Professor is having us use the Gen 2 Intel Galileo, and we cannot seem to find how to compile C++.

       

      Our project requires that we communicate to the Galileo using the serial USB cable and a terminal, such as PuTTY. In our last assignment, we read ADC values (from an external chip) and displayed them on terminal of the computer screen of a laptop connected via the serial USB cable. We used "cc" to compile our code. (As far as I know, gcc is not available in this distribution of this operating system.)

       

      For our next project, we are supposed to use Open CV (Computer Vision) to write C++ code to control the provided webcam. The webcam installed at video0 under /dev/ correctly, but we still cannot figure out how to use any C++ compiler. How can we compile C++ on the Intel Galileo using the provided distribution of Yocto Linux using the serial USB cable?

       

      screenshot_no_C_plus_plus.png

      cxx_makefile.pngG

       

      FYI, using g++ instead of cxx just locks the OS and does nothing. Using cc does not compile c++.

        • 1. Re: How to compile C++ on Yocto Linux using terminal
          FGT

          Hi Taric25,

           

          I think the Linux development environment on the board is stable since some time ago. Take a look at the post by Paul.Guermonprez with a lot of material at Intel Courses on Galileo now available, and open source (including C and C++ code)

           

          Just in case, I've tested gcc and g++ n my board and it looks like it's running fine:

           

          root@galileo:~# gcc

          gcc: fatal error: no input files

          compilation terminated.

           

          root@galileo:~# g++

          g++: fatal error: no input files

          compilation terminated.

           

          root@galileo:~# gcc -v

          Using built-in specs.

          COLLECT_GCC=gcc

          COLLECT_LTO_WRAPPER=/usr/lib/gcc/gcc/i586-poky-linux/4.9.1/lto-wrapper

          Target: i586-poky-linux

          Configured with: /export/users/neck/iotdk_3.5_dev/workdir/build_galileo/tmp/work-shared/gcc-4.9.1-r0/gcc-4.9.1/configure --build=x86_64-linux --host=i586-poky-linux --target=i586-poky-linux --prefix=/usr --exec_prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib/gcc --datadir=/usr/share --sysconfdir=/etc --sharedstatedir=/com --localstatedir=/var --libdir=/usr/lib --includedir=/usr/include --oldincludedir=/usr/include --infodir=/usr/share/info --mandir=/usr/share/man --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot=/export/users/neck/iotdk_3.5_dev/workdir/build_galileo/tmp/sysroots/quark --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=i586-poky-linux- --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-sysroot=/ --with-build-sysroot=/export/users/neck/iotdk_3.5_dev/workdir/build_galileo/tmp/sysroots/quark --with-native-system-header-dir=/export/users/neck/iotdk_3.5_dev/workdir/build_galileo/tmp/sysroots/quark/usr/include --with-gxx-include-dir=/usr/include/c++/4.9.1 --enable-targets=all --enable-nls --enable-__cxa_atexit

          Thread model: posix

          gcc version 4.9.1 (GCC)

           

          root@galileo:~# g++ -v

          Using built-in specs.

          COLLECT_GCC=g++

          COLLECT_LTO_WRAPPER=/usr/lib/gcc/gcc/i586-poky-linux/4.9.1/lto-wrapper

          Target: i586-poky-linux

          Configured with: /export/users/neck/iotdk_3.5_dev/workdir/build_galileo/tmp/work-shared/gcc-4.9.1-r0/gcc-4.9.1/configure --build=x86_64-linux --host=i586-poky-linux --target=i586-poky-linux --prefix=/usr --exec_prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib/gcc --datadir=/usr/share --sysconfdir=/etc --sharedstatedir=/com --localstatedir=/var --libdir=/usr/lib --includedir=/usr/include --oldincludedir=/usr/include --infodir=/usr/share/info --mandir=/usr/share/man --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot=/export/users/neck/iotdk_3.5_dev/workdir/build_galileo/tmp/sysroots/quark --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=i586-poky-linux- --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-sysroot=/ --with-build-sysroot=/export/users/neck/iotdk_3.5_dev/workdir/build_galileo/tmp/sysroots/quark --with-native-system-header-dir=/export/users/neck/iotdk_3.5_dev/workdir/build_galileo/tmp/sysroots/quark/usr/include --with-gxx-include-dir=/usr/include/c++/4.9.1 --enable-targets=all --enable-nls --enable-__cxa_atexit

          Thread model: posix

          gcc version 4.9.1 (GCC)

           

          What version of yocto are you using?

           

          root@galileo:~# cat /etc/version

          201606081532

           

          Fernando.

          1 of 2 people found this helpful
          • 2. Re: How to compile C++ on Yocto Linux using terminal
            Taric25

            Hi, FGT,

             

            Here is what I get when I copy the .direct image file inside the "Latest Yocto* Poky Image" from https://software.intel.com/en-us/iot/hardware/galileo/downloads to the SD card.
            Screenshot_version_clanton.png

            I would tell you what version I was using last night, except one of my teammates modified the SD card since I last used it, so I am not able to get that information. Our Teaching Assistant (TA) loaded something on our SD card from his personal github, and now g++ works. I wish I could give you what version we were using last, because it would help other people who have this problem. Whatever it's worth, here is the version I am using now.Screenshot_version_modified_galileo.png

            I'm sorry for wasting your time.

            • 3. Re: How to compile C++ on Yocto Linux using terminal
              FGT

              Hi Taric25,

               

              Taric25 wrote:

              ...

              I'm sorry for wasting your time.

              Never mind, it's good to know your Intel Galileo is now "Up & Running".

               

              Actually, the version showing the output

               

              root@galileo:~# cat /etc/version

              201606081532

               

              (which you have now) is the one you should use.

               

              BR,

               

              Fernando.

              1 of 1 people found this helpful