Skip to content

MonoDevelop.VersionControl.Git fails to compile #30

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

Closed
lytico opened this issue Dec 8, 2020 · 31 comments
Closed

MonoDevelop.VersionControl.Git fails to compile #30

lytico opened this issue Dec 8, 2020 · 31 comments
Labels
bug Something isn't working

Comments

@lytico
Copy link
Member

lytico commented Dec 8, 2020

MonoDevelop.VersionControl.Git fails to compile on some distries, eg. plain Ubuntu 20.04, but compiles on some production machines

see discussion before: #28

@lytico lytico changed the title LibGit2Sharp failed to compile MonoDevelop.VersionControl.Git fails to compile Dec 8, 2020
@lytico
Copy link
Member Author

lytico commented Dec 8, 2020

the build process is quite complicated, goes over 4 git-repos.

it tries to compile

<Target Name="BeforeBuild">
<Exec Command="bash build_libgit2.sh" Condition=" '$(Configuration)' == 'DebugGnome' OR '$(Configuration)' == 'ReleaseGnome' " />
</Target>

with this batch, using a git-sha:

pushd ../../../../external/libgit2/
LIBGIT2SHA=`cat ../libgit-binary/libgit2_hash.txt`
SHORTSHA=${LIBGIT2SHA:0:7}
if [[ -d build ]]
then
pushd build
if [[ -n $(ls libgit2-${SHORTSHA}.*) ]]

AND it depends on

<ProjectReference Include="..\..\..\..\external\libgit2sharp\LibGit2Sharp\LibGit2Sharp.csproj">

lets look at it, its in another repo, as of:

dotdevelop/.gitmodules

Lines 16 to 19 in 7603eda

[submodule "main/external/libgit2sharp"]
path = main/external/libgit2sharp
url = git://github.com/dotdevelop/libgit2sharp.git
branch = dotdevelop

and starts to build this proj. I guess the critical parts are here:

https://github.com/dotdevelop/libgit2sharp/blob/dotdevelop/LibGit2Sharp/LibGit2Sharp.csproj#L42-L43

here it generates a part of code, depending on the commit-id of

https://github.com/dotdevelop/libgit-binary/blob/vs-8.0-v0.26.8/libgit2_hash.txt
that should be GitCommitId == 71efcb3

that is this branch: https://github.com/dotdevelop/libgit2/tree/vs-8.0-v0.26.8 , having commit-id 71efcb3

https://github.com/dotdevelop/libgit2sharp/blob/dotdevelop/Targets/CodeGenerator.targets#L17-L28

@lytico
Copy link
Member Author

lytico commented Dec 8, 2020

analysing build on Ubuntu 20.04

the nerdbank.gitversioning-.nuget fails!
nerdbank.gitversioning uses LibGit2Sharp, and this is not working on Ubuntu 20.04
It has "nothing" to do that we are currently compling LibGit2Sharp.csproj.

/home/user/.nuget/packages/nerdbank.gitversioning/3.1.91/build/Nerdbank.GitVersioning.targets(71,5): error MSB4018:
System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: lib/linux-x64/libgit2-106a5f2.so assembly:<unknown assembly> type:<unknown type> member:(null) [/home/user/dotdevelop_oe_8.4.3.12/main/external/libgit2sharp/LibGit2Sharp/LibGit2Sharp.csproj]

changing to version 3.3.37 : same error

/home/user/.nuget/packages/nerdbank.gitversioning/3.3.37/build/Nerdbank.GitVersioning.Inner.targets(17,5): error MSB4018: Unerwarteter Fehler bei der Nerdbank.GitVersioning.Tasks.GetBuildVersion-Aufgabe.
/home/user/.nuget/packages/nerdbank.gitversioning/3.3.37/build/Nerdbank.GitVersioning.Inner.targets(17,5): error MSB4018: System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: libgit2-106a5f2.so assembly:<unknown assembly> type:<unknown type> member:(null)

on my machine, i have installed:
libgit2-26
libgit2-28

no idea, how i got libgit2-26

@lytico
Copy link
Member Author

lytico commented Dec 9, 2020

ok, we're not alone:
dotnet/Nerdbank.GitVersioning#491

@hwthomas
Copy link
Collaborator

hwthomas commented Dec 9, 2020

that's useful to know, at least. The build process does seem very complex however (and I'm in awe at your analysis above). I wonder how necessary this complexity is - the last commits on mono/libgit2sharp were 6 yrs ago, so it seems to be pretty stable...
It also seems that there might be a similar circularity with glade-sharp2. It's needed to build stetic, but it's not part of gtk-sharp, and the only place I could find it was in MonoDevelop 7.8.4 (the last release from monodevelop.com), which is where I copied it from...
I've got libgit2 v1:1.10-1 installed on my main Arch PC, but installing this in the clean Manjaro (or Mint) VM doesn't help things, so it's not that that is getting it to build with 0 errors.

@lytico
Copy link
Member Author

lytico commented Dec 9, 2020

i tried this, a little bit better:

in LibGit2Sharp.csproj using the latest nerdbank:

<PackageReference Include="Nerdbank.GitVersioning" Version="3.4.161-alpha">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>

getting

"/home/user/dotdevelop/main/external/libgit2sharp/LibGit2Sharp/LibGit2Sharp.csproj" (Standardziel) (144) ->
"/home/user/.nuget/packages/nerdbank.gitversioning/3.4.161-alpha/build/Nerdbank.GitVersioning.Inner.targets" (GetBuildVersion_Properties Ziel) (145) ->
(GetBuildVersionCore Ziel) -> 
  /home/user/.nuget/packages/nerdbank.gitversioning/3.4.161-alpha/build/Nerdbank.GitVersioning.Inner.targets(17,5): error MSB4018: Unerwarteter Fehler bei der Nerdbank.GitVersioning.Tasks.GetBuildVersion-Aufgabe.
/home/user/.nuget/packages/nerdbank.gitversioning/3.4.161-alpha/build/Nerdbank.GitVersioning.Inner.targets(17,5): error MSB4018: System.ArgumentException: No git repo found here.
/home/user/.nuget/packages/nerdbank.gitversioning/3.4.161-alpha/build/Nerdbank.GitVersioning.Inner.targets(17,5): error MSB4018: Parameter name: workingDirectory
/home/user/.nuget/packages/nerdbank.gitversioning/3.4.161-alpha/build/Nerdbank.GitVersioning.Inner.targets(17,5): error MSB4018:   at Nerdbank.GitVersioning.Managed.ManagedGitContext..ctor (System.String workingDirectory, System.String dotGitPath, System.String committish) [0x00012] in <285e105c8c844be18548bb41b3502b3e>:0 
/home/user/.nuget/packages/nerdbank.gitversioning/3.4.161-alpha/build/Nerdbank.GitVersioning.Inner.targets(17,5): error MSB4018:   at Nerdbank.GitVersioning.GitContext.Create (System.String path, System.String committish, System.Boolean writable) [0x00011] in <285e105c8c844be18548bb41b3502b3e>:0 
/home/user/.nuget/packages/nerdbank.gitversioning/3.4.161-alpha/build/Nerdbank.GitVersioning.Inner.targets(17,5): error MSB4018:   at Nerdbank.GitVersioning.Tasks.GetBuildVersion.ExecuteInner () [0x0011e] in <d261121dede14f46a78a79df800650d1>:0 
/home/user/.nuget/packages/nerdbank.gitversioning/3.4.161-alpha/build/Nerdbank.GitVersioning.Inner.targets(17,5): error MSB4018:   at MSBuildExtensionTask.ContextAwareTask.Execute () [0x0005e] in <d261121dede14f46a78a79df800650d1>:0 
/home/user/.nuget/packages/nerdbank.gitversioning/3.4.161-alpha/build/Nerdbank.GitVersioning.Inner.targets(17,5): error MSB4018:   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00029] in <17ac7020b8724cc3ab2118010c2e573d>:0 
/home/user/.nuget/packages/nerdbank.gitversioning/3.4.161-alpha/build/Nerdbank.GitVersioning.Inner.targets(17,5): error MSB4018:   at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask) [0x002a9] in <17ac7020b8724cc3ab2118010c2e573d>:0 

@lytico
Copy link
Member Author

lytico commented Dec 9, 2020

a compiling (but not working) solution is here:
https://github.com/dotdevelop/dotdevelop/tree/dotdevelop_oe_8.4.3.12_tryfixVersionControlGit

i replaced project LibGit2Sharp with the package from nuget, and hacked MonoDevelop.VersionControl.Git to compile with it,.

but it crashes when opening a project unter git control

@hwthomas
Copy link
Collaborator

My last comment was misleading, re work on libgit2 and libgit2sharp. The last commits on https://github/mono/libgit2 are indeed 6yrs old, but there is very recent work going on at https://github/libgit2/libgit2 and https://github/libgit2/libgit2sharp. My apologies.

@lytico
Copy link
Member Author

lytico commented Dec 10, 2020

on https://github.com/mono/libgit2sharp/commits/main, they work hard ... this is the branch they use.
and latest commit in the branch used in mono/monodevelop is 1 year: https://github.com/mono/libgit2/commits/vs-8.0-v0.26.8 or this: https://github.com/mono/libgit2/commits/vs-8.0-v0.28.3 seems more recent, as of version number

@lextm
Copy link

lextm commented Dec 16, 2020

Is it possible to disable/remove Git integration at this moment?

I prefer the following,

Both can set a solid ground for future community contributions, and people can move on to,

  • Create packages for Linux distributions
  • Work on other bug fixes or new features
  • Further clean up the code base for .NET 5/6 adoption

@lytico
Copy link
Member Author

lytico commented Dec 16, 2020

yes, I'll make a branch <branch_we_work_on>_NoGit with your pull request #28

@lytico
Copy link
Member Author

lytico commented Jan 4, 2021

i have at least a compiling version here:

https://github.com/dotdevelop/libgit2sharp/actions/runs/460178345

and a package created with this action:

https://github.com/dotdevelop/libgit2sharp/releases/tag/dotdevelop.0.27.0-preview-g5335a181ca

so the next step is to integrate this package & kickout all libgit2sharp-stuff.

the dll's / so's / dynlibs are on nuget in this package:

LibGit2Sharp.NativeBinaries

and sources are here:

https://github.com/dotdevelop/libgit2sharp.nativebinaries

so no need to generate them in MD

@lextm
Copy link

lextm commented Jan 4, 2021

@lytico If the goal is to switch to NuGet package dependency, then why not choose a close enough version from NuGet.org?

@lytico
Copy link
Member Author

lytico commented Jan 4, 2021

LibGit2Sharp for monodevelop is a special one, they have their own tree, and not published as NuGet package, as far as i found (not).
I tried already using one of the Nuget-LibGit2Sharp-Packages (see comment above) in branch https://github.com/dotdevelop/dotdevelop/tree/dotdevelop_oe_8.4.3.12_tryfixVersionControlGit :

<PackageReference Include="LibGit2Sharp" Version="0.27.0-preview-0096" />

it's not working.

LibGit2Sharp.NativeBinaries maybe works from nuget, i'll try it soon

@lytico
Copy link
Member Author

lytico commented Jan 4, 2021

@lytico lytico closed this as completed Jan 4, 2021
@knocte
Copy link
Member

knocte commented Jan 5, 2021

It's a bit confusing to know what's the last commit in this repo, why use new branches all the time?

How about using main from now on? (this way, if one wants to still check out what was the latest monodevelop commit, they can find master instead)

@hwthomas
Copy link
Collaborator

hwthomas commented Jan 5, 2021

Doesn't build for me under Arch or Mint:-

"Restoring packages for /home/hwt/build/dotdevelop_oe_8.6_Gkt3/main/external/Monodevelop.Netcoredbg/MonoDevelop.Debugger.DotNetCore/MonoDevelop.Debugger.DotNetCore.csproj...
The local source '/home/hwt/build/dotdevelop_oe_8.6_Gkt3/.localcache/local-feed' doesn't exist."

I'm also a bit confused - is this still part of the LibGit2Sharp issue, or some different work on Gtk3 (Gkt3?!). And is any further development intended on the 8.1 - 8.4 branches, or does a successful 8.6 branch supercede all previous work?

@lextm
Copy link

lextm commented Jan 5, 2021

@knocte I disagree that work on issues to be put on main/master directly. They should sit on their own branches and then only merged via pull requests (though dotdevelop_oe_8.6_Gkt3 is definitely not a good name).

@hwthomas 8.1-8.4 were created by the original developers to map to VS for Mac releases, so I don't think they should be used by the dotdevelop members for future work. 8.6 might a good option but dotdevelop_oe_8.6_Gkt3 indeed is confusing.

@lytico
Copy link
Member Author

lytico commented Jan 5, 2021

sorry sorry sorry i closed this issue too hasty.

@knocte @hwthomas @lextm

@lytico
Copy link
Member Author

lytico commented Jan 5, 2021

@knocte @hwthomas @lextm
about dotdevelop_oe_8.6_Gkt3:
its a work issue branch (switching to gtk3)
BUT in the process of working on it i found some bugs and resolved it
and later i found a way to switch between GTK2 / GTK3 - development
and later i removed this bug #30, still working in branch dotdevelop_oe_8.6_Gkt3

so what i have to do (and didn't) is to merge this into dotdevelop_oe_8.6 (see: #39)

why? i am not happy with the solution as of the build process:
the solution - why it solves this bug - is kicking out LibGit2Sharp.proj in Main.sln and use a monodevelop-specific package (see: https://github.com/dotdevelop/libgit2sharp/releases/tag/dotdevelop.0.27.0-preview-g5335a181ca)
this script
https://github.com/dotdevelop/dotdevelop/blob/dotdevelop_oe_8.6_Gkt3/fillLocal.sh
has to be called before make or, better, to be integrated in the make - file.
Currently it's called in the workflow directly:

what does it do? In short, it creates a local NuGet-PackageSource (.localcache/local-feed), downloads dotdevelop.0.27.0-preview-g5335a181ca.nupkg and add it into.

a suggestion is to make this on more sub-projects (see: #38)

so, if build integration is solved, branch dotdevelop_oe_8.6_Gkt3 is the best working branch (at the moment) and should merged into dotdevelop_oe_8.6.

i'll keep working on dotdevelop_oe_8.6_Gkt3 to try out/refactoring for switching to Gkt3

@lytico
Copy link
Member Author

lytico commented Jan 5, 2021

@hwthomas on local build, you have to run fillLocal.sh before make.

@knocte
Copy link
Member

knocte commented Jan 5, 2021

@knocte I disagree that work on issues to be put on main/master directly. They should sit on their own branches and then
only merged via pull requests (though dotdevelop_oe_8.6_Gkt3 is definitely not a good name).

I will not be the one disagreeing with working on features in branches. But if instead of dotdevelop_oe_8.6_Gkt3 it had been named something like GitPluginCompilationFix, and created on the developer's fork (instead of this repo), and afterwards offered to be merged into main via a PullRequest, wouldn't it be less confusing?

@vmcbaptista
Copy link

IMHO, if the branch is named like @knocte suggested and all the old remote branches are removed, so that we can have just main, feature and possibly release branches, then we don't need developer's forks.
Currently, it is very hard for a newcomer to understand all these branches. Also, we lack some sort of backlog to understand what are the next steps and in what we can contribute.

@lytico
Copy link
Member Author

lytico commented Jan 5, 2021

i suggest to discuss branching / forking / pull request management in a new issue: #41

@lytico
Copy link
Member Author

lytico commented Jan 5, 2021

@vmcbaptista sort of backlog to understand what are the next steps

current discussion is here: #33

@lytico
Copy link
Member Author

lytico commented Jan 5, 2021

better solution:
replace https://github.com/dotdevelop/dotdevelop/blob/dotdevelop_oe_8.6_Gkt3/fillLocal.sh
with suggestion of

@vmcbaptista publish NuGet packages into a GitHub Package feed

see: #38

@vmcbaptista
Copy link

Another suggestion regarding dependency to LibGit2Sharp. I understand that we can't directly depend on the latest version because we need some new types introduced by mono team. But, from what I understand the branch dotdevelop is far both from main branch of mono and also from master branch of original LibGit2Sharp.
I think we should try to either fork original LibGit2Sharp and introduce the necessary changes, or at least branch from mono's main. The goal is to be as much close as possible to the latest changes of LibGit2Sharp and have all the fixes introduced.

@lytico
Copy link
Member Author

lytico commented Jan 12, 2021

the branch dotdevelop is far both from main branch of mono

no, there are just a few differences from dd/issues/2 to main branch of mono

dotdevelop/libgit2sharp@dotdevelop...mono:master

dotdevelop/libgit2sharp@dd/issues/2...mono:master

but its far away from

dotdevelop/libgit2sharp@dotdevelop...libgit2:master

@vmcbaptista
Copy link

the branch dotdevelop is far both from main branch of mono

no, there are just a few differences from dotdevelop_tryBuild to main branch of mono

ok, then I misunderstood it, please ignore my comment :)

@lytico
Copy link
Member Author

lytico commented Jan 12, 2021

as of #46, i introduced a .nugetfallback - folder to hold unlisted packages. so, https://github.com/dotdevelop/libgit2sharp/releases/tag/dotdevelop.0.27.0-preview-g5335a181ca should be added there and fillLocal.sh can be removed

@vmcbaptista
Copy link

as of #46, i introduced a .nugetfallback - folder to hold unlisted packages. so, https://github.com/dotdevelop/libgit2sharp/releases/tag/dotdevelop.0.27.0-preview-g5335a181ca should be added there and fillLocal.sh can be removed

I argued about github packages under #38, but looks like you got an interesting alternative, I didn't know about this .nugetfallback :)

@lytico lytico added the bug Something isn't working label Jan 13, 2021
@lytico
Copy link
Member Author

lytico commented Jan 13, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants