On Sat, 2014-07-26 at 12:40 +0900, Carsten Haitzler wrote:
> > Second is actually a question about whether it's possible or okay to use
> > unversioned .so during build time
> 
> no (assuming you mean only have a .so with no versions). the version (major) 
> is
> determined by following the first .so link. you inlclude the .so link and it
> should point to .so.2 - that .so.2 is what your binary then relies on at
> runtime.

Minor technical nitpick: it is not the symlink names which somehow
determine the actual runtime dependency. It is the SONAME inside the ELF
file that gets found when opening the .so file name.

On my desktop system:

$ readelf -a /usr/lib/x86_64-linux-gnu/libGL.so | grep SONAME
 0x000000000000000e (SONAME)             Library soname: [libGL.so.1]

The linker really just looks for libGL.so and opens it, without checking
what the symlink points to:

$ strace -f gcc -o /tmp/test /tmp/test.c -lGL 2>&1 | grep -e GL.so -e readlinkat
[pid  4504] stat("/usr/lib/gcc/x86_64-linux-gnu/4.9/libGL.so", 0x7fff4d33cc90) 
= -1 ENOENT (No such file or directory)
[pid  4504] open("/usr/lib/gcc/x86_64-linux-gnu/4.9/libGL.so", O_RDONLY) = -1 
ENOENT (No such file or directory)
[pid  4504] 
stat("/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libGL.so", 
{st_mode=S_IFREG|0644, st_size=422224, ...}) = 0
[pid  4504] 
open("/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libGL.so", 
O_RDONLY) = 8
[pid  4504] 
open("/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libGL.so", 
O_RDONLY) = 9


-- 
Best Regards, Patrick Ohly

The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.



_______________________________________________
Dev mailing list
[email protected]
https://lists.tizen.org/listinfo/dev

Reply via email to