mkcomp can be used to build libraries from component sources, if a separate step is needed as a part of a complex, custom, staged build system (instead of letting mksys, mkapp, or mkexe handle it). But, this should generally be avoided.

This tool is really only here for legacy reasons, and it will likely be removed in future versions of Legato.

mkcomp can be used to pre-build a component library (.so) file.

mkcomp is normally not needed when building through the command line (and is not guaranteed to work and is not supported ).

Use mksys or mkapp. Those tools also build the component libraries, as needed, and mksys can even perform optimizations like sharing of component libraries between apps.

mkcomp is a legacy tool that was used at times as a workaround to support integration with some legacy programs that implement their own main() function. But, the procedure for doing that has changed (see Port Legacy Apps).


mkcomp provides flags to set the target, set build options, and specify additional search directories:

Command line parameters
  -C, --cflags, <string>
        (Multiple, optional) Specify extra flags to be passed to the C compiler.

  -L, --ldflags, <string>
        (Multiple, optional) Specify extra flags to be passed to the linker when linking

  -X, --cxxflags, <string>
        (Multiple, optional) Specify extra flags to be passed to the C++ compiler.

  -a, --stand-alone
        (Optional) Build the component library and all its sub-components' libraries such that the
        component library can be loaded and run without the help of mkexe or mkapp.  This is useful
        when integrating with third-party code that is built using some other build system.

  -c, --component-search, <string>
        (Multiple, optional) (DEPRECATED) Add a directory to the source search path (same as -s).

  -d, --debug-dir, <string>
        (Optional) Generate debug symbols and place them in the specified directory.  Debug symbol
        files will be named with build-id

  -g, --generate-code
        (Optional) Only generate code, but don't compile or link anything. The interface definition
        (include) files will be generated, along with component main files. This is useful for
        supporting context-sensitive auto-complete and related features in source code editors, for

  -i, --interface-search, <string>
        (Multiple, optional) Add a directory to the interface search path.

  -l, --lib-output-dir, <string>
        (Optional) Specify the directory into which any generated runtime libraries should be put.
        (This option ignored if -o specified.)

  -n, --dont-run-ninja
        (Optional) Even if a file exists, ignore it, parse all inputs, and generate all
        output files, including a new copy of the, then exit without running ninja.
        This is used by the to to regenerate itself and any other files that need to be
        regenerated when the finds itself out of date.

  -o, --output-path, <string>
        (Optional) Specify the complete path name of the component library to be built.

  -s, --source-search, <string>
        (Multiple, optional) Add a directory to the source search path.

  -t, --target, <string>
        (Optional) Specify the target device to build for (e.g., localhost or ar7).

  -v, --verbose
        (Optional) Set into verbose mode for extra diagnostic information.

  -w, --object-dir, <string>
        (Optional) Specify the directory into which any intermediate build artifacts (such as .o
        files and generated source code files) should be put.

See Tool Chain Configuration for information on how mkcomp decides what compilers, etc. to use.