Bug 31290 - Libgit2sharp System.DllNotFoundException: git2-edb2afa, which seems to prevent me to make changes in my files
Summary: Libgit2sharp System.DllNotFoundException: git2-edb2afa, which seems to preven...
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Version Control ()
Version: Trunk
Hardware: PC Linux
: --- normal
Target Milestone: master
Assignee: Marius Ungureanu
URL:
Depends on:
Blocks:
 
Reported: 2015-06-22 11:14 UTC by Andres G. Aragoneses
Modified: 2015-06-22 13:44 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Andres G. Aragoneses 2015-06-22 11:14:19 UTC
Just pulled master today (been some weeks ago since I didn't test the last), and got this when opening a solution:

ERROR [2015-06-22 17:11:42Z]: File can't be written
System.TypeInitializationException: An exception was thrown by the type initializer for LibGit2Sharp.Core.NativeMethods ---> System.DllNotFoundException: git2-edb2afa
  at (wrapper managed-to-native) LibGit2Sharp.Core.NativeMethods:git_libgit2_init ()
  at LibGit2Sharp.Core.NativeMethods+LibraryLifetimeObject..ctor () [0x00007] in /home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/external/libgit2sharp/LibGit2Sharp/Core/NativeMethods.cs:33 
  at LibGit2Sharp.Core.NativeMethods..cctor () [0x0005c] in /home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/external/libgit2sharp/LibGit2Sharp/Core/NativeMethods.cs:79 
  --- End of inner exception stack trace ---
  at LibGit2Sharp.Core.Proxy+<git_repository_discover>c__AnonStoreyE.<>m__0 (LibGit2Sharp.Core.Handles.GitBuf buf) [0x00009] in /home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/external/libgit2sharp/LibGit2Sharp/Core/Proxy.cs:2048 
  at LibGit2Sharp.Core.Proxy.ConvertPath (System.Func`2 pathRetriever) [0x0000a] in /home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/external/libgit2sharp/LibGit2Sharp/Core/Proxy.cs:3089 
  at LibGit2Sharp.Core.Proxy.git_repository_discover (LibGit2Sharp.Core.FilePath start_path) [0x0001a] in /home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/external/libgit2sharp/LibGit2Sharp/Core/Proxy.cs:2048 
  at LibGit2Sharp.Repository.Discover (System.String startingPath) [0x00007] in /home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/external/libgit2sharp/LibGit2Sharp/Repository.cs:556 
  at MonoDevelop.VersionControl.Git.GitRepository..ctor (MonoDevelop.VersionControl.VersionControlSystem vcs, FilePath path, System.String url) [0x00042] in /home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitRepository.cs:65 
  at MonoDevelop.VersionControl.Git.GitVersionControl.GetRepositoryReference (FilePath path, System.String id) [0x0002a] in /home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitVersionControl.cs:50 
  at MonoDevelop.VersionControl.VersionControlService.GetRepositoryReference (System.String path, System.String id) [0x0009e] in /home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlService.cs:231 
  at MonoDevelop.VersionControl.VersionControlService.GetRepository (IWorkspaceObject entry) [0x00050] in /home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlService.cs:199 
  at MonoDevelop.VersionControl.Git.GitNodeBuilderExtension.OnNodeAdded (System.Object dataObject) [0x00009] in /home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitNodeBuilderExtension.cs:75 
  at MonoDevelop.Ide.Gui.Components.ExtensibleTreeView.RegisterNode (TreeIter it, System.Object dataObject, MonoDevelop.Ide.Gui.Components.NodeBuilder[] chain, Boolean fireAddedEvent) [0x00055] in /home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/ExtensibleTreeView.cs:1532
Comment 1 Marius Ungureanu 2015-06-22 11:15:48 UTC
Heya!

Can you please rm -rf external/libgit2/build? It seems that you have outdated dylibs from a non-working version.

Thanks!
Comment 2 Andres G. Aragoneses 2015-06-22 11:19:59 UTC
Now I got:

ERROR [2015-06-22 17:18:31Z]: An unhandled exception has occured. Terminating MonoDevelop? True
System.TypeInitializationException: An exception was thrown by the type initializer for LibGit2Sharp.Core.NativeMethods ---> System.DllNotFoundException: git2-edb2afa
  at (wrapper managed-to-native) LibGit2Sharp.Core.NativeMethods:git_libgit2_init ()
  at LibGit2Sharp.Core.NativeMethods+LibraryLifetimeObject..ctor () [0x00007] in /home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/external/libgit2sharp/LibGit2Sharp/Core/NativeMethods.cs:33 
  at LibGit2Sharp.Core.NativeMethods..cctor () [0x0005c] in /home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/external/libgit2sharp/LibGit2Sharp/Core/NativeMethods.cs:79 
  --- End of inner exception stack trace ---
  at LibGit2Sharp.Core.Proxy+<git_repository_discover>c__AnonStoreyE.<>m__0 (LibGit2Sharp.Core.Handles.GitBuf buf) [0x00009] in /home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/external/libgit2sharp/LibGit2Sharp/Core/Proxy.cs:2048 
  at LibGit2Sharp.Core.Proxy.ConvertPath (System.Func`2 pathRetriever) [0x0000a] in /home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/external/libgit2sharp/LibGit2Sharp/Core/Proxy.cs:3089 
  at LibGit2Sharp.Core.Proxy.git_repository_discover (LibGit2Sharp.Core.FilePath start_path) [0x0001a] in /home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/external/libgit2sharp/LibGit2Sharp/Core/Proxy.cs:2048 
  at LibGit2Sharp.Repository.Discover (System.String startingPath) [0x00007] in /home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/external/libgit2sharp/LibGit2Sharp/Repository.cs:556 
  at MonoDevelop.VersionControl.Git.GitRepository..ctor (MonoDevelop.VersionControl.VersionControlSystem vcs, FilePath path, System.String url) [0x00042] in /home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitRepository.cs:65 
  at MonoDevelop.VersionControl.Git.GitVersionControl.GetRepositoryReference (FilePath path, System.String id) [0x0002a] in /home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitVersionControl.cs:50 
  at MonoDevelop.VersionControl.VersionControlService.GetRepositoryReference (System.String path, System.String id) [0x0009e] in /home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlService.cs:231 
  at MonoDevelop.VersionControl.VersionControlService.GetRepository (IWorkspaceObject entry) [0x00050] in /home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlService.cs:199 
  at MonoDevelop.VersionControl.Git.GitNodeBuilderExtension.OnNodeAdded (System.Object dataObject) [0x00009] in /home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitNodeBuilderExtension.cs:75 
  at MonoDevelop.Ide.Gui.Components.ExtensibleTreeView.RegisterNode (TreeIter it, System.Object dataObject, MonoDevelop.Ide.Gui.Components.NodeBuilder[] chain, Boolean fireAddedEvent) [0x00055] in /home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/ExtensibleTreeView.cs:1532 


And MonoDevelop still doesn't let me edit my .cs files.
Comment 3 Marius Ungureanu 2015-06-22 11:20:46 UTC
Wait, did you rebuild the MonoDevelop.VersionControl.Git project? Since the copying of the libraries happens on building that project.
Comment 4 Andres G. Aragoneses 2015-06-22 11:22:00 UTC
> did you rebuild the MonoDevelop.VersionControl.Git project?

I guess I did, because I typed "make" after removing that directory, and before running "make run".
Comment 5 Marius Ungureanu 2015-06-22 11:22:38 UTC
Did you see any sequence of commands running `cmake` on libgit2?
Comment 6 Andres G. Aragoneses 2015-06-22 11:28:05 UTC
This is a fragment of the log file when typing make, it seems that the cmake build is started as part of the xbuild build, but it fails, and xbuild doesn't detect the failure so it goes on and reports success:

		Done building project "/home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/src/addins/AspNet/MonoDevelop.AspNet.csproj".
		Project "/home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git.csproj" (default target(s)):
			Target BeforeBuild:
				Executing: bash build_libgit2.sh
				/home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/external/libgit2 /home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git
				/home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/external/libgit2/build /home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/external/libgit2 /home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git
				-- The C compiler identification is GNU 4.8.4
				-- Check for working C compiler: /usr/bin/cc
				-- Check for working C compiler: /usr/bin/cc -- works
				-- Detecting C compiler ABI info
				-- Detecting C compiler ABI info - done
				-- Found PkgConfig: /usr/bin/pkg-config (found version "0.26") 
				-- Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing:  OPENSSL_LIBRARIES OPENSSL_INCLUDE_DIR) 
				-- Could NOT find HTTP_Parser (missing:  HTTP_PARSER_INCLUDE_DIR HTTP_PARSER_LIBRARY) 
				-- http-parser was not found or is too old; using bundled 3rd-party sources.
				-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.8") 
				-- checking for module 'libssh2'
				--   found libssh2, version 1.4.3
				-- Looking for gcrypt in ssh2
				-- Looking for gcrypt in ssh2 - not found
				CMake Error at /usr/share/cmake-2.8/Modules/CheckLibraryExists.cmake:41 (try_compile):
				  Unknown extension "" for file
				    COMPILE_DEFINITIONS
				  try_compile() works only for enabled languages.  Currently these are:
				    C
				  See project() command to enable other languages.
				Call Stack (most recent call first):
				  CMakeLists.txt:285 (CHECK_LIBRARY_EXISTS)
				-- Performing Test IS_FVISIBILITY=HIDDEN_SUPPORTED
				-- Performing Test IS_FVISIBILITY=HIDDEN_SUPPORTED - Success
				-- Performing Test IS_WNO-MISSING-FIELD-INITIALIZERS_SUPPORTED
				-- Performing Test IS_WNO-MISSING-FIELD-INITIALIZERS_SUPPORTED - Success
				-- Performing Test IS_WSTRICT-ALIASING=2_SUPPORTED
				-- Performing Test IS_WSTRICT-ALIASING=2_SUPPORTED - Success
				-- Performing Test IS_WSTRICT-PROTOTYPES_SUPPORTED
				-- Performing Test IS_WSTRICT-PROTOTYPES_SUPPORTED - Success
				-- Performing Test IS_WDECLARATION-AFTER-STATEMENT_SUPPORTED
				-- Performing Test IS_WDECLARATION-AFTER-STATEMENT_SUPPORTED - Success
				-- Performing Test IS_WNO-UNUSED-CONST-VARIABLE_SUPPORTED
				-- Performing Test IS_WNO-UNUSED-CONST-VARIABLE_SUPPORTED - Failed
				-- Performing Test IS_WNO-UNUSED-FUNCTION_SUPPORTED
				-- Performing Test IS_WNO-UNUSED-FUNCTION_SUPPORTED - Success
				-- Looking for include file pthread.h
				-- Looking for include file pthread.h - found
				-- Looking for pthread_create
				-- Looking for pthread_create - not found
				-- Looking for pthread_create in pthreads
				-- Looking for pthread_create in pthreads - not found
				-- Looking for pthread_create in pthread
				-- Looking for pthread_create in pthread - found
				-- Found Threads: TRUE  
				-- Looking for clock_gettime in rt
				-- Looking for clock_gettime in rt - found
				-- Configuring incomplete, errors occurred!
				See also "/home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/external/libgit2/build/CMakeFiles/CMakeOutput.log".
				See also "/home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/external/libgit2/build/CMakeFiles/CMakeError.log".
				make[3]: Entering directory `/home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/external/libgit2/build'
				make[3]: Leaving directory `/home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/external/libgit2/build'
				make[3]: *** No targets specified and no makefile found.  Stop.
				/home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/external/libgit2 /home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git
				/home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git
			Target PrepareForBuild:
				Configuration: DebugGnome Platform: AnyCPU
			Target GenerateSatelliteAssemblies:
			No input files were specified for target GenerateSatelliteAssemblies, skipping.
			Target GenerateTargetFrameworkMonikerAttribute:
			Skipping target "GenerateTargetFrameworkMonikerAttribute" because its outputs are up-to-date.
			Target CoreCompile:
			Skipping target "CoreCompile" because its outputs are up-to-date.
		Done building project "/home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git.csproj".
		Project "/home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Unix/MonoDevelop.VersionControl.Subversion.Unix.csproj" (default target(s)):
			Target PrepareForBuild:
				Configuration: Debug Platform: AnyCPU
			Target GenerateSatelliteAssemblies:
			No input files were specified for target GenerateSatelliteAssemblies, skipping.
			Target GenerateTargetFrameworkMonikerAttribute:
			Skipping target "GenerateTargetFrameworkMonikerAttribute" because its outputs are up-to-date.
			Target CoreCompile:
			Skipping target "CoreCompile" because its outputs are up-to-date.
			Target _CopyDeployFilesToOutputDirectoryPreserveNewest:
			Skipping target "_CopyDeployFilesToOutputDirectoryPreserveNewest" because its outputs are up-to-date.
		Done building project "/home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Unix/MonoDevelop.VersionControl.Subversion.Unix.csproj".
		Project "/home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/src/addins/CSharpBinding/Autotools/Autotools.csproj" (default target(s)):
			Target PrepareForBuild:
				Configuration: Debug Platform: AnyCPU
			Target GenerateSatelliteAssemblies:
			No input files were specified for target GenerateSatelliteAssemblies, skipping.
			Target GenerateTargetFrameworkMonikerAttribute:
			Skipping target "GenerateTargetFrameworkMonikerAttribute" because its outputs are up-to-date.
			Target CoreCompile:
			Skipping target "CoreCompile" because its outputs are up-to-date.
		Done building project "/home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/src/addins/CSharpBinding/Autotools/Autotools.csproj".
Comment 7 Marius Ungureanu 2015-06-22 11:29:54 UTC
Can you try the latest master? I updated it to include a fix from @directhex.
Comment 8 Andres G. Aragoneses 2015-06-22 11:36:33 UTC
cmake seems to build properly now:

				-- The C compiler identification is GNU 4.8.4
				-- Check for working C compiler: /usr/bin/cc
				-- Check for working C compiler: /usr/bin/cc -- works
				-- Detecting C compiler ABI info
				-- Detecting C compiler ABI info - done
				-- Found PkgConfig: /usr/bin/pkg-config (found version "0.26") 
				-- Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing:  OPENSSL_LIBRARIES OPENSSL_INCLUDE_DIR) 
				-- Could NOT find HTTP_Parser (missing:  HTTP_PARSER_INCLUDE_DIR HTTP_PARSER_LIBRARY) 
				-- http-parser was not found or is too old; using bundled 3rd-party sources.
				-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.8") 
				-- checking for module 'libssh2'
				--   found libssh2, version 1.4.3
				-- Looking for libssh2_userauth_publickey_frommemory in ssh2;gcrypt
				-- Looking for libssh2_userauth_publickey_frommemory in ssh2;gcrypt - not found
				-- Performing Test IS_FVISIBILITY=HIDDEN_SUPPORTED
				-- Performing Test IS_FVISIBILITY=HIDDEN_SUPPORTED - Success
				-- Performing Test IS_WNO-MISSING-FIELD-INITIALIZERS_SUPPORTED
				-- Performing Test IS_WNO-MISSING-FIELD-INITIALIZERS_SUPPORTED - Success
				-- Performing Test IS_WSTRICT-ALIASING=2_SUPPORTED
				-- Performing Test IS_WSTRICT-ALIASING=2_SUPPORTED - Success
				-- Performing Test IS_WSTRICT-PROTOTYPES_SUPPORTED
				-- Performing Test IS_WSTRICT-PROTOTYPES_SUPPORTED - Success
				-- Performing Test IS_WDECLARATION-AFTER-STATEMENT_SUPPORTED
				-- Performing Test IS_WDECLARATION-AFTER-STATEMENT_SUPPORTED - Success
				-- Performing Test IS_WNO-UNUSED-CONST-VARIABLE_SUPPORTED
				-- Performing Test IS_WNO-UNUSED-CONST-VARIABLE_SUPPORTED - Failed
				-- Performing Test IS_WNO-UNUSED-FUNCTION_SUPPORTED
				-- Performing Test IS_WNO-UNUSED-FUNCTION_SUPPORTED - Success
				-- Looking for include file pthread.h
				-- Looking for include file pthread.h - found
				-- Looking for pthread_create
				-- Looking for pthread_create - not found
				-- Looking for pthread_create in pthreads
				-- Looking for pthread_create in pthreads - not found
				-- Looking for pthread_create in pthread
				-- Looking for pthread_create in pthread - found
				-- Found Threads: TRUE  
				-- Looking for clock_gettime in rt
				-- Looking for clock_gettime in rt - found
				-- Configuring done
				-- Generating done
				-- Build files have been written to: /home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/external/libgit2/build
				make[3]: Entering directory `/home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/external/libgit2/build'
				make[4]: Entering directory `/home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/external/libgit2/build'
				make[5]: Entering directory `/home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/external/libgit2/build'
				Scanning dependencies of target git2
				make[5]: Leaving directory `/home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/external/libgit2/build'
				make[5]: Entering directory `/home/knocte/Documents/Code/OpenSource/monodevelopLAST/main/external/libgit2/build'
				[  0%] Building C object CMakeFiles/git2.dir/src/message.c.o
				[  1%] Building C object CMakeFiles/git2.dir/src/refspec.c.o
				[  2%] Building C object CMakeFiles/git2.dir/src/checkout.c.o
				[  3%] Building C object CMakeFiles/git2.dir


Let's see what's the result...
Comment 9 Andres G. Aragoneses 2015-06-22 11:39:13 UTC
Ok, the exceptions are gone now, but I still can't edit my .cs files, so I guess the two problems were not related with each other?
Comment 10 Andres G. Aragoneses 2015-06-22 11:46:21 UTC
I've copied my project outside of the git repo, and opened it, and it works, so this is definitely VersionControl.Git-related.

BTW, when I open the solution, MD tells me straight away:
"A fatal error has occurred

Details of this error have been automatically sent to Xamarin for analysis. MonoDevelop will now close."
Comment 11 Andres G. Aragoneses 2015-06-22 11:48:41 UTC
> Ok, the exceptions are gone now

I take that back, the DllNotFoundExceptions are still happening, sorry (although your fix seems to have fixed the cmake build, as stated in comment#8, which is good, but not good enough).
Comment 12 Marius Ungureanu 2015-06-22 13:44:51 UTC
Fixed in master.