FlexSEA Wiki

A WEARABLE ROBOTICS TOOLKIT

User Tools

Site Tools


build_fx_plan

Building fx_plan_stack from sources

This page will demonstrate how to compile the Windows libraries, and how to cross-compile the Raspberry Pi librairies from a Windows machine.

Requirements

  • Git (version >= 1.47, we recommend using the latest stable version available on your platform)
  • Bash (Git bash works on Windows , just make sure it is the default to run .sh files)
  • CMake (version >= 3.13, can be either 32 or 64 bit version based on your system's architecture )
    • Get the latest version of CMake and add it to your path.
  • Ninja (version >= 1.3, can be either 32 or 64 bit version based on your system's architecture)
  • GCC 7.3. Do not use any other version.

Setup

  1. Start by installing CMake
    • Note the install path, you will need to add it to the PATH later.
  2. Next install GCC. Get a mingw64 installer from source forge.
    • Use the following setting when installing mingw64 .
    • Note the installation path and navigate to it. Go into the mingw32 folder and then the bin folder. Note this path, you will need to add it to the PATH later. That path should look like this: C:\Program Files (x86)\mingw-w64\i686-7.3.0-posix-dwarf-rt_v5-rev2\mingw32\bin
  3. Next install ninja
    1. Get the latest release (We use 1.90) and download it
    2. Unzip the file
    3. Place it the folder containing the ninja executable to your program files directory on Windows or your /usr/bin/ directory on Linux
    4. Add it to your path, this allows you to access any executables (such as Ninja, CMake and GCC) from the command line
      1. On Windows this is done using the advanced setting in the environment variables
      2. Navigate to advanced settings and select environment variables
      3. Select the PATH variable in system variables
      4. Then add the paths from the previous installs (note: MingW is not visible in the screenshot, but it needs to be listed)

How to build the libraries

  1. From your git bash console
  2. Start from a fresh version of Plan GUI
     git clone --recursive https://github.com/DephyInc/plan_3_0.git 
  3. Change directory to the cloned Plan GUI repo
     cd plan_3_0/ 
  4. Make sure all your submodules are up to date
     git submodule update --init --recursive 
  5. Change directory into fx_plan_stack and run stackBuilder.sh
     cd fx_plan_stack && ./stack_builder.sh && cd ..
  6. A successful build will print a message similar to
    [83/84] Linking CXX static library libs\libfx_plan_stack_static.a
    [84/84] Linking CXX shared library libs\libfx_plan_stack.dll

Debug Build

If you wish to build a plan stack with debug info you can add one of these to the CMakeLists.txt:

 set(CMAKE_BUILD_TYPE DEBUG) 
 set(CMAKE_BUILD_TYPE RELWITHDEBINFO) 

To enforce release build:

 set(CMAKE_BUILD_TYPE RELEASE) 

Note: assuming that you have added your variables to the path, mentions of missing compilers can typically be resolved by restarting your computer.

Test the library:

  1. First, make sure that Actuator-Package\Python\flexseapython\com.txt has the right COM port.
  2. Navigate to the Actuator-Package\Python folder.
python fxMain.py

How to cross-compile the libraries

To be succinct, this section will only cover the differences compilation and cross compilation. For more detailed instructions on compilation, read the previous section.

To cross compile, you will need to have installed and configured the appropriate cross-compiler. Here are the cross compilers for:

After installing these toolchains, the appropriate toolchain file must be used. This file specifies where the toolchain is located and other build settings. These can be found in the git repositories root directory and are specific to the target system.

For the Raspberry Pi Toolchain for Unix systems, the appropriate toolchain path is

${source_folder}/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc

Note: Make sure the paths in these files are correct.

To use the toolchain with an existing Cmake list, just add the DCMAKE_TOOLCHAIN_FILE flag.

cmake .. -DCMAKE_TOOLCHAIN_FILE=CMAKE_RASPBERRY_PI_TOOLCHAIN_FILE ${OTHER_FLAGS}

There are also batch files (i.e. cross_compile_RPI.bat) that automate the build process.

Notes:

  1. For Windows, for all CMake steps, add -G “MinGW Makefiles”. Instead of simply calling
    cmake ..

    call

    cmake .. -G "MinGW Makefiles"
  2. If 'make' doesn't work try using 'mingw32-make.exe' instead.
build_fx_plan.txt · Last modified: 2019/10/08 14:12 by rqurashi