|
2020-09-25
| ||
| 13:14 | • Ticket [2d7b1e257a] pkg-config --libs returns incorrect libraries. status st... artifact: 73696d276f user: jan.nijtmans | |
| 13:08 | • Closed ticket [2d7b1e257a]. artifact: a1d6e6e83b user: bll | |
| 12:55 | • Ticket [2d7b1e257a]: 3 changes artifact: ebb07e4f9e user: bll | |
| 12:44 | • Ticket [2d7b1e257a]: 3 changes artifact: 942342e8d1 user: jan.nijtmans | |
| 12:30 | • Ticket [2d7b1e257a]: 3 changes artifact: dddcf7d782 user: bll | |
| 12:05 | • Pending ticket [2d7b1e257a]. artifact: 218a74fbdc user: jan.nijtmans | |
| 11:42 | • Ticket [2d7b1e257a]: 4 changes artifact: 70693c242e user: bll | |
| 11:09 | • New ticket [2d7b1e257a]. artifact: 403aa98ba7 user: bll | |
pkg-config --libs returns incorrect libraries.
Closed / Works For Me2d7b1e257a6497892305ebd1ff1fd528d07ab4edCreated 6 years agoUpdated 6 years ago
Descriptionplain2020-09-25 11:09:19
pkg-config --libs for Tcl returns both the main tcl library and the stub library. A Tcl extension will link against one or the other, not both. bll-g7:bll$ PKG_CONFIG_PATH=$HOME/local/lib/pkgconfig pkg-config --libs tcl -L/home/bll/local/lib -ltcl8.6 -ltclstub8.6
bll Ticket [2d7b1e257a]: 4 changes
[History diff]2020-09-25 11:42:43
jan.nijtmanswiki2020-09-25 12:05:48
That's intentional. I don't think tclconfig has the possibility to know whether an extension is going to be compiled with stubs or not. Therefore, supplying both works always: The extension will link to whatever library (stub or not) supplies the missing symbols.
So, what's the bug?
bllplain2020-09-25 12:30:16
Hmmm...I was assuming some sort of overlap between the two libraries.
Still it gives very different results:
I don't know that the first one will work on every Linux system.
# with -ltcl8.6
bll-g7:bll$ cc -O2 -fstack-protector-strong -fstack-protector-all -shared -o diskspace.so tcldiskspace.o dimain.o didiskutil.o digetentries.o digetinfo.o diquota.o display.o getoptn.o options.o realloc.o strdup.o strstr.o trimchar.o -L/home/bll/local/lib -ltcl8.6 -ltclstub8.6
bll-g7:bll$ ldd diskspace.so
linux-vdso.so.1 (0x00007ffd6a7cf000)
libtcl8.6.so => /lib/x86_64-linux-gnu/libtcl8.6.so (0x00007f8a6cec6000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f8a6cd05000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f8a6cd00000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f8a6cae2000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f8a6cac1000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f8a6c93e000)
/lib64/ld-linux-x86-64.so.2 (0x00007f8a6d0b5000)
# without -ltcl8.6
bll-g7:bll$ cc -O2 -fstack-protector-strong -fstack-protector-all -shared -o diskspace.so tcldiskspace.o dimain.o didiskutil.o digetentries.o digetinfo.o diquota.o display.o getoptn.o options.o realloc.o strdup.o strstr.o trimchar.o -L/home/bll/local/lib -ltclstub8.6
bll-g7:bll$ ldd diskspace.so
linux-vdso.so.1 (0x00007ffc2bffe000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f5c068c6000)
/lib64/ld-linux-x86-64.so.2 (0x00007f5c06ab7000)
bll-g7:bll$
jan.nijtmanswiki2020-09-25 12:44:07
Indeed, diskspace.so is linked with libraries it doesn't import any symbol from. Many platforms already do that by default, but apparently Linux does not.
Does the --as-needed linker flag (-Wl,--as-needed) help?
bllplain2020-09-25 12:55:45
Yes, a little surprising. One would think that -Wl,--as-needed would be a default. Yes, -Wl,--as-needed works and -ltcl8.6 has no effect in that case.
bll Closed ticket [2d7b1e257a].
[History diff]2020-09-25 13:08:52
jan.nijtmanswiki2020-09-25 13:14:12
Change Resulution to "Works For Me", as the report is actually not Invalid (on Linux, unnecessary libraries are linked). But there's nothing tclconfig can do about that.
Thanks for the report, anyway!
Log in (anonymous is fine) to add a comment.