-
-
Notifications
You must be signed in to change notification settings - Fork 171
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
2.2.10 fails on Ubuntu 16 and 18 #217
Comments
@bording @luqunl @AaronRobinsonMSFT With #215 behind us, this is the next thing that appears as a regression. Interestingly enough, the #216 workaround seems to have somehow made things worse since now all projects on all versions of linux fail (rather than #215 which only failed on some projects). Regarding the LD_DEBUG errors:
Is this because Core CLR linked against linux |
@AArnott Which version of LibGit2Sharp are you using? I would expect Ubuntu 16 to be working without a problem, assuming you're pointing to the to the native library correctly. To support most of the linux distros that .NET Core runs on, you'd need to be using 0.26.0-preview-0027, and then ensure you're loading the correct native library based on the RID. Even if you do that, however, it's known that Ubuntu 18 doesn't work, because it shipped a newer version of curl. We'd need to build another separate library for that. I have a PR open that does that. However, instead of having to keep chasing more and more native binaries, there is another plan brewing to reduce the native dependencies and simplify things as much as possible. So, I would expect 16 to work and 18 to not work. |
@AArnott Can you post the entire LD_DEBUG log? |
I'd rather not depend on an unstable package, but if it resolved the issue I could live with that for a while. Do I need to do the work to load the correct native library, or does libgit2sharp take care of that (or at least offer something to help)?
That's peculiar, since my |
I'd be happy to. But the |
It's probably outputting to stderr, so try using
When I was talking with @tmat about this, the conclusion was that there wasn't really something LibGit2Sharp could do, which is why he ended up adding RID-resolving logic to dotnet/sourcelink.
Hmm, I'm not sure how that would be, unless your Ubuntu 18 instance also had curl3 installed, which it doesn't by default AFAIK. |
I may have added curl, I don't know. But the annoying point to me is that msbuild tasks always have dependency issues and tools tend to work. I may just rewrite my msbuild task to spawn my tool. |
Honestly that might be the best way to handle it. That way you aren't fighting against .NET Core's assembly loading design that doesn't really account for these kind of scenarios. On the other hand, if you don't want to make that change, if you can wait until it's ready, the 2nd option in dotnet/roslyn#29289 (comment) will definitely help simplify this a lot. |
If you do want to keep investigating this, give the stderr redirection a try, because I'd like to see what is actually causing the libgit2 load to fail. |
Here is my LD_DEBUG log file. Your stderr redirection idea worked. LD_DEBUG.zip |
@AArnott Thanks; Here are the relevant lines:
Which version of Ubuntu is the log file from? |
That one is from Linux Mint 19, which I believe is based on Ubuntu 18. |
@AArnott Can you get a file from Ubuntu 16 as well? |
Here is Ubuntu 16: LD_DEBUG.zip |
Looking at the two log files, there are differences. However, the 18 log shows it's trying to use nerdbank.gitversioning 2.1.65 and the 16 log is using 2.2.10, so I don't think we have a fair comparison. I assume 2.2.10 is the one we actually want to see errors from? If so, can you get another 18 log with that version? |
Yes, sorry. I have 3 machines and forgot to keep them in sync, obviously. |
Ok, I believe I see what's going on. In the 2.1.65 log, it's searching for and finding libgit2 in And then failing to load because of the whole curl/OpenSSL problem I would expect to see on an Ubuntu 18-based machine. Note that it appears it found the copy in For the two 2.2.10 logs, different behavior can be seen. It's searching for libgit2, and can't find it. It's looking at That path doesn't include the |
Looking at 59adb4b#diff-c518cf4d2fd4bc942aa8b03d9b8c52ff That makes sense. You're loading LibGit2Sharp into the |
Thanks.
Well now I'm between a rock and a hard place then. P/Invoke only works on Core CLR if I load libgit2sharp into the As for MSBuildFull vs. MSBuildCore, an MSBuild property used to disclose that |
I'm not sure that's possible. That was what @tmat's changes in libgit2/libgit2sharp#1563 were attempting to do (and I had planned on enhancing in libgit2/libgit2sharp#1571), but it turns out that it only works on Windows. To take full control of the native library loading, we'd have to discard |
It seems like it would be worth continuing the investigation into why that would be. Is it something that we can resolve in some way, or is it actually a CoreCLR bug? |
I agree. The CoreCLR bug is still active, but inconclusive at the moment. I don't know any other way to workaround it at the moment.
That's a long PR to search. I haven't made it work yet, but given an |
Maybe this is what you were suggesting @bording, but while it seems I can successfully load the native library on-demand, when it comes to p/invoking, it will try again to load it using the It works on Windows, but not Linux. Given Linux is the only OS that changes the image name to prefix a |
Yes that is the problem I'm referring to. I don't believe the |
I just forcibly renamed it to remove the prefix. It still loaded on demand, but p/invoke did not find it, as you predicted. |
From the log:
It looks for both variations when given |
Yeah, I really wish it worked properly on linux as well, because then I'd be able to finish libgit2/libgit2sharp#1571 and handle all of this internally for you. |
I'm still curious about the repro you have, and how it might be interacting with dotnet/sourcelink. That is the other tool I'm aware of that could also be hitting the problem you're seeing, but AFAIK it's not being seen there. |
There is no interaction, because I'm not using SourceLink on any of these repos. |
Hypothesis confirmed: I have the most trivial hello world C# project that works. I then copied it, and added a P2P to the original. Then when I build the copy, the original builds first (and succeeds) and the second one fails. So perhaps the problem is that once I have loaded libgit2 in one custom assemblyloadcontext, and CoreCLR generates whatever interop stuff it needs for its custom marshaling, subsequently loading it in another assemblyloadcontext causes p/invoke handling to cross wire and fail. |
Ooh! early read on a workaround showed promise. I only create one custom |
Interesting. I wonder if this is a similar issue to what using I'd have to track down the original issues, but IIRC that was added to work around a custom marshaling bug when two different versions of LibGit2Sharp were loaded. In this case, you've still got two different copies of the assembly loaded, but they share the same |
Well, this will be fix number 3 for getting nb.gv working consistently everywhere (which of course used to work, but Ubuntu 18 and other recent Linux versions broke it). I hope the 3rd time's the charm on this. |
Thanks for your help investigating and brainstorming on this, @bording! I really appreciate it. |
Glad to help! I wish this stuff was easier to deal with. Having a native dependency always complicates things. |
Gah! if it's not one failure it's another. Now 2.2.10, which fixed the
dotnet build
failure (but apparently only on Windows) fails on Ubuntu 16 and 18 with this:Repro steps
On a Linux machine (or Linux on Windows) such as Ubuntu 16, 18, or Linux Mint 19:
The output is long, but includes this error:
The text was updated successfully, but these errors were encountered: