Scribbler 2
MyroC Installation and Comments for Windows 10

Materials to Support a C-based Course with Scribbler 2 Robots
Scribbler 2
 
 

Installing MyroC.a

This page organizes instructions and notes for the installation of version
Warning: Undefined variable $_MyroC_version in /home/walker/public_html/MyroC/windows/myroc-installation-notes-windows10.php on line 51
of the MyroC package on Windows 10. Overall, this installation involves the following packages:

  MinGW-w64 and MSYS
(including several MSYS2 Packages)
eSpeak
(from developer
Jonathan Duddington)
eSpeakPackage.3.0
(part of MyroC.a)
MyroC.a  

Overview

The C Programming Language was first developed in the 1970s to support software development by computing professionals at AT&T Bell Laboratories. These cutting-edge computer scientists often worked within an operating system called Unix, and both C and Unix utilize several common perspectives regarding programming and application development.

Brief History

Over the years, C has progressed substantially, with a long series of evolving national and international standards.

An important perspective throughout this development is that the C language began as a tool to help meet specific technical needs, but now is widely used internationally to support a wide range of technical applications. Conceptually, C relies on the programmer to supervise many low-level tasks, and this allows C programs to run quickly, with little overhead.

The C Programming Language and Windows 10

With its history, the C Programming Language was developed with some assumptions regarding a computer's operating system. In today's environment, such an environment largely is consistent with features built into Linux and Mac OS X systems. However, Windows operating systems, including Windows 10, come with a somewhat different model of computation and different basic features. As a result, computers based on Linux or Mac OS X can be utilize C programs directly—relevant run-time environments for C typically are available with little work when a machine runs either Linux or Mac OS X. For Windows operating systems, however, there is both bad news and good news:


When working with Windows 10, a first step is to download/install appropriate packages that support C programming. With these tools available, program development in C can be reasonably straight forward. A programmer writes in C, and the behind-the-scenes packages provide a framework for program execution—the programmer need not worry much about most internal differences for C between Windows 10 and other environments.

Packages for C and C-based Capabilities for Windows 10

As you may expect, numerous packages are available to support C programming within a Windows 10 environment. Pragmatically, most of these C environments provide fine support for commonly-used capabilities and libraries of the Standard C Programming Language (e.g., C99, C11, or C18, as mentioned above). Thus, many [most?] C environments for Windows will work fine for most or all activities related to most introductory courses involving programming in C. These environments may vary in their ability to run relatively advanced features of Standard C, but such capabilities generally arise only in applications beyond the scope of an introductory course.

General Comments

In considering many of the packages that might be used to support C programming on Windows 10, most possibilities provide a general environment, and many seem designed for certain types of uses. However, each package may not work as well for other applications.

The following procedures focus on the installation of MinGW-w64. On the positive side, this package seems to provide an extensive range of libraries, including capabilities to utilize Bluetooth communication. On the negative side, the user environment may seem somewhat limited.

Note: The following comments and procedures largely follow Ross's Rambling: Installing MinGW-W64 + MSYS on Win 10 x64 (or Win 8.1 or Win 7). Throughout, this narrative adds notes and selects specific details—focusing upon likely needs for folks just beginning with C within a Windows' environment.

Although installation of an appropriate C programming environment requires several detailed steps, the high-level goals of these instructions yield three basic results:

Some Common C Environments for Windows 10 Computers

Several widely-used programming environments are available for writing and running programs in C within Windows 10. All of the following provide solid, low-level control of the programming environment, as needed for this course. Variations typically relate to details of the underlying machines (e.g., computers that support 32-bit versus 64-bit processing), libraries that are available (e.g., the ability to utilize Bluetooth communication within a program), and the range of programming/operating systems commands available to a user.


MinGW-w64 and MSYS

The installation of MinGW-w64, MSYS, and related elements requires several steps. You will need to follow these instructions step-by-step. Do NOT jump ahead or skim quickly through this section!

Handling the Basic MSYS2 Environment

  1. Download and Install MSYS2 64 bit:
    1. Go to http://msys2.org
    2. Check that your machine meets the Installation Prerequisites:
      • Windows 7 or newer
      • 64-bit hardware
    3. Review the MSYS2 Naming Conventions (in the right column)
      The MSYS2 Naming Conventions must be used in what follows.
    4. Under Installation Prerequisites, click the button "mys2-x86_64.20200629.exe" to download the installer.
      • A newer number or different number may appear on the button, as release numbers and hardware variations arise.
      • Clicking the button will create a pop-up box asking you where to save the installer program. Although you may choose a variety of locations, the "Downloads" folder on your account is commonly used. (That is the folder that I used.)
    5. Click on the installer name (e.g., mys2-x86_64.20200629.exe in your Downloads folder) to run the installer program.
      • When the program is first run, a pop-up welcome box will appear. Click "Next" to continue.
      • The next pop-up box asks where to install the MSYS2 package. Although this choice allows flexibility, the suggested name (C:\msys or C:\msys64 is a reasonable choice. (I used C:\msys64)
      • Another pop-up box may ask you to identify a name that can be included in your computer's Start-up Panel (e.g., identified as the Window's icon at the lower-left of your computer screen). Choose whatever label you think appropriate. (I used MSYS2-64bit.)
      • The last pop-up box provides a check box to "Run MSYS2 now". Checking this box provides a convenient transition to the next stage of MSYS2 setup. With this box checked, click "Finish".
      • When the MYSYS2 installer is finished, basic functionality for the general writing of programs is established.

MSYS2 Naming Conventions: 32-bit versus 64-bit architectures

Throughout this discussion, the names of various packages and libraries are named in accordance with the underlying hardware. Thus, throughout,

These instructions are written for 64-bit computers, so the examples use the previous mingw-w64-x86_64 For 32-bit machines, change this prefix in commands to mingw-w64_i686.


Uaing MSYS2

Once MSYS2 is installed, the Windows "start" menu (at the bottom left of your screen) will contain an entry for MSYS2-64bit.

Clicking on this menu entry yields three options:

In all work that follows, you must use the MSYS2 MingGW 64-bit option.


Updating the Basic MSYS2 Environment and Underlying Record-keeping System

Behind the scenes, MYSYS2 records what software development libraries and language packages are installed. Once the basic MSYS2 system is available, a first step is to install/update this infrastructure.


  1. Updating/Establishing the basic MSYS2 Elements
    • When the basic installer has finished, with the "Run MSYS2 now" checkbox checked, a new window will appear to help identify capabilities and languages within the MSYS2 environment. Much of the initial work in this new window will use MSYS2's package manager, called pacman
      • Within the new window, type
                       pacman -Syu
                     
        to update the package database and basic MSYS2 elements.
      • After a report of several packages that may need updating, a prompt asks, "Proceed with installation? [Y/n]"
        Type Y to proceed.
    • Alternatively, if you run the MSYS2 environment from your Window's Start page, you could type "pacman -Su"

The packman Package Manager

The pacman package mangeM provides numerous capabilities for managing software packages/utilities. The most common flag is -S to synchronize the installed packages with an extensive database maintained by MSYS2. The following flag options are commonly used during these instructions.


  • At this point, the MSYS2 installation instructions observe that "Now Pacman is fully committed to the Windows cause :)"

    1. Installing components of MinGW-w64 for C programming within MSYS2.
      MinGW-w64 includes a staggering 1846 separate packages that support numerous common capabilities and a range of languages, including Ada, C, C++.FORTRAN, and Objective C.

      Within the MSYS2 Terminal window, install the packages that handle frequently-used elements within C, using the following MSYS2 commands. (If/when asked if you want to install many packages or just one, use the default which specifies all.)

            pacman -S base
      
            pacman -S base-devel
      
            pacman -S mingw-w64-x86_64-toolchain
      
            pacman -S mingw-w64-x86_64-libjpeg-turbo
      
            pacman -S mingw-w64-x86_64-glew
      
            pacman -S mingw-w64-x86_64-freeglut
      
            pacman -S mingw-w64-x86_64-hidapi
          

      Note: In the above sequence, some people have observed that the installation of the toolchain times out, so that material is not installed, and the gcc compiler is not available. In that case, one might try installing just the gcc compiler, gcc libraries, and make utility:

         pacman -S mingw-w64-x86_64-gcc
         pacman -S mingw-w64-x86_64-gcc-libs
         pacman -S mingw-w64-x86_64-make
      

      This option does not download various other tools, but at least an appropriate compiler utilities will be available.

    With the basic MSYS2 environment established, packages for various languages can be installed.





    Key Observation when using MSYS2 on Windows

    The process of installing MSYS2 actually establishes three different environments for working with programs—all found in the msys2 directory that you set up. (If you followed the instructions given here, this directory would be in C:msys> or msys64.)

    In particular, the base MSYS2 folder contains three different shells (analogous to the bash shell, C shell, or z shell on Linux or Mac computers). Use one of these shells as your terminal window when working with various programming interactions and languages:


    When programming in a 64-bit computing environment (as is highlighted throughout these instructions, you must use mingw64.exe.

    The other options likely will not able to find the proper libraries, compilers, and other needed utilities. (For example, using a different starting point caused me considerable frustration, until I realized my error.)

    Usage Clarification

    During the installation of MSYS2, the installer asked for the name of an entry within the Windows start menu, so you would have quick links to MSYS2. However, a close look at the start menu will show an entry (e.g., MSYS2-64-bit), but that main entry has three subentries (MSYS2 MinGW 32-bit, MSYS2 MinGW 64-bit and MSYS2 MSYS.

    For programming in the desired 64-bit environment, only start entry MSYS2 MinGW 64-bit should be used.

    With this in mind, it is suggested that you install a link to this program on your task bar, and ignore the other starting options.






    eSpeak [Jonathan Duddington (admin)]

    eSpeak is a speech synthesizer package that allows the computer to read text that it is given. This capability turns out to be quite useful when testing programs. (When running a program, espeak allows the program to say what it is doing, so the programmer can watch that the robot is doing the right activity—without having to consult the code to determine what is supposed to happen next.)

    To install eSpeak

    1. Download the setup_espeak-1.48.04.exe executable file for Windows from eSpeak

    2. Run the setup_espeak-1.48.04.exe program, to start an "eSpeak Setup Wizard".

    3. You can test that the installation of the basic eSpeak code has been installed properly in two ways.

      1. The espeak package comes with an application, called TTSAppp.exe. You can run this in either of two ways.

        • Go to the computer's "Quick Start" menu, click on the "espeak" entry, and then on "TTSApp.ext". After typing text into the main box, click "speak" to hear the synthesized voice. Change the "voice" option to hear each of the voice combinations you specified in the previous step of these instructions.
        • In the msys2 command_line interface, use the cd command to move to the directory where you specified espeak should be installed. For example, if you followed the suggestions above, you might type
                      cd C:/espeak
                      ./TTSApp.exe
                    
      2. The espeak package comes as a stand-alone program, called espeak.

        • To run this program, go to the directory where you installed the espeak package, then move to the command_line subdirectory, and use the espeak command:
                    cd C:/espeak
                    cd command_ line
                    ./espeak.exe
                  

          When this program is running, type in text, and the program will speak the text to you, line at a time.

        • As a variation, you can specify voice combinations by specifying a -v option. For example, considering the voice combinations mentioned above, one could type:
                  ./espeak.exe -v en+m1
                  ./espeak.exe -v en-us+f5
                

    Notes:

    eSpeakPackage

    The eSpeakPackage, distributed as part of MyroC, provides a C interface that allows a programmer to specify text to eSpeak within a program. Thus, a single C program will be able to control a robot and generate speech through the synthesizer at the same time.

    To get started, you will need a base directory for downloading and installing the eSpeak and MyroC packages. For example, you might create a directory MyroCPackage for your work.

    1. In a terminal window, move to the top of your MSys2 file structure, create a MyroCPackage directory, and move to it.

      cd                  # go to the MyroC home first
      mkdir MyroCPackage  # create a base directory
      cd MyroCPackage     # move to the base directory for MyroC installation
      
    2. Download the compressed archive file, MyroC.a.tgz to your created base directory

    3. Although the original file, MyroC.a.tgz, is a compressed archive file, the Windows environment may or may not decompress the file automatically during download.
      Depending upon the file extension of the downloaded file, only one of the following options will apply.

      Note:

    Following this extraction, the following files and directories should be found in a new MyroC.a subdirectory.

    All materials for the eSpeakPackage are (not surprisingly) located in the eSpeak directory.

    1. Move from the general MyroCPackage directory to its eSpeak subdirectory.:

      cd eSpeak
        

    The internal algorithms and code for the eSpeakPacakge are quite different on Linux, Mac OS X, and Windows 10. Thus, the downloading and decompression process for the MyroCPackage creates four subdirectories for the eSpeakPackage:


    1. Assuming a Windows environment, move from the main base directory to the new eSpeakPackage-windows.3.0  subdirectory. Then list the contents of the eSpeak subdirectory:

      cd eSpeakPackage-windows.3.0 
      ls
      

      The listing includes the following files:

    2. Compile and install the relevant framework for compiling and running eSpeak on a Windows computer by using the make:command with the file Makefile-windows-installation-espeak:

      make -f Makefile-windows-installation-espeak install/eSpeak
      

    Notes:

    Testing the eSpeak and eSpeakPackage download and installation

    MyroC.a

    Installation of the MyroC package follows a process similar to what has been described for the eSpeakPackage—using the same MyroC download that was used for installing the eSpeakPackage.

    1. From your base directory for the MyroCPackage, go to the MyroC subdirectory for this release:
      cd              # go home first, since earlier commands reference various directories
      cd MyroCPackage # the base directory for this installation
      cd MyroC.a   # the subrelease subdirectory
      
    2. As with the eSpeak installation, compile and install the MyroC package in system directories using Makefile-windows-installation-myroc as the relevant framework for compiling and installing the MyroC package:

      Compile and install the MyroC package in system directories:

      make -f Makefile-windows-installation-myroc install/MyroC
      

    Note: As with the eSpeakPackage installation, if you encounter an error message, "operation not allowed," when running the make command, you should try

         sudo make -f Makefile-windows-installation install/MyroC
    

    This command will require you to type your password to confirm your intention to perform this command.

    Testing and Running MyroC Programs

    Note about Printing

    Often, the output of a printf statement will not appear until late in program execution—perhaps just before the program terminates. To solve this problem, add the statement fflush(stdout); after each printf statement.

    On to Running Test Programs

    Several test programs are available in the test-programs subdirectory of the base directory.

    Preliminary Step: Using MyroC with Scribbler 2 robots requires setting up Bluetooth so the workstation/laptop and robot(s) are properly paired. See Bluetooth Setup for Windows 10 Workstations/Laptops for details — before trying to run test programs.

    Compiling MyroC programs requires use of numerous compilation flags, compiling normally uses a Makefile. As with installation, compilation flags must be tailored to the Windows environment.

    1. Move to the MyroCPackage directory that you created earlier, and then move to its test-programs subdirectory.

    2. From the MyroC.3.3 directory, move to the test-programs subdirectory.

      cd
      cd MyroCPackage
      cd test-programs
      
    3. In the test-programs subdirectory, use the make command with the Makefile-windows-apps file as the relevant framework for compiling MyroC programs. For example, running the spirit-song.c program utilizes these steps:

      make -f Makefile-windows-apps spirit-song
      ./spirit-song
      
    4. Although this command sequence should work without trouble, typing -f Makefile-windows-apps for compiling every program can be somewhat tedious and error prone. To simplify the compiling process, make a copy of Makefile-windows-apps to a new file Makefile

      cp Makefile-windows-apps Makefile
      
    5. With this step the make command will use Makefile as its default. In this context, one can compile and run programs with a simpler sequence:

      make spirit-song
      ./spirit-song
      

      Notes: Following this same approach, any MyroC application programs may be compiled using the make command—assuming file MyroC-windows-apps is present in the current directory. (As already discussed, copying MyroC-windows-apps to a Makefile file allows a simple invocation of the make command.)


    created 17 October 2015
    revised 19 October 2015
    revised 23 February 2016
    revised for Windows 10: 31 December 2020 – 4 January 2021
    revised 23-24 Aprl 2021
    Valid HTML 4.01! Valid CSS!
    For more information, please contact Henry M. Walker at walker@cs.grinnell.edu.