-
Notifications
You must be signed in to change notification settings - Fork 585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Native libraries are not resolved #2007
Comments
There are two problems here.
So we need to figure out 2. |
we are going to need to come up with a solution for this sooner rather than later. The new Fake.Sql.SqlServer module doesn't work because of this exact issue :( |
also, the workaround only works when using fake-cli. So i've hit a brick wall trying to solve this :( |
@BlythMeister The question is if we can achieve the same not at start of the dotnet core runtime but later when the code is already running. Another way would be to "restart" fake itself with the proper arguments once this situation is detected. This probably means we need to generate the additional-deps file ... |
Ok I did a bit of digging and apparently restarting ourself is the only option right now:
https://github.com/dotnet/corefx/issues/21982#issuecomment-382338058 There seems to be an ongoing effort to support this scenario (If I actually understand that correctly): dotnet/designs#47 |
Ok I didn't found any workaround from within the script code, but apparently there is a method we can override to customize native dll resolution: https://github.com/dotnet/coreclr/issues/12103#issuecomment-397739206 |
Just in case someone wants to step in. I tried the following (on windows x64):
None worked so far (I'm not sure why they wouldn't) |
Is the only current work-around for issuing SQL commands to shell out to |
I did a little digging into this. I'm doing my digging on macOS in the context of #2320 - I'm using the build script I included in that issue. I modified the custom To this, hard coding the path for the relevant native dll for my platform: type FakeLoadContext (printDetails:Trace.VerboseLevel, dependencies:AssemblyInfo list) =
inherit AssemblyLoadContext()
let allReferences = dependencies
override x.Load(assem:AssemblyName) =
findAndLoadInRuntimeDepsCached x assem printDetails allReferences
override x.LoadUnmanagedDll(unmanagedAssemblyName) =
if unmanagedAssemblyName = "SQLite.Interop.dll" then
base.LoadUnmanagedDllFromPath("/Users/cmager/.nuget/packages/system.data.sqlite.core/1.0.110/runtimes/osx-x64/native/netstandard2.0/SQLite.Interop.dll")
else
base.LoadUnmanagedDll(unmanagedAssemblyName) And now my script runs fine. @matthid does this help with 'step 2' you referred to above? If we had some map of native runtime deps to paths (based on platform), then this looks solvable. |
Yes with this information it should be quite straightforward to solve as the list of native libraries is provided by paket. sadly I can't commit to a specific time frame for a fix for this... |
Now we only need to wait for fsprojects/Paket#3593 to be released for this to work |
I'm closing this: It will be part of the 5.14 release. Note: You need to update the runner to get this feature. Updating your build will not be enough. |
Thanks for fixing, looking forward to getting my FAKE 4 scripts migrated now it works! It seems fsprojects/Paket#3593 has been merged & released now, so hopefully 5.14 isn't too far away. |
@csmager Yes, 5.14 release is triggered.
This only happens on linux/unix therefore I don't think this is a bug in FAKE. I think if you need unix/linux support you need to report a bug to them. If you are already on it you can tell them their package is packaged incorrectly as well :) |
Thanks. It works fine for me on Windows, but I can repro that error on macOS. My hack to get it to work was on macOS & it did seem to work. I'll dig into it and see if I can work out which of SQLite, Paket or FAKE is doing something wrong! Re the packaging, is there do you happen to know where it's how this is supposed to be packaged is documented? |
Ok, the logging shows the file path is correct:
The only difference I guessed was the caching. So I removed it by changing the override x.LoadUnmanagedDll(unmanagedDllName) =
findAndLoadUnmanagedInRuntimeDeps x.LoadUnmanagedDllFromPathHelper unmanagedDllName printDetails nativeLibraries |> fst And now it works fine. So it seems caching the |
Oo that was unexpected, so we should just remove the dictionary and load it every time (we could cache the full path instead)? |
Thanks. I was on the completely wrong path here.
Indeed, thanks for the pointers (pun intended)... I changed the logic slightly and it looks green. I'll wait on the build and start the 5.14.1 release :) |
Thanks. Can't say I fully understand why it didn't work, there seems to be a lack of docs around |
Description
When packages referenced by build scripts have RID specific native library dependencies, those assemblies cannot be loaded at runtime.
Repro steps
Please provide the steps required to reproduce the problem
dotnet new fake
paket.dependencies
build.fsx
fake.cmd build
Expected behavior
Build succeeds (given connection string works, of course)
Actual behavior
Click to see full output
Known workarounds
Providing
--additional-deps
to dotnet cli:I've built an otherwise empty F# console application with
System.Data.SqlClient
reference and removed everything but sni related packages/libraries from itsdeps.json
file.Click to see full extra.deps.json file
Related information
dotnet new fake
The text was updated successfully, but these errors were encountered: