Reputation: 21309
When using dotnet publish --self-contained
one gets a launcher that has a hard-coded RPATH as follows:
$ llvm-readelf-16 -d launcher
Dynamic section at offset 0x217b0 contains 33 entries:
Tag Type Name/Value
0x0000000000000001 (NEEDED) Shared library: [libpthread.so.0]
0x0000000000000001 (NEEDED) Shared library: [libdl.so.2]
0x0000000000000001 (NEEDED) Shared library: [libstdc++.so.6]
0x0000000000000001 (NEEDED) Shared library: [libm.so.6]
0x0000000000000001 (NEEDED) Shared library: [libgcc_s.so.1]
0x0000000000000001 (NEEDED) Shared library: [libc.so.6]
0x000000000000000f (RPATH) Library rpath: [$ORIGIN/netcoredeps]
...
I already attempted to solve this with LDFLAGS
while invoking dotnet publish
. Alas, I think ld
isn't even getting invoked under the hood and therefore this has no effect.
So my question: is there a way to control the RPATH of a launcher created with dotnet publish
?
PS: using .NET 6.x currently on Ubuntu 22.04 (the packaged .NET).
Upvotes: 0
Views: 196
Reputation: 2578
Judging by this
The main executable of published .NET Core applications ... has an RPATH property set to $ORIGIN/netcoredeps
it is not meant to be configurable.
Source: https://github.com/dotnet/core/blob/main/Documentation/self-contained-linux-apps.md
There's always patchelf which you can use to edit or remove the RPATH after the fact.
Upvotes: 2