gcc - I don't understand -Wl,-rpath -Wl, -


for convenience added relevant manpages below.

my (mis)understanding first: if need separate options ,, means second -wl not option because comes before , means argument -rpath option.

i don't understand how -rpath can have -wl,. argument!

what make sense in mind this:

-wl,-rpath . 

this should invoke -rpath linker option current directory argument.


man gcc:

-wl,option

pass option option linker. if option contains commas, split multiple options @ commas. can use syntax pass argument option. example, -wl,-map,output.map passes -map output.map linker. when using gnu linker, can same effect `-wl,-map=output.map'.

man ld:

-rpath=dir

add directory runtime library search path. used when linking elf executable shared objects. -rpath arguments concatenated , passed runtime linker, uses them locate shared objects @ runtime. -rpath option used when locating shared objects needed shared objects explicitly included in link;

the -wl,xxx option gcc passes comma-separated list of tokens space-separated list of arguments linker. so

gcc -wl,aaa,bbb,ccc 

eventually becomes linker call

ld aaa bbb ccc 

in case, want "ld -rpath .", pass gcc -wl,-rpath,. alternatively, can specify repeat instances of -wl:

gcc -wl,aaa, -wl,bbb -wl,ccc 

or, in case, -wl,-rpath -wl,..


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -