---
name: "lsbc++"
section: "1"
platform: "linux"
package: "lsb-build-cc3"
version: "3.2.0-1"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/lsbc++"
---

# lsbc++(1)

compiler driver for building LSB conforming applications

## NAME

lsbcc, lsbc++, lsbcpp - compiler driver for building LSB conforming applications

## SYNOPSIS

**lsbcc** \[*lsbcc-options*\] \[*compiler-options*\]\
 **lsbc++** \[*lsbcc-options*\] \[*compiler-options*\]\
 **lsbcpp** \[*lsbcc-options*\] \[*compiler-options*\]

## DESCRIPTION

This tool should be used in place of the *cc, c++* or *cpp* command when building an LSB-conforming program.

LSB-conforming programs must link dynamically only with LSB-required and application-supplied shared libraries, as no other libraries can be guaranteed to be present on an LSB-compliant system.  They must only use specified interfaces from LSB-required shared libraries.  LSB programs also need to be linked with  a special program interpreter which identifies them as LSB conforming.

The LSB development environment provides a set of replacement system headers and  stub dynamic libraries. These headers and libraries have been carefully built so that they contain only the interfaces specified in the LSB. When the stub libraries are used for link-time symbol resolution, the use of unspecified interfaces in those libraries will result in link failures.

*lsbcc* is designed to apply the LSB build conventions with a minimum of changes to existing build setups. When invoked as the compiler,  it first modifies the command line to follow the LSB build conventions, then passes the resulting command line on to the regular compiler, so *lsbcc* is effectively a wrapper program.

*lsbcc* takes a number of options prefixed with --lsb-, or alternatively;  behavior other than the default can be controlled by a set of environment variables.  Typically command line options will override options set through envionment varibles.

## LSBCC OPTIONS

- \--lsb-help

  Display help message.  The compiler  *--help* option will also display the output from --lsb-help.

- \--lsb-version

  Display the version of LSB this tool can build for.

- \--lsb-verbose

  The complete command line passed to either the C or C++ compiler will be printed to stderr just prior to execution.  This helps see the effects of lsbcc and options.

- \--lsb-cc=\<path to c compiler\>

  Specifies the name of the C compiler to invoke with the modifed argument set. If this environment variable is not found, the default  *cc* will be used.  This setting overrides the LSBCC environment setting.

- \--lsb-cxx=\<path to c++ compiler\>

  Specifies the name of the C++ compiler to invoke with the modifed argument set. If this environment variable is not found, the default  *c++* will be used.  This setting overrides the LSBCXX environment setting.

- \--lsb-cpp=\<path to c preprocessor\>

  Specifies the name of the C preprocessor to invoke with the modified argument set.  If this setting is not found, the default *cpp* will be used.  This setting overrides the LSB\_CPP environment setting.

- \--lsb-forcefeatures

  This causes lsbcc to insert macro defines for all of the  interface features it supports (e.g. -DHAVE\_BSD, -DHAVE\_GNU...). These macros are not needed for the LSB headers but may select necessary behavior in non-LSB headers that have conditionals. However, predefining the macros may collide with application defintions of the macros, so this is no longer the default behavior for lsbcc.

- \--lsb-libpath=\<lsb\_lib\_path\>

  Specifies the location of the LSB stub libraries that will be linked against.  If this option or the LSBCC\_LIBS environment variable is not set, the default  */opt/lsb/lib* will be used.  This option overrides the LSBCC\_LIBS envionment setting.

- \--lsb-includepath=\<include\_path\>

  Specifies the location of the LSB header files that will be linked against.  If this option or the LSBCC\_INCLUDES environment variable is not set, the default  */opt/lsb/include* will be used.  This option overrides the LSBCC\_INCLUDES envionment setting.

- \--lsb-cxx-includepath=\<include\_path\>

  Specifies the location of the LSB header files that will be linked against.  If this option or the LSBCXX\_INCLUDES environment variable is not set, the default  */opt/lsb/include* will be used.  This option overrides the LSBCXX\_INCLUDES envionment setting.

- \--lsb-shared-libs=\<shared\_lib:...\>

  This option adds libraries to the list of non-lsb libraries to link as shared libraries (such as product internal shared libraries).  A library name or colon-separated list of library names to add to the default list. The name should be the base part of the library only, for example to add *libfoo.so* use the name *foo*.

- \--lsb-shared-libpath=\<path:...\>

  This option adds paths to be searched for shared libraries. Libraries found in the given set of paths will be added to the list of non-lsb libraries to link as shared libraries.

- \--lsb-modules=\<module,..\>

  Enable support for the optional LSB modules listed.   Currently the only supported optional module is 'Multimedia' which provides the ALSA libraries. Modules will added in addition to any added from the LSB\_MODULES environment setting.

## ENVIRONMENT

The following environment variables affect the behavior of *lsbcc*

- LSBCC

  Specifies the name of the C compiler to invoke with the modifed argument set. If this environment variable is not found, the default  *cc* will be used.

- LSBCXX

  Specifies the name of the C++ compiler to invoke with the modifed argument set. If this environment variable is not found, the default  *c++* will be used.

- LSB\_CPP

  Specifies the name of the C preprocessor to invoke with the modified argument set.  If this environment variable is not found, the default *cpp* will be used.

- LSBCC\_LIBS

  Specifies the location of the LSB stub libraries that will be linked against.  If this environment variable is not found, the default  */opt/lsb/lib* will be used (or /opt/lsb/lib64 on certain 64-bit architectures).

- LSBCC\_INCLUDES

  Specifies the location of the LSB header files that will be linked against.  If this environment variable is not found, the default  */opt/lsb/include* will be used.

- LSBCXX\_INCLUDES

  Specifies the location of the LSB C++ header files that will be linked against.  If this environment variable is not found, the default  */opt/lsb/include/c++* will be used.

- LSBCC\_SHAREDLIBS

  A library name or colon-separated list of library names to add to the default list. The name should be the base part of the library only, for example to add *libfoo.so* use the name *foo*.

- LSB\_SHAREDLIBPATH

  This option adds paths to be searched for shared libraries. Libraries found in the given set of paths will be added to the list of non-lsb libraries to link as shared libraries.

- LSB\_MODULES

  Specify which optional LSB modules to include interfaces for. Currently 'Toolkit\_Qt' is the only supported optional module.

- LSBCC\_FORCEFEATURES

  This causes lsbcc to insert macro defines for all of the  interface features it supports (e.g. -DHAVE\_BSD, -DHAVE\_GNU...). This can be helpful in some situations and was formerly the default behavior for lsbcc, but also can collide with feature macro definitions from other sources, so is no longer the default behavior for lsbcc.

- LSBCC\_DEBUG

  A numeric value which represents a bit pattern specifying what kinds of debugging output to produce. The bits in this pattern are

  ```
  0x0001   Display enviromental overrides
  0x0002   Display the arguments passed in
  0x0004   Display the arguments that are specifically recognized
  0x0008   Display the arguments that are not recognized
  0x0010   Display changes made to the include arguments
  0x0020   Display changes made to the library arguments
  0x0040   Display the modified argument list
  ```

- LSBCC\_WARN

  A numeric value which represents a bit pattern specifying what kinds of warnings to emit. The bits in this pattern are

  ```
  0x0001   Warn about libraries being changed to static linking
  ```

  The 01 value is now on by default, to disable it specify an LSBCC\_WARN where the low bit is set to zero.

- LSBCC\_VERBOSE

  The complete command line passed to either the C or C++ compiler will be printed to stderr just prior to execution.  This helps see the effects of lsbcc and options.

## Non LSB Shared Libraries

Normally, only LSB-defined libraries should be linked as shared libraries, all others must be linked statically. However, if an application provides its own shared libraries which have been carefully checked for LSB conformance, the following methods can be used to selectively overrride *lsbcc*'s rule of forcing static linking. The application may not depend on such a library being present on a system, so it must either be shipped with the application, or with another LSB conforming application on which this application depends.

Libs added with any of these options will be cumlative. Shared  libs added with command line options must appear on the command  line before any -l options to have effect.

- \--lsb-shared-libs=\<shared\_lib:...\>

  This option adds libraries to the list of non-lsb libraries to link as shared libraries (such as product internal shared libraries).  A library name or colon-separated list of library names to add to the default list. The name should be the base part of the library only, for example to add *libfoo.so* use the name *foo*.

- \--lsb-shared-libpath=\<path:...\>

  This option adds paths to be searched for shared libraries. Libraries found in the given set of paths will be added to the list of non-lsb libraries to link as shared libraries.

- LSBCC\_SHAREDLIBS

  A library name or colon-separated list of library names to add to the default list. The name should be the base part of the library only, for example to add *libfoo.so* use the name *foo*.

-

  - LSB\_SHAREDLIBPATH

  This option adds paths to be searched for shared libraries. Libraries found in the given set of paths will be added to the list of non-lsb libraries to link as shared libraries.

## EXAMPLES

**lsbcc hello.c -o hello**

**CC=lsbcc CXX=lsbc++ ./configure; make**

**LSBCC\_SHAREDLIBS=tcl:tk CC=lsbcc make**

## AUTHORS

Stuart Anderson \<anderson@freestandards.org\> and other LSB contributors.

## REPORTING BUGS

Report bugs at http://bugs.linuxbase.org.

## BUGS

It is possible to confuse lsbcc's (and lsbc++) automatic library processing. In particular, build systems that include "clever" tools to manage which libraries to use, such as GNU libtool and pkgconfig, may defeat the checks for non-LSB libraries by silently supplying full pathnames instead of the  **-l***lib* form.

## FILES

- /opt/lsb/include

  the LSB header files

- /opt/lsb/lib

  the LSB stub libraries

- /lib/ld-lsb.so.3

  The LSB program interpreter (dynamic linker) for the IA32 architecture

- /lib/ld-lsb-ia64.so.3

  The LSB program interpreter for the Itanium architecture

- /lib/ld-lsb-ppc32.so.3

  The LSB program interpreter for the PowerPC 32-bit architecture

- /lib64/ld-lsb-ppc64.so.3

  The LSB program interpreter for the PowerPC 64-bit architecture

- /lib/ld-lsb-s390.so.3

  The LSB program interpreter for the S390 architecture

- /lib64/ld-lsb-s390x.so.3

  The LSB program interpreter for the S390X architecture

- /lib64/ld-lsb-x86-64.so.3

  The LSB program interpreter for the x86\_64 architecture

## SEE ALSO

lsbappchk

## NOTES

*lsbcc* is commonly delivered as a package named *lsb-build-cc*. If this package is used, the support package *lsb-build-base* must also be installed.

*lsb-build-c++* supplies necessary header files for C++ compilation; it is a separate package as the c++ headers come from a different source than the base headers.

For commercial applications, developers need to be aware of the licenses of the libraries they link to. Since some licenses allow dynamic but not static linking to the library, and *lsbcc* may silently change (apparent) dynamic links to static, the **LSBCC\_WARN** envirnonment variable should be used to notify of such changes.

## COPYRIGHT

Copyright © 2002-2007 Linux Foundation

## SEE ALSO

Linux Standard Base specification and other documents at http://www.linuxbase.org/
