You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ah, good point. I have never built anything targeted at Mono, so wouldn't know where to start conditionally compiling the included DLL's depending on the target. Doesn't seem like it should be outwith the realm of possibility though.
@nulltoken before you think I don't want to push the changes, it's because I haven't modeled a proper API for credentials. I've written some stubs which work. :P
@nulltoken regarding how I build libgit2sharp inside MD.
For Windows and Mac I build libgit2sharp and copy the binaries to the output directory.
For Linux, I run a slightly modified version of the build.libgit2sharp.sh file to enable ssh. Grab the native binaries output directory and copy paste them.
So, as a noob to this sort of thing, let's say I wanted to run GitVersion, using Mono, on an Ubuntu machine. What would be the process for getting this done?
Ensure that everything in GitVersion itself is Mono Compliant
Make sure the libgit2 native livrary binaries are side-by-side with the libgit2sharp DLLs so you don't have to mess with library resolver path settings. Otherwise, it lgtm.
@Therzok is this same-directory loading a mono extension? The documentation suggests that it simply delegates to dlopen(3) which won't do that unless you have '.' in LD_LIBRARY_PATH or the rpath option is given to the linker, which won't happen by default.
@nulltoken the binaries shouldn't be in kept in the repo, and there's too many variations to reasonably keep them in a single place.
The way to distribute binary libraries on unix is to make use of the package manager for a particular OS of family which can depend on the zlib, openssl, libssh2 and http-parser packages. Otherwise you're either going to have to ship a very limited version of libgit2 or field that kind of support requests.
@carlosmn the way I implemented it in MD is without adding the libgit2 path to LD_LIBRARY_PATH. I have used install_name_tool on the native binaries to use @loader_path, maybe that's why it works. :P
libgit2-69db893.dylib:
libgit2-69db893.dylib (compatibility version 21.0.0, current version 0.21.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
/usr/lib/libssl.0.9.8.dylib (compatibility version 0.9.8, current version 50.0.0)
/usr/lib/libcrypto.0.9.8.dylib (compatibility version 0.9.8, current version 50.0.0)
@loader_path/libssh2.dylib (compatibility version 2.0.0, current version 2.1.0)
/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
The sequence of commands I've used in this was: install_name_tool -id libgit2-69db893.dylib libgit2-69db893.dylib install_name_tool -change <absolute_path_to_libssh2> @loader_path/libssh2.dylib
@carlosmn but on Linux it should justwork™. Linux user reported it worked without any extra effort if the libgit2 binaries are side-by-side with the libgit2sharp dlls.
That shows how you can ship the dependencies of libgit2, but not how mono/LibGit2Sharp.dll knows to load libgit2-abcd.so from the current directory, since doing this should precisely not work unless you take extra steps. Do you have a LibGit2Sharp.dll.config file that lets you do that?
It would be great to have mono support and make GitVersion cross platform. It needs a champion to make this feature happen, if anyone wants to take it on feel free!
Quick heads up. Check @bording's libgit2/libgit2sharp#984. It should help running LibGit2Sharp on non-Windows platform by embedding the Win/Mac OS X/Linux compiled binaries in a separate NuGet package.
I have made an attempt to upgrade to the latest prerelease of LibGit2Sharp to fix this for GitVersionTask, as it broke the build of one of my projects on mono.
Due to a problem with how mono searches for dlls, I had to place them in libNativeBinaries instead of NativeBinaries. There is a discussion about this here: libgit2/libgit2sharp#1170
This has received limited testing, but it works for compiling a medium sized project with mono 4.0.3 on Ubuntu 15.04.
@hazzik NGit is unmaintained, and we switched away from it in MonoDevelop because of various issues that arose when using it. Updating it is not an easy task either.
Activity
JakeGinnivan commentedon Oct 1, 2014
The issue is libgit2 and libgit2sharp. It would have to ship different versions of the native library to work on different operating systems afaik.
I seem to remember there being a thread about this. @nulltoken can probably tell you more
gep13 commentedon Oct 1, 2014
Ah, good point. I have never built anything targeted at Mono, so wouldn't know where to start conditionally compiling the included DLL's depending on the target. Doesn't seem like it should be outwith the realm of possibility though.
nulltoken commentedon Oct 2, 2014
@gep13 Well, LibGit2Sharp actually runs on Mono. But, currently, this requires the user to build his/her own version of libgit2 (See https://github.com/libgit2/libgit2sharp/blob/vNext/build.libgit2sharp.sh).
@Therzok is maintaining a repo for Windows and Mac versions of libgit2 at https://github.com/mono/libgit-binary
However, I'm not sure how many versions of the compiled binaries we should maintain for other *nix plaforms (@carlosmn @ethomson Thoughts?)
Therzok commentedon Oct 2, 2014
I think it's worth mentioning that my versions of the binaries support SSH.
Therzok commentedon Oct 2, 2014
@nulltoken before you think I don't want to push the changes, it's because I haven't modeled a proper API for credentials. I've written some stubs which work. :P
Therzok commentedon Oct 2, 2014
@nulltoken regarding how I build libgit2sharp inside MD.
For Windows and Mac I build libgit2sharp and copy the binaries to the output directory.
For Linux, I run a slightly modified version of the build.libgit2sharp.sh file to enable ssh. Grab the native binaries output directory and copy paste them.
gep13 commentedon Oct 2, 2014
So, as a noob to this sort of thing, let's say I wanted to run GitVersion, using Mono, on an Ubuntu machine. What would be the process for getting this done?
Is that about right? Or am I completely off?
Therzok commentedon Oct 2, 2014
Make sure the libgit2 native livrary binaries are side-by-side with the libgit2sharp DLLs so you don't have to mess with library resolver path settings. Otherwise, it lgtm.
carlosmn commentedon Oct 2, 2014
@Therzok is this same-directory loading a mono extension? The documentation suggests that it simply delegates to
dlopen(3)which won't do that unless you have '.' inLD_LIBRARY_PATHor therpathoption is given to the linker, which won't happen by default.@nulltoken the binaries shouldn't be in kept in the repo, and there's too many variations to reasonably keep them in a single place.
The way to distribute binary libraries on unix is to make use of the package manager for a particular OS of family which can depend on the zlib, openssl, libssh2 and http-parser packages. Otherwise you're either going to have to ship a very limited version of libgit2 or field that kind of support requests.
Therzok commentedon Oct 2, 2014
@carlosmn the way I implemented it in MD is without adding the libgit2 path to LD_LIBRARY_PATH. I have used
install_name_toolon the native binaries to use @loader_path, maybe that's why it works. :PTherzok commentedon Oct 2, 2014
otool -L libgit2-69db893.dylib
Therzok commentedon Oct 2, 2014
The sequence of commands I've used in this was:
install_name_tool -id libgit2-69db893.dylib libgit2-69db893.dylibinstall_name_tool -change <absolute_path_to_libssh2> @loader_path/libssh2.dylibTherzok commentedon Oct 2, 2014
@carlosmn but on Linux it should justwork™. Linux user reported it worked without any extra effort if the libgit2 binaries are side-by-side with the libgit2sharp dlls.
carlosmn commentedon Oct 2, 2014
That shows how you can ship the dependencies of libgit2, but not how mono/
LibGit2Sharp.dllknows to load libgit2-abcd.so from the current directory, since doing this should precisely not work unless you take extra steps. Do you have aLibGit2Sharp.dll.configfile that lets you do that?Therzok commentedon Oct 2, 2014
Simply setting -id to the filename works.
10 remaining items
JakeGinnivan commentedon Feb 15, 2015
It would be great to have mono support and make GitVersion cross platform. It needs a champion to make this feature happen, if anyone wants to take it on feel free!
nulltoken commentedon May 25, 2015
Quick heads up. Check @bording's libgit2/libgit2sharp#984. It should help running LibGit2Sharp on non-Windows platform by embedding the Win/Mac OS X/Linux compiled binaries in a separate NuGet package.
JakeGinnivan commentedon May 28, 2015
That is awesome news @nulltoken. When this drops it would be good to try and get GitVersion running on mac/linux :D
nulltoken commentedon May 28, 2015
@JakeGinnivan That was the plan 😉 I'll keep you updated when it's ready for battlefield testing
nulltoken commentedon May 29, 2015
@JakeGinnivan Latest prerelease package (
0.22.0-pre20150529055949) is waiting for you, Sir!therosco commentedon Jul 1, 2015
Any progress?
JakeGinnivan commentedon Jul 1, 2015
Nope, still up for grabs if anyone wants to have a crack at it
clairernovotny commentedon Sep 9, 2015
👍 would love to see this happen, esp to get Xamarin builds on OSX for iOS working the same as the Windows agents
BeeWarloc commentedon Sep 10, 2015
I have made an attempt to upgrade to the latest prerelease of LibGit2Sharp to fix this for GitVersionTask, as it broke the build of one of my projects on mono.
#638
Due to a problem with how mono searches for dlls, I had to place them in libNativeBinaries instead of NativeBinaries. There is a discussion about this here: libgit2/libgit2sharp#1170
This has received limited testing, but it works for compiling a medium sized project with mono 4.0.3 on Ubuntu 15.04.
hazzik commentedon Nov 25, 2015
What about switching to ngit? As it is fully managed library? @Therzok
Therzok commentedon Nov 25, 2015
@hazzik NGit is unmaintained, and we switched away from it in MonoDevelop because of various issues that arose when using it. Updating it is not an easy task either.
ghuntley commentedon Feb 15, 2016
It seems by the comments on #638 that mono now works on x86/amd64 for Linux.
Mono on OSX remains unresolved.
https://gist.github.com/ghuntley/f7f9a120ab40a69f56e9
using