{"action":"created","comment":{"url":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/comments/26183316","id":26183316,"diff_hunk":"@@ -1,32 +1,11 @@\n #!/bin/bash\n \n-LIBGIT2SHA=`cat ./LibGit2Sharp/libgit2_hash.txt`\n-SHORTSHA=${LIBGIT2SHA:0:7}\n EXTRADEFINE=\"$1\"\n \n-rm -rf libgit2/build\n-mkdir libgit2/build\n-pushd libgit2/build\n-export _BINPATH=`pwd`\n-\n-cmake -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \\\n-      -DBUILD_CLAR:BOOL=OFF \\\n-      -DUSE_SSH=OFF \\\n-      -DENABLE_TRACE=ON \\\n-      -DLIBGIT2_FILENAME=git2-$SHORTSHA \\\n-      -DCMAKE_OSX_ARCHITECTURES=\"i386;x86_64\" \\\n-      ..\n-cmake --build .\n-\n-export LD_LIBRARY_PATH=$_BINPATH:$LD_LIBRARY_PATH\n-export DYLD_LIBRARY_PATH=$_BINPATH:$DYLD_LIBRARY_PATH\n-\n-popd\n-\n-export MONO_OPTIONS=--debug\n-\n-echo $DYLD_LIBRARY_PATH\n-echo $LD_LIBRARY_PATH\n+# Exporting a dummy value with ':' works around a linux mono bug where it\n+# can't find libgit when the libgit2sharp assembly has been shadow copied.\n+# This appears to only be a problem on linux and not osx.\n+export LD_LIBRARY_PATH=:","path":"build.libgit2sharp.sh","position":33,"original_position":33,"commit_id":"4a0e6cc71336c25a998f8bbcfb56d956f17a4d8b","original_commit_id":"4a0e6cc71336c25a998f8bbcfb56d956f17a4d8b","user":{"login":"bording","id":753669,"avatar_url":"https://avatars.githubusercontent.com/u/753669?v=3","gravatar_id":"","url":"https://api.github.com/users/bording","html_url":"https://github.com/bording","followers_url":"https://api.github.com/users/bording/followers","following_url":"https://api.github.com/users/bording/following{/other_user}","gists_url":"https://api.github.com/users/bording/gists{/gist_id}","starred_url":"https://api.github.com/users/bording/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bording/subscriptions","organizations_url":"https://api.github.com/users/bording/orgs","repos_url":"https://api.github.com/users/bording/repos","events_url":"https://api.github.com/users/bording/events{/privacy}","received_events_url":"https://api.github.com/users/bording/received_events","type":"User","site_admin":false},"body":"I've been playing around with this a bit more, and I think I see what's going on. I wasn't aware that setting LD_LIBRARY_PATH to : would be treated as the current working directory, so adding that bit of info, combined with what I mentioned above, just might fully explain all the behavior I've been seeing!\r\n\r\nWhen no shadow copying is going on, mono's built-in lookup option is finding the native library next to libgit2sharp.dll and loading it, without needing LD_LIBRARY_PATH.\r\n\r\nHowever, when shadow copying is involved, the built-in lookup fails because it's looking in the shadow copy directory, and the native library isn't there.\r\n\r\nIt then has to fall back to the system-level loading, which is where the difference between OS X and linux that I was seeing comes into play. OS X does include the current working directory in its search path, but linux does not.That is why OS X works without having anything extra set.\r\n\r\nLinux, however, needs some extra help, which is where my inadvertent setting of the current working directory value comes in, making it work there too.\r\n\r\nNow, for all of this to be true, that means xbuild has to be changing the current working directory as it is running, and then resetting once it's finished, because the current working directory would have to be set to the directory where the native libraries are sitting for this scenario to be feasible.\r\n\r\nI wasn't aware that it would be doing that, but I suppose it could be. If it is, then all of the behavior I've been seeing is explained. ","created_at":"2015-03-11T01:40:12Z","updated_at":"2015-03-11T01:40:12Z","html_url":"https://github.com/libgit2/libgit2sharp/pull/984#discussion_r26183316","pull_request_url":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/984","_links":{"self":{"href":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/comments/26183316"},"html":{"href":"https://github.com/libgit2/libgit2sharp/pull/984#discussion_r26183316"},"pull_request":{"href":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/984"}}},"pull_request":{"url":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/984","id":30141395,"html_url":"https://github.com/libgit2/libgit2sharp/pull/984","diff_url":"https://github.com/libgit2/libgit2sharp/pull/984.diff","patch_url":"https://github.com/libgit2/libgit2sharp/pull/984.patch","issue_url":"https://api.github.com/repos/libgit2/libgit2sharp/issues/984","number":984,"state":"open","locked":false,"title":"(WIP) Move native binaries into separate NuGet package","user":{"login":"bording","id":753669,"avatar_url":"https://avatars.githubusercontent.com/u/753669?v=3","gravatar_id":"","url":"https://api.github.com/users/bording","html_url":"https://github.com/bording","followers_url":"https://api.github.com/users/bording/followers","following_url":"https://api.github.com/users/bording/following{/other_user}","gists_url":"https://api.github.com/users/bording/gists{/gist_id}","starred_url":"https://api.github.com/users/bording/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bording/subscriptions","organizations_url":"https://api.github.com/users/bording/orgs","repos_url":"https://api.github.com/users/bording/repos","events_url":"https://api.github.com/users/bording/events{/privacy}","received_events_url":"https://api.github.com/users/bording/received_events","type":"User","site_admin":false},"body":"As discussed in #974, here is what I have done so far.\r\n\r\nI'm currently hosting a manually created version of the native binaries package on a myget feed, which I've temporarily added as a solution-level package source, which should let package restore find the package without needing anyone to manually add the package source.\r\n\r\nThere are still several things that need to done still. The primary thing is deciding what to do with how handle the things that were previously being done by the `UpdateLibgit2ToSha.ps1` script:\r\n- Updating `Core\\NativeDllName.cs` (used for the `DllImport` attributes)\r\n- Updating `libgit2_hash.txt` (used by `Version.cs`)\r\n\r\nThese both are related to how naming is currently handled for the native binaries, mainly trying to use the commit hash as part of the name. Since the binary would be coming from outside the project, keeping this aspect in place might be more trouble than it's worth. It might make more sense to just standardize the name.\r\n\r\nI'd also like to look into changing the way `NativeMethod`s is looking for the binary file. Right now, on windows it's digging down into the NativeBinaries subfolder and then the architecture folder. For linux and osx, it's not doing anything special, just letting mono find it in the standard places. \r\n\r\nIs there a reason for needing the subfolders on windows? Why not have `libgit2-x86.dll` and `libgit2-x64.dll` and let them live side by side with `libgit2sharp.dll`? It looks like there would be some mono-specific workaround code that could be removed from `NativeMethods` if we just let all the native binaries live in the same folder!\r\n\r\n","created_at":"2015-02-27T04:40:10Z","updated_at":"2015-03-11T01:40:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"202b9c671b8ec45ebaf5266ce52672b826de9ba8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/984/commits","review_comments_url":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/984/comments","review_comment_url":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/libgit2/libgit2sharp/issues/984/comments","statuses_url":"https://api.github.com/repos/libgit2/libgit2sharp/statuses/4a0e6cc71336c25a998f8bbcfb56d956f17a4d8b","head":{"label":"bording:nativeNuget","ref":"nativeNuget","sha":"4a0e6cc71336c25a998f8bbcfb56d956f17a4d8b","user":{"login":"bording","id":753669,"avatar_url":"https://avatars.githubusercontent.com/u/753669?v=3","gravatar_id":"","url":"https://api.github.com/users/bording","html_url":"https://github.com/bording","followers_url":"https://api.github.com/users/bording/followers","following_url":"https://api.github.com/users/bording/following{/other_user}","gists_url":"https://api.github.com/users/bording/gists{/gist_id}","starred_url":"https://api.github.com/users/bording/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bording/subscriptions","organizations_url":"https://api.github.com/users/bording/orgs","repos_url":"https://api.github.com/users/bording/repos","events_url":"https://api.github.com/users/bording/events{/privacy}","received_events_url":"https://api.github.com/users/bording/received_events","type":"User","site_admin":false},"repo":{"id":30678739,"name":"libgit2sharp","full_name":"bording/libgit2sharp","owner":{"login":"bording","id":753669,"avatar_url":"https://avatars.githubusercontent.com/u/753669?v=3","gravatar_id":"","url":"https://api.github.com/users/bording","html_url":"https://github.com/bording","followers_url":"https://api.github.com/users/bording/followers","following_url":"https://api.github.com/users/bording/following{/other_user}","gists_url":"https://api.github.com/users/bording/gists{/gist_id}","starred_url":"https://api.github.com/users/bording/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bording/subscriptions","organizations_url":"https://api.github.com/users/bording/orgs","repos_url":"https://api.github.com/users/bording/repos","events_url":"https://api.github.com/users/bording/events{/privacy}","received_events_url":"https://api.github.com/users/bording/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bording/libgit2sharp","description":"Git + .Net/Mono = ❤","fork":true,"url":"https://api.github.com/repos/bording/libgit2sharp","forks_url":"https://api.github.com/repos/bording/libgit2sharp/forks","keys_url":"https://api.github.com/repos/bording/libgit2sharp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bording/libgit2sharp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bording/libgit2sharp/teams","hooks_url":"https://api.github.com/repos/bording/libgit2sharp/hooks","issue_events_url":"https://api.github.com/repos/bording/libgit2sharp/issues/events{/number}","events_url":"https://api.github.com/repos/bording/libgit2sharp/events","assignees_url":"https://api.github.com/repos/bording/libgit2sharp/assignees{/user}","branches_url":"https://api.github.com/repos/bording/libgit2sharp/branches{/branch}","tags_url":"https://api.github.com/repos/bording/libgit2sharp/tags","blobs_url":"https://api.github.com/repos/bording/libgit2sharp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bording/libgit2sharp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bording/libgit2sharp/git/refs{/sha}","trees_url":"https://api.github.com/repos/bording/libgit2sharp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bording/libgit2sharp/statuses/{sha}","languages_url":"https://api.github.com/repos/bording/libgit2sharp/languages","stargazers_url":"https://api.github.com/repos/bording/libgit2sharp/stargazers","contributors_url":"https://api.github.com/repos/bording/libgit2sharp/contributors","subscribers_url":"https://api.github.com/repos/bording/libgit2sharp/subscribers","subscription_url":"https://api.github.com/repos/bording/libgit2sharp/subscription","commits_url":"https://api.github.com/repos/bording/libgit2sharp/commits{/sha}","git_commits_url":"https://api.github.com/repos/bording/libgit2sharp/git/commits{/sha}","comments_url":"https://api.github.com/repos/bording/libgit2sharp/comments{/number}","issue_comment_url":"https://api.github.com/repos/bording/libgit2sharp/issues/comments{/number}","contents_url":"https://api.github.com/repos/bording/libgit2sharp/contents/{+path}","compare_url":"https://api.github.com/repos/bording/libgit2sharp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bording/libgit2sharp/merges","archive_url":"https://api.github.com/repos/bording/libgit2sharp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bording/libgit2sharp/downloads","issues_url":"https://api.github.com/repos/bording/libgit2sharp/issues{/number}","pulls_url":"https://api.github.com/repos/bording/libgit2sharp/pulls{/number}","milestones_url":"https://api.github.com/repos/bording/libgit2sharp/milestones{/number}","notifications_url":"https://api.github.com/repos/bording/libgit2sharp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bording/libgit2sharp/labels{/name}","releases_url":"https://api.github.com/repos/bording/libgit2sharp/releases{/id}","created_at":"2015-02-12T01:13:11Z","updated_at":"2015-02-27T04:12:38Z","pushed_at":"2015-03-05T04:08:59Z","git_url":"git://github.com/bording/libgit2sharp.git","ssh_url":"git@github.com:bording/libgit2sharp.git","clone_url":"https://github.com/bording/libgit2sharp.git","svn_url":"https://github.com/bording/libgit2sharp","homepage":"http://libgit2.github.com","size":138210,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"vNext"}},"base":{"label":"libgit2:vNext","ref":"vNext","sha":"a026f5d84e35f1df94bc3f30503429ef8a216209","user":{"login":"libgit2","id":394745,"avatar_url":"https://avatars.githubusercontent.com/u/394745?v=3","gravatar_id":"","url":"https://api.github.com/users/libgit2","html_url":"https://github.com/libgit2","followers_url":"https://api.github.com/users/libgit2/followers","following_url":"https://api.github.com/users/libgit2/following{/other_user}","gists_url":"https://api.github.com/users/libgit2/gists{/gist_id}","starred_url":"https://api.github.com/users/libgit2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/libgit2/subscriptions","organizations_url":"https://api.github.com/users/libgit2/orgs","repos_url":"https://api.github.com/users/libgit2/repos","events_url":"https://api.github.com/users/libgit2/events{/privacy}","received_events_url":"https://api.github.com/users/libgit2/received_events","type":"Organization","site_admin":false},"repo":{"id":1415168,"name":"libgit2sharp","full_name":"libgit2/libgit2sharp","owner":{"login":"libgit2","id":394745,"avatar_url":"https://avatars.githubusercontent.com/u/394745?v=3","gravatar_id":"","url":"https://api.github.com/users/libgit2","html_url":"https://github.com/libgit2","followers_url":"https://api.github.com/users/libgit2/followers","following_url":"https://api.github.com/users/libgit2/following{/other_user}","gists_url":"https://api.github.com/users/libgit2/gists{/gist_id}","starred_url":"https://api.github.com/users/libgit2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/libgit2/subscriptions","organizations_url":"https://api.github.com/users/libgit2/orgs","repos_url":"https://api.github.com/users/libgit2/repos","events_url":"https://api.github.com/users/libgit2/events{/privacy}","received_events_url":"https://api.github.com/users/libgit2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/libgit2/libgit2sharp","description":"Git + .Net/Mono = ❤","fork":false,"url":"https://api.github.com/repos/libgit2/libgit2sharp","forks_url":"https://api.github.com/repos/libgit2/libgit2sharp/forks","keys_url":"https://api.github.com/repos/libgit2/libgit2sharp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/libgit2/libgit2sharp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/libgit2/libgit2sharp/teams","hooks_url":"https://api.github.com/repos/libgit2/libgit2sharp/hooks","issue_events_url":"https://api.github.com/repos/libgit2/libgit2sharp/issues/events{/number}","events_url":"https://api.github.com/repos/libgit2/libgit2sharp/events","assignees_url":"https://api.github.com/repos/libgit2/libgit2sharp/assignees{/user}","branches_url":"https://api.github.com/repos/libgit2/libgit2sharp/branches{/branch}","tags_url":"https://api.github.com/repos/libgit2/libgit2sharp/tags","blobs_url":"https://api.github.com/repos/libgit2/libgit2sharp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/libgit2/libgit2sharp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/libgit2/libgit2sharp/git/refs{/sha}","trees_url":"https://api.github.com/repos/libgit2/libgit2sharp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/libgit2/libgit2sharp/statuses/{sha}","languages_url":"https://api.github.com/repos/libgit2/libgit2sharp/languages","stargazers_url":"https://api.github.com/repos/libgit2/libgit2sharp/stargazers","contributors_url":"https://api.github.com/repos/libgit2/libgit2sharp/contributors","subscribers_url":"https://api.github.com/repos/libgit2/libgit2sharp/subscribers","subscription_url":"https://api.github.com/repos/libgit2/libgit2sharp/subscription","commits_url":"https://api.github.com/repos/libgit2/libgit2sharp/commits{/sha}","git_commits_url":"https://api.github.com/repos/libgit2/libgit2sharp/git/commits{/sha}","comments_url":"https://api.github.com/repos/libgit2/libgit2sharp/comments{/number}","issue_comment_url":"https://api.github.com/repos/libgit2/libgit2sharp/issues/comments{/number}","contents_url":"https://api.github.com/repos/libgit2/libgit2sharp/contents/{+path}","compare_url":"https://api.github.com/repos/libgit2/libgit2sharp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/libgit2/libgit2sharp/merges","archive_url":"https://api.github.com/repos/libgit2/libgit2sharp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/libgit2/libgit2sharp/downloads","issues_url":"https://api.github.com/repos/libgit2/libgit2sharp/issues{/number}","pulls_url":"https://api.github.com/repos/libgit2/libgit2sharp/pulls{/number}","milestones_url":"https://api.github.com/repos/libgit2/libgit2sharp/milestones{/number}","notifications_url":"https://api.github.com/repos/libgit2/libgit2sharp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/libgit2/libgit2sharp/labels{/name}","releases_url":"https://api.github.com/repos/libgit2/libgit2sharp/releases{/id}","created_at":"2011-02-26T16:44:49Z","updated_at":"2015-03-10T21:18:41Z","pushed_at":"2015-03-10T03:47:31Z","git_url":"git://github.com/libgit2/libgit2sharp.git","ssh_url":"git@github.com:libgit2/libgit2sharp.git","clone_url":"https://github.com/libgit2/libgit2sharp.git","svn_url":"https://github.com/libgit2/libgit2sharp","homepage":"http://libgit2.github.com","size":219553,"stargazers_count":738,"watchers_count":738,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":292,"mirror_url":null,"open_issues_count":132,"forks":292,"open_issues":132,"watchers":738,"default_branch":"vNext"}},"_links":{"self":{"href":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/984"},"html":{"href":"https://github.com/libgit2/libgit2sharp/pull/984"},"issue":{"href":"https://api.github.com/repos/libgit2/libgit2sharp/issues/984"},"comments":{"href":"https://api.github.com/repos/libgit2/libgit2sharp/issues/984/comments"},"review_comments":{"href":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/984/comments"},"review_comment":{"href":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/libgit2/libgit2sharp/pulls/984/commits"},"statuses":{"href":"https://api.github.com/repos/libgit2/libgit2sharp/statuses/4a0e6cc71336c25a998f8bbcfb56d956f17a4d8b"}}}}