Product SiteDocumentation Site

2.2.2. How to use ligcc?

Use ligcc just like how you use gcc:
Example 2.1. Using ligcc
				[earth@sun] ligcc foo.c -o foo
				[earth@sun] lig++ bar.cpp -o bar

Recommended way:
export CC=ligcc
export CXX=lig++
make CC=ligcc CXX=lig++
There are several environment variables that change ligcc's behavior:
ligcc environment variables
Use this as the include dir for the ligcc headers. Default value: $PREFIX/include/libuild (where $PREFIX is the prefix in which libuild is installed)
Use the specified C compiler. Default value: gcc
Use the specified C++ compiler. Default value: g++
If set to 1, then libuild will statically link some X extension libraries.
Specify a list of whitespace-seperated bogus library dependencies (like: X11 ICE png). These libraries will not be linked against. This option is useful if you want to specify bogus dependencies manually because the automatic bogus dependency stripper doesn't work correctly for your project (see below).
If set to 1, disables the automatic bogus dependency stripper. This is useful when linking to libraries don't have correct DT_NEEDED entries, like GTK 1.2. GTK 1.2 uses internally, but it's not linked with -lX11. Instead, gtk-config –libs returns -lgtk -lX11 or something. If your app doesn't use xlib internally, then our bogus dependency stripper will strip the -lX11 argument. Linking will then fail.
The built-in bogus dependency stripper is not used if you have a recent version of binutils, which supports ld –as-needed (it'll use binutil's native support for bogus dependency stripping instead). So you should get use a recent version of binutils if your ld doesn't already support that argument.
If you want to use the automatic bogus dependency dectector anyway (using ld –asneeded), then you can specify a list of dependencies here that are not bogus with this environment variable. Example:
export LIBUILD_NOT_BOGUS="X11 ICE png"
Specify a list of whitespace-seperated libraries to statically link to (like: popt z). You can also explicitly specify a filename to the static library. Examples:
export LIBUILD_STATIC="popt z"
export LIBUILD_STATIC="popt=/usr/lib/libpopt.a"
If set to 1, link all binaries with -static-libgcc. See the gcc info page for more info about this option.
If non-empty, ligcc will add $ORIGIN/../lib/$LIBUILD_PROJECTNAME to the library search path.
Prepend the specified directory to the compiler's header search path. The compiler will search this directory first, before searching any other directory. This is useful in combination with the older GTK headers package. You can specify multiple directories, seperated by a :, just like the $PATH environment variable. If the order of the -I flags is important for your application, you can replace paths by using /old/path=/new/path.
A space-seperated list of (Perl) regular expressions which specify the libraries whose path must be resolved into absolute paths.
Internally, ligcc reorders the linking arguments that are to be passed to gcc (for various reasons). This can cause problems when linking certain static libraries (for example, static WxWidgets libraries). But that can be worked around by using full path names for static libraries (e.g. turning -lfoo parameters into /usr/lib/full-path-to/foo.a).