异想天开

What's the true meaning of light, Could you tell me why

gcc命令行参数

日期:2014-11-25 11:26:21
  
最后更新日期:2014-12-17 10:02:47
【技术文章】
记录一个gcc命令行参数。
在Makefile里面看到一句:
[code lang="cpp"]
LDFLAGS+="-Wl,-rpath,./../CumulusLib/,-rpath,/usr/local/lib/"
[/code]
表示不懂,网上搜索后记录如下,同时值得借鉴参考1stackoverflow学习人家怎么提问方式。
man gcc
[code lang="cpp"]
-Wl,option
Pass option as an option to the linker. If option contains commas,
it is split into multiple options at the commas. You can use this
syntax to pass an argument to the option. For example,
-Wl,-Map,output.map passes -Map output.map to the linker. When
using the GNU linker, you can also get the same effect with
-Wl,-Map=output.map.
[/code]
man ld
[code lang="cpp"]
-rpath=dir
Add a directory to the runtime library search path. This is used
when linking an ELF executable with shared objects. All -rpath
arguments are concatenated and passed to the runtime linker, which
uses them to locate shared objects at runtime. The -rpath option
is also used when locating shared objects which are needed by
shared objects explicitly included in the link; see the description
of the -rpath-link option. If -rpath is not used when linking an
ELF executable, the contents of the environment variable
"LD_RUN_PATH" will be used if it is defined.
[/code]
gcc参数Wl表示后面用逗号分隔的字符串,作为option传递给ld(链接器)。-rpath参数是指动态库的搜索路径。
1.stackoverflow相同问题