# mkcomp

Source: [https://docs.qualcomm.com/doc/80-41102-4/topic/mkcomp.html](https://docs.qualcomm.com/doc/80-41102-4/topic/mkcomp.html)

`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.

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

`mkcomp` is normally not needed when building through the command line.

Use [mksys](https://docs.qualcomm.com/doc/80-41102-4/topic/mksys.html) or [mkapp](https://docs.qualcomm.com/doc/80-41102-4/topic/mkapp.html). Those tools also build the component libraries, as needed, and [mksys](https://docs.qualcomm.com/doc/80-41102-4/topic/mksys.html) 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.

## Usage

`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
            executables.
    
      -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
            example.
    
      -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 build.ninja file exists, ignore it, parse all inputs, and generate all
            output files, including a new copy of the build.ninja, then exit without running ninja.
            This is used by the build.ninja to to regenerate itself and any other files that need to be
            regenerated when the build.ninja 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 sa515m).
    
      -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.Copy to clipboard

See [Tool Chain Configuration](https://docs.qualcomm.com/doc/80-41102-4/topic/mk-Tools.html#concept.dita_9bcf13bd-17cd-4a87-ac7c-dcbd92c5bded__section_yw2_fcz_rvb) for information on how `mkcomp` decides what compilers, etc. to use.

**Parent Topic:** [mk Tools](https://docs.qualcomm.com/doc/80-41102-4/topic/mk-Tools.html)

Last Published: Jan 13, 2025

[Previous Topic
mkexe](https://docs.qualcomm.com/bundle/publicresource/80-41102-4/topics/mkexe.md) [Next Topic
mksys](https://docs.qualcomm.com/bundle/publicresource/80-41102-4/topics/mksys.md)