⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 libtool.texi

📁 GNU libtool 是一个通用库支持脚本
💻 TEXI
📖 第 1 页 / 共 5 页
字号:
@node Invoking libtool@chapter Invoking @code{libtool}@pindex libtool@cindex libtool command options@cindex options, libtool command@cindex command options, libtoolThe @code{libtool} program has the following synopsis:@examplelibtool [@var{option}]@dots{} [@var{mode-arg}]@dots{}@end example@noindentand accepts the following options:@table @samp@item --configDisplay libtool configuration variables and exit.@item --debugDump a trace of shell script execution to standard output.  Thisproduces a lot of output, so you may wish to pipe it to @code{less} (or@code{more}) or redirect to a file.@item -n@itemx --dry-runDon't create, modify, or delete any files, just show what commands wouldbe executed by libtool.@item --featuresDisplay basic configuration options.  This provides a way for packagesto determine whether shared or static libraries will be built.@item --tag=@var{tag}Use configuration variables from tag @var{tag} (@pxref{Tags}).@item --preserve-dup-depsDo not remove duplicate dependencies in libraries.  When building packageswith static libraries, the libraries may depend circularly on each other(shared libs can too, but for those it doesn't matter), so there aresituations, where -la -lb -la is required, and the second -la may not bestripped or the link will fail.  In cases where these duplications arerequired, this option will preserve them, only stripping the librariesthat libtool knows it can safely.@item --finishSame as @samp{--mode=finish}.@item --helpDisplay a help message and exit.  If @samp{--mode=@var{mode}} isspecified, then detailed help for @var{mode} isdisplayed.@item --mode=@var{mode}Use @var{mode} as the operation mode.  If not specified, an attempt ismade to infer the operation mode from the @var{mode-args}.  Not specifyingthe @var{mode} is currently deprecated, as there are too many situationswhere it is not possible to guess.  Future versions of Libtool will requirethat @var{mode} be explicitly set.@var{mode} must be set to one of the following:@table @samp@item compileCompile a source file into a libtool object.@item executeAutomatically set the library path so that another program can useuninstalled libtool-generated programs or libraries.@item finishComplete the installation of libtool libraries on the system.@item installInstall libraries or executables.@item linkCreate a library or an executable.@item uninstallDelete installed libraries or executables.@item cleanDelete uninstalled libraries or executables.@end table@item --versionPrint libtool version information and exit.@end tableThe @var{mode-args} are a variable number of arguments, depending on theselected operation mode.  In general, each @var{mode-arg} is interpretedby programs libtool invokes, rather than libtool itself.@menu* Compile mode::                Creating library object files.* Link mode::                   Generating executables and libraries.* Execute mode::                Debugging libtool-generated programs.* Install mode::                Making libraries and executables public.* Finish mode::                 Completing a library installation.* Uninstall mode::              Removing installed executables and libraries.* Clean mode::                  Removing uninstalled executables and libraries.@end menu@node Compile mode@section Compile mode@cindex mode, compile@cindex compile modeFor @dfn{compile} mode, @var{mode-args} is a compiler command to be usedin creating a `standard' object file.  These arguments should begin withthe name of the C compiler, and contain the @samp{-c} compiler flag sothat only an object file is created.Libtool determines the name of the output file by removing the directorycomponent from the source file name, then substituting the source codesuffix (e.g. @samp{.c} for C source code) with the library object suffix,@samp{.lo}.If shared libraries are being built, any necessary PIC generation flagsare substituted into the compilation command.  You can pass link specificflags to the compiler driver using @samp{-XCClinker @var{flag}} or passlinker flags with @samp{-Wl,@var{flag}} and @samp{-Xlinker @var{flag}}.You can also pass compile specific flags using @samp{-Wc,@var{flag}}and @samp{-Xcompiler @var{flag}}.If both PIC and non-PIC objects are being built, libtool will normallysuppress the compiler output for the PIC object compilation to saveshowing very similar, if not identical duplicate output for eachobject.  If the @samp{-no-suppress} option is given in compile mode,libtool will show the compiler output for both objects.If the @samp{-static} option is given, then a @samp{.o} file is built,even if libtool was configured with @samp{--disable-static}.Note that the @samp{-o} option is now fully supported.  It is emulatedon the platforms that don't support it (by locking and moving theobjects), so it is really easy to use libtool, just with minormodifications to your Makefiles. Typing for example@examplelibtool gcc -c foo/x.c -o foo/x.lo@end examplewill do what you expect.Note, however, that, if the compiler does not support @samp{-c} and@samp{-o}, it is impossible to compile @file{foo/x.c} withoutoverwriting an existing @file{./x.o}.  Therefore, if you do have asource file @file{./x.c}, make sure you introduce dependencies in your@file{Makefile} to make sure @file{./x.o} (or @file{./x.lo}) isre-created after any sub-directory's @file{x.lo}:@examplex.o x.lo: foo/x.lo bar/x.lo@end exampleThis will also ensure that make won't try to use a temporarily corrupted@file{x.o} to create a program or library.  It may cause needlessrecompilation on platforms that support @samp{-c} and @samp{-o}together, but it's the only way to make it safe for those that don't.@node Link mode@section Link mode@cindex link mode@cindex mode, link@dfn{Link} mode links together object files (including libraryobjects) to form another library or to create an executable program.@var{mode-args} consist of a command using the C compiler to create anoutput file (with the @samp{-o} flag) from several object files.The following components of @var{mode-args} are treated specially:@table @samp@cindex undefined symbols, allowing@cindex unresolved symbols, allowing@item -all-staticIf @var{output-file} is a program, then do not link it against anyshared libraries at all.  If @var{output-file} is a library, then onlycreate a static library.@item -avoid-versionTries to avoid versioning (@pxref{Versioning}) for libraries and modules,i.e., no version information is stored and no symbolic links are created.If the platform requires versioning, this option has no effect.@item -dlopen @var{file}Same as @samp{-dlpreopen @var{file}}, if native dlopening is notsupported on the host platform (@pxref{Dlopened modules}) or ifthe program is linked with @samp{-static}, @samp{-static-libtool-libs},or @samp{-all-static}.  Otherwise, no effect.  If @var{file} is@code{self} libtool will make sure that the program can @code{dlopen}itself, either by enabling @code{-export-dynamic} or by falling back to@samp{-dlpreopen self}.@item -dlpreopen @var{file}Link @var{file} into the output program, and add its symbols to@var{lt_preloaded_symbols} (@pxref{Dlpreopening}).  If @var{file} is@code{self}, the symbols of the program itself will be added to@var{lt_preloaded_symbols}.If @var{file} is @code{force} libtool will make sure that@var{lt_preloaded_symbols} is always @emph{defined}, regardless of whetherit's empty or not.@item -export-dynamicAllow symbols from @var{output-file} to be resolved with @code{dlsym}(@pxref{Dlopened modules}).@item -export-symbols @var{symfile}Tells the linker to export only the symbols listed in @var{symfile}.The symbol file should end in @samp{.sym} and must contain the name of onesymbol per line. This option has no effect on some platforms.By default all symbols are exported.@item -export-symbols-regex @var{regex}Same as @samp{-export-symbols}, except that only symbols matchingthe regular expression @var{regex} are exported.By default all symbols are exported.@item -L@var{libdir}Search @var{libdir} for required libraries that have already beeninstalled.@item -l@var{name}@var{output-file} requires the installed library @file{lib@var{name}}.This option is required even when @var{output-file} is not anexecutable.@item -moduleCreates a library that can be dlopened (@pxref{Dlopened modules}).This option doesn't work for programs.Module names don't need to be prefixed with 'lib'.In order to prevent name clashes, however, 'libname' and 'name'must not be used at the same time in your package.@item -no-fast-installDisable fast-install mode for the executable @var{output-file}.  Usefulif the program won't be necessarily installed.@item -no-installLink an executable @var{output-file} that can't be installed andtherefore doesn't need a wrapper script on systems that allow hardcodingof library paths.  Useful if the program is only used in the build tree,e.g., for testing or generating other files.@item -no-undefinedDeclare that @var{output-file} does not depend on any other libraries.Some platforms cannot create shared libraries that depend on otherlibraries (@pxref{Inter-library dependencies}).@item -o @var{output-file}Create @var{output-file} from the specified objects and libraries.@item -objectlist @var{file}Use a list of object files found in @var{file} to specify objects.@item -precious-files-regex @var{regex}Prevents removal of files from the temporary output directory whosenames match this regular expression.  You might specify @samp{\.bbg?$}to keep those files created with @code{gcc -ftest-coverage} for example.@item -release @var{release}Specify that the library was generated by release @var{release} of yourpackage, so that users can easily tell which versions are newer thanothers.  Be warned that no two releases of your package will be binarycompatible if you use this flag.  If you want binary compatibility, usethe @samp{-version-info} flag instead (@pxref{Versioning}).@item -rpath @var{libdir}If @var{output-file} is a library, it will eventually be installed in@var{libdir}.  If @var{output-file} is a program, add @var{libdir} tothe run-time path of the program.@item -shrext @var{suffix}If @var{output-file} is a libtool library, replace the system's standardfile name extension for shared libraries with @var{suffix} (most systemsuse @file{.so} here).  This option is helpful in certain cases where anapplication requires that shared libraries (typically modules) have anextension other than the default one.  Please note you must supply thefull file name extension including any leading dot.@item -R @var{libdir}If @var{output-file} is a program, add @var{libdir} to its run-timepath.  If @var{output-file} is a library, add -R@var{libdir} to its@var{dependency_libs}, so that, whenever the library is linked into aprogram, @var{libdir} will be added to its run-time path.@item -staticIf @var{output-file} is a program, then do not link it against anyuninstalled shared libtool libraries.  If @var{output-file} is alibrary, then only create a static library.@item -static-libtool-libsIf @var{output-file} is a program, then do not link it against anyshared libtool libraries (@samp{.la} files).  If @var{output-file} is alibrary, then only create a static library.@item -version-info @var{current}[:@var{revision}[:@var{age}]]If @var{output-file} is a libtool library, use interface versioninformation @var{current}, @var{revision}, and @var{age} to build it(@pxref{Versioning}).  Do @strong{not} use this flag to specify packagerelease information, rather see the @samp{-release} flag.@item -version-number @var{major}[:@var{minor}[:@var{revision}]]If @var{output-file} is a libtool library, compute interface versioninformation so that the resulting library uses the specified major, minor andrevision numbers.  This is designed to permit libtool to be used withexisting projects where identical version numbers are already used acrossoperating systems.  New projects should use the @samp{-version-info} flaginstead.@item -Wl,@var{flag}@itemx -Xlinker @var{flag}Pass a linker specific flag directly to the linker.@item -XCClinker @var{flag}Pass a link specific flag to the compiler driver (@var{CC}) during linking.@end tableIf the @var{output-file} ends in @samp{.la}, then a libtool library iscreated, which must be built only from library objects (@samp{.lo} files).The @samp{-rpath} option is required.  In the current implementation,libtool libraries may not depend on other uninstalled libtool libraries(@pxref{Inter-library dependencies}).If the @var{output-file} ends in @samp{.a}, then a standard library iscreated using @code{ar} and possibly @code{ranlib}.@cindex partial linking@cindex linking, partialIf @var{output-file} ends in @samp{.o} or @samp{.lo}, then a reloadable objectfile is created from the input files (generally using @samp{ld -r}).This method is often called @dfn{partial linking}.Otherwise, an executable program is created.@node Execute mode@section Execute mode@cindex execute mode@cindex mode, executeFor @dfn{execute} mode, the library path is automatically set, then aprogram is executed.The first of the @var{mode-args} is treated as a program name, with therest as arguments to that program.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -