Skip to content
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

Can't build on Ubuntu 18.04 #1202

Closed
akshita31 opened this issue May 24, 2018 · 23 comments · Fixed by #1611
Closed

Can't build on Ubuntu 18.04 #1202

akshita31 opened this issue May 24, 2018 · 23 comments · Fixed by #1611

Comments

@akshita31
Copy link
Contributor

akshita31 commented May 24, 2018

dotnet --info:

.NET Command Line Tools (2.1.200)

Product Information:
 Version:            2.1.200
 Commit SHA-1 hash:  2edba8d7f1

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  18.04
 OS Platform: Linux
 RID:         ubuntu.18.04-x64
 Base Path:   /usr/share/dotnet/sdk/2.1.200/

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.7
  Build    : 2d61d0b043915bc948ebf98836fefe9ba942be11

mono --version :

Mono JIT compiler version 5.12.0.226 (tarball Thu May  3 09:42:09 UTC 2018)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           __thread
	SIGSEGV:       altstack
	Notifications: epoll
	Architecture:  amd64
	Disabled:      none
	Misc:          softdebug 
	Interpreter:   yes
	LLVM:          supported, not enabled.
	GC:            sgen (concurrent by default)

I am using the latest master (Last commit - e850717) . I followed the steps as listed to build omnisharp-roslyn and on running ./build.sh, I get the error:

=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

Error: One or more errors occurred.
	GitVersion: Process returned an error (exit code 134).

Please help.

@DustinCampbell DustinCampbell changed the title build.sh not working Can't build on Ubuntu 18.04 May 24, 2018
@DustinCampbell
Copy link
Contributor

DustinCampbell commented May 24, 2018

I just created a VM and can reproduce the problem. It looks like this is due to GitTools/GitVersion#1408. There are various solutions we could employ to workaround the problem, but I think we should probably just wait until GitVersion is fixed.

@hifall
Copy link

hifall commented Aug 3, 2018

"There are various solutions we could employ to workaround the problem" -- could you please provide one or some of them? This would get me past this issue. Thanks.

@alecStewart1
Copy link

@DustinCampbell could you provide @hifall and I some possible workarounds? I've updated to the most recent master branch and it seems that this issue with GitVersion has yet to be fixed because I'm getting the same error.

@DustinCampbell
Copy link
Contributor

I have not investigated deeply enough to find any workarounds. @david-driscoll, do you have any ideas? It feels like GitVersion is dropping the ball on Linux.

@rchande
Copy link

rchande commented Sep 14, 2018

Obviously this doesn't solve the underlying problem, but if you disable the GitVersion task (https://github.com/OmniSharp/omnisharp-roslyn/blob/master/build.cake#L103), are you able to build? (cc @nickspoons )

@nickspoons
Copy link
Member

nickspoons commented Sep 15, 2018

Thanks @rchande,

I tried removing that line but it doesn't help - on my archlinux machine the build fails before build.cake is even loaded, while "Compiling build script..." (according the the verbose output).

(Note I'm using archlinux in WSL, which I realise is not exactly a clean test environment, but I get very similar logs in a proper archlinux VM)

Here's what I get:

Click to show output of ./build.sh

  $ ./build.sh --target Cleanup --verbosity Verbose

Feeds used:
  /home/nickspoon/.nuget/packages/
  https://api.nuget.org/v3/index.json
  https://dotnet.myget.org/F/dotnet-core/api/v3/index.json

All packages listed in /mnt/c/code/external/omnisharp-roslyn.linux/tools/packages.config are already installed.
Analyzing build script...
Processing build script...
Installing tools...
Installing addins...
Compiling build script...
/proc/self/maps:
7ff50000-80000000 rwxp 00000000 00:00 0
7f4d48000000-7f4d48021000 rw-p 00000000 00:00 0
7f4d48021000-7f4d4c000000 ---p 00000000 00:00 0
7f4d4c000000-7f4d4c021000 rw-p 00000000 00:00 0
7f4d4c021000-7f4d50000000 ---p 00000000 00:00 0
7f4d50000000-7f4d50021000 rw-p 00000000 00:00 0
7f4d50021000-7f4d54000000 ---p 00000000 00:00 0
7f4d54000000-7f4d54021000 rw-p 00000000 00:00 0
7f4d54021000-7f4d58000000 ---p 00000000 00:00 0
7f4d58000000-7f4d58036000 rw-p 00000000 00:00 0
7f4d58036000-7f4d5c000000 ---p 00000000 00:00 0
7f4d5c000000-7f4d5c021000 rw-p 00000000 00:00 0
7f4d5c021000-7f4d60000000 ---p 00000000 00:00 0
7f4d60000000-7f4d60021000 rw-p 00000000 00:00 0
7f4d60021000-7f4d64000000 ---p 00000000 00:00 0
7f4d64000000-7f4d64029000 rw-p 00000000 00:00 0
7f4d64029000-7f4d68000000 ---p 00000000 00:00 0
7f4d68000000-7f4d68021000 rw-p 00000000 00:00 0
7f4d68021000-7f4d6c000000 ---p 00000000 00:00 0
7f4d6c3a0000-7f4d6c3a1000 ---p 00000000 00:00 0
7f4d6c3a1000-7f4d6c5a1000 rw-p 00000000 00:00 0
7f4d6c5b0000-7f4d6c5b1000 ---p 00000000 00:00 0
7f4d6c5b1000-7f4d6c7b1000 rw-p 00000000 00:00 0
7f4d6c7c0000-7f4d6c835000 r--p 00000000 00:00 360375             /usr/lib/libcrypto.so.1.1
7f4d6c835000-7f4d6c9d4000 r-xp 00075000 00:00 360375             /usr/lib/libcrypto.so.1.1
7f4d6c9d4000-7f4d6ca61000 r--p 00214000 00:00 360375             /usr/lib/libcrypto.so.1.1
7f4d6ca61000-7f4d6ca8f000 rw-p 002a0000 00:00 360375             /usr/lib/libcrypto.so.1.1
7f4d6ca8f000-7f4d6ca92000 rw-p 00000000 00:00 0
7f4d6caa0000-7f4d6cabd000 r--p 00000000 00:00 360377             /usr/lib/libssl.so.1.1
7f4d6cabd000-7f4d6cb09000 r-xp 0001d000 00:00 360377             /usr/lib/libssl.so.1.1
7f4d6cb09000-7f4d6cb22000 r--p 00069000 00:00 360377             /usr/lib/libssl.so.1.1
7f4d6cb22000-7f4d6cb23000 ---p 0001d065 00:00 360377             /usr/lib/libssl.so.1.1
7f4d6cb23000-7f4d6cb30000 rw-p 00082000 00:00 360377             /usr/lib/libssl.so.1.1
7f4d6cb80000-7f4d6cb81000 ---p 00000000 00:00 0
7f4d6cb81000-7f4d6cd81000 rw-p 00000000 00:00 0
7f4d6cda0000-7f4d6cda1000 ---p 00000000 00:00 0
7f4d6cda1000-7f4d6cfa1000 rw-p 00000000 00:00 0
7f4d6cfc0000-7f4d6cfc1000 ---p 00000000 00:00 0
7f4d6cfc1000-7f4d6d1c1000 rw-p 00000000 00:00 0
7f4d6d1d0000-7f4d6d1d1000 ---p 00000000 00:00 0
7f4d6d1d1000-7f4d6d3d1000 rw-p 00000000 00:00 0
7f4d6d3e0000-7f4d6d3e1000 ---p 00000000 00:00 0
7f4d6d3e1000-7f4d6d5e1000 rw-p 00000000 00:00 0
7f4d6d5f0000-7f4d6d5f1000 ---p 00000000 00:00 0
7f4d6d5f1000-7f4d6d5f2000 rw-p 00000000 00:00 0
7f4d6d5f2000-7f4d6d5fa000 ---p 00000000 00:00 0
7f4d6d5fa000-7f4d6d7f1000 rw-p 00000000 00:00 0
7f4d6d800000-7f4d6d901000 rw-p 00000000 00:00 0
7f4d6d930000-7f4d6d940000 rwxp 00000000 00:00 0
7f4d6d940000-7f4d6d941000 rw-p 00000000 00:00 0
7f4d6d948000-7f4d6d9b1000 r--p 00000000 00:00 677370             /mnt/c/code/external/omnisharp-roslyn.linux/tools/gitversion.commandline.4.0.0-beta0012/GitVersion.CommandLine/tools/LibGit2Sharp.dll
7f4d6d9b1000-7f4d6da00000 r--p 00000000 00:00 438827             /usr/lib/mono/gac/Microsoft.CSharp/4.0.0.0__b03f5f7f11d50a3a/Microsoft.CSharp.dll
7f4d6da00000-7f4d6da04000 rw-p 00000000 00:00 0
7f4d6da04000-7f4d6dcc7000 r--p 00000000 00:00 439076             /usr/lib/mono/gac/System/4.0.0.0__b77a5c561934e089/System.dll
7f4d6dcc7000-7f4d6ddc0000 r--p 00000000 00:00 438904             /usr/lib/mono/gac/System.Core/4.0.0.0__b77a5c561934e089/System.Core.dll
7f4d6ddc0000-7f4d6ddc1000 ---p 00000000 00:00 0
7f4d6ddc1000-7f4d6ddc2000 rw-p 00000000 00:00 0
7f4d6ddc2000-7f4d6ddca000 ---p 00000000 00:00 0
7f4d6ddca000-7f4d6dfc1000 rw-p 00000000 00:00 0
7f4d6dfd0000-7f4d6e003000 rw-p 00000000 00:00 0
7f4d6e010000-7f4d6e091000 rw-p 00000000 00:00 0
7f4d6e0a0000-7f4d6e0a1000 r--p 00000000 00:00 435257             /usr/lib/mono/4.5/mscorlib.dll.so
7f4d6e0a1000-7f4d6e4ee000 r-xp 00001000 00:00 435257             /usr/lib/mono/4.5/mscorlib.dll.so
7f4d6e4ee000-7f4d6e7ec000 r--p 0044e000 00:00 435257             /usr/lib/mono/4.5/mscorlib.dll.so
7f4d6e7ec000-7f4d6e7ed000 r--p 0074b000 00:00 435257             /usr/lib/mono/4.5/mscorlib.dll.so
7f4d6e7ed000-7f4d6e7ee000 rw-p 0074c000 00:00 435257             /usr/lib/mono/4.5/mscorlib.dll.so
7f4d6e7ee000-7f4d6e815000 rw-p 00000000 00:00 0
7f4d6e81e000-7f4d6ebf0000 r--p 00000000 00:00 435256             /usr/lib/mono/4.5/mscorlib.dll
7f4d6ebf0000-7f4d6fbf0000 rw-p 00000000 00:00 0
7f4d6fbf0000-7f4d6fbf1000 ---p 00000000 00:00 0
7f4d6fbf1000-7f4d703f1000 rw-p 00000000 00:00 0
7f4d70400000-7f4d70801000 rw-p 00000000 00:00 0
7f4d70810000-7f4d70814000 rw-p 00000000 00:00 0
7f4d70820000-7f4d70824000 rw-p 00000000 00:00 0
7f4d70830000-7f4d70831000 rw-p 00000000 00:00 0
7f4d70840000-7f4d70873000 rw-p 00000000 00:00 0
7f4d70879000-7f4d708e0000 r--p 00000000 00:00 677327             /mnt/c/code/external/omnisharp-roslyn.linux/tools/gitversion.commandline.4.0.0-beta0012/GitVersion.CommandLine/tools/GitVersion.exe
7f4d708e0000-7f4d708e1000 rw-p 00000000 00:00 0
7f4d708f0000-7f4d708f4000 rw-p 00000000 00:00 0
7f4d70900000-7f4d70901000 rw-p 00000000 00:00 0
7f4d70910000-7f4d70911000 rw-p 00000000 00:00 0
7f4d70920000-7f4d70921000 rw-p 00000000 00:00 0
7f4d70921000-7f4d70980000 ---p 00000000 00:00 0
7f4d70980000-7f4d70981000 rw-p 00000000 00:00 0
7f4d7098c000-7f4d70c70000 r--p 00000000 00:00 665600             /usr/lib/locale/locale-archive
7f4d70c70000-7f4d70c73000 rw-p 00000000 00:00 0
7f4d70c80000-7f4d70c82000 rw-p 00000000 00:00 0
7f4d70c90000-7f4d70c91000 rw-p 00000000 00:00 0
7f4d70c91000-7f4d70cb3000 r--p 00000000 00:00 357584             /usr/lib/libc-2.28.so
7f4d70cb3000-7f4d70dfe000 r-xp 00022000 00:00 357584             /usr/lib/libc-2.28.so
7f4d70dfe000-7f4d70e4a000 r--p 0016d000 00:00 357584             /usr/lib/libc-2.28.so
7f4d70e4a000-7f4d70e4b000 ---p 00022197 00:00 357584             /usr/lib/libc-2.28.so
7f4d70e4b000-7f4d70e4f000 r--p 001b9000 00:00 357584             /usr/lib/libc-2.28.so
7f4d70e4f000-7f4d70e51000 rw-p 001bd000 00:00 357584             /usr/lib/libc-2.28.so
7f4d70e51000-7f4d70e55000 rw-p 00000000 00:00 0
7f4d70e55000-7f4d70e58000 r--p 00000000 00:00 192881             /usr/lib/libgcc_s.so.1
7f4d70e58000-7f4d70e69000 r-xp 00003000 00:00 192881             /usr/lib/libgcc_s.so.1
7f4d70e69000-7f4d70e6c000 r--p 00014000 00:00 192881             /usr/lib/libgcc_s.so.1
7f4d70e6c000-7f4d70e6d000 ---p 00003014 00:00 192881             /usr/lib/libgcc_s.so.1
7f4d70e6d000-7f4d70e6e000 r--p 00017000 00:00 192881             /usr/lib/libgcc_s.so.1
7f4d70e6e000-7f4d70e6f000 rw-p 00018000 00:00 192881             /usr/lib/libgcc_s.so.1
7f4d70e6f000-7f4d70e75000 r--p 00000000 00:00 357637             /usr/lib/libpthread-2.28.so
7f4d70e75000-7f4d70e84000 r-xp 00006000 00:00 357637             /usr/lib/libpthread-2.28.so
7f4d70e84000-7f4d70e8a000 r--p 00015000 00:00 357637             /usr/lib/libpthread-2.28.so
7f4d70e8a000-7f4d70e8b000 r--p 0001a000 00:00 357637             /usr/lib/libpthread-2.28.so
7f4d70e8b000-7f4d70e8c000 rw-p 0001b000 00:00 357637             /usr/lib/libpthread-2.28.so
7f4d70e8c000-7f4d70e90000 rw-p 00000000 00:00 0
7f4d70e90000-7f4d70e91000 r--p 00000000 00:00 357596             /usr/lib/libdl-2.28.so
7f4d70e91000-7f4d70e92000 r-xp 00001000 00:00 357596             /usr/lib/libdl-2.28.so
7f4d70e92000-7f4d70e93000 r--p 00002000 00:00 357596             /usr/lib/libdl-2.28.so
7f4d70e93000-7f4d70e94000 r--p 00002000 00:00 357596             /usr/lib/libdl-2.28.so
7f4d70e94000-7f4d70e95000 rw-p 00003000 00:00 357596             /usr/lib/libdl-2.28.so
7f4d70ea0000-7f4d70ea2000 r--p 00000000 00:00 357650             /usr/lib/librt-2.28.so
7f4d70ea2000-7f4d70ea6000 r-xp 00002000 00:00 357650             /usr/lib/librt-2.28.so
7f4d70ea6000-7f4d70ea8000 r--p 00006000 00:00 357650             /usr/lib/librt-2.28.so
7f4d70ea8000-7f4d70ea9000 r--p 00007000 00:00 357650             /usr/lib/librt-2.28.so
7f4d70ea9000-7f4d70eaa000 rw-p 00008000 00:00 357650             /usr/lib/librt-2.28.so
7f4d70eb0000-7f4d70ebd000 r--p 00000000 00:00 357603             /usr/lib/libm-2.28.so
7f4d70ebd000-7f4d70f5e000 r-xp 0000d000 00:00 357603             /usr/lib/libm-2.28.so
7f4d70f5e000-7f4d71033000 r--p 000ae000 00:00 357603             /usr/lib/libm-2.28.so
7f4d71033000-7f4d71034000 r--p 00182000 00:00 357603             /usr/lib/libm-2.28.so
7f4d71034000-7f4d71035000 rw-p 00183000 00:00 357603             /usr/lib/libm-2.28.so
7f4d71040000-7f4d71041000 rw-p 00000000 00:00 0
7f4d71050000-7f4d71051000 rw-p 00000000 00:00 0
7f4d71060000-7f4d71061000 r--p 00000000 00:00 357572             /usr/lib/ld-2.28.so
7f4d71061000-7f4d71062000 r--p 00001000 00:00 357572             /usr/lib/ld-2.28.so
7f4d71062000-7f4d71080000 r-xp 00002000 00:00 357572             /usr/lib/ld-2.28.so
7f4d71080000-7f4d71081000 r-xp 00020000 00:00 357572             /usr/lib/ld-2.28.so
7f4d71081000-7f4d71088000 r--p 00021000 00:00 357572             /usr/lib/ld-2.28.so
7f4d71088000-7f4d71089000 r--p 00028000 00:00 357572             /usr/lib/ld-2.28.so
7f4d71089000-7f4d7108a000 r--p 00028000 00:00 357572             /usr/lib/ld-2.28.so
7f4d7108a000-7f4d7108b000 rw-p 00029000 00:00 357572             /usr/lib/ld-2.28.so
7f4d7108b000-7f4d7108c000 rw-p 00000000 00:00 0
7f4d71090000-7f4d71092000 rw-p 00000000 00:00 0
7f4d71097000-7f4d71098000 rw-s 00000000 00:00 603624             /run/shm/mono.21880
7f4d71098000-7f4d710c1000 r--p 00000000 00:00 428305             /usr/bin/mono-sgen
7f4d710c1000-7f4d710c2000 r--p 00029000 00:00 428305             /usr/bin/mono-sgen
7f4d710c2000-7f4d713ac000 r-xp 0002a000 00:00 428305             /usr/bin/mono-sgen
7f4d713ac000-7f4d713ad000 r-xp 00314000 00:00 428305             /usr/bin/mono-sgen
7f4d713ad000-7f4d714cd000 r--p 00315000 00:00 428305             /usr/bin/mono-sgen
7f4d714cd000-7f4d714ce000 r--p 00435000 00:00 428305             /usr/bin/mono-sgen
7f4d714ce000-7f4d714d6000 r--p 00435000 00:00 428305             /usr/bin/mono-sgen
7f4d714d6000-7f4d714da000 rw-p 0043d000 00:00 428305             /usr/bin/mono-sgen
7f4d714da000-7f4d714f0000 rw-p 00000000 00:00 0
7fffd6c58000-7fffd7265000 rw-p 00000000 00:00 0                  [heap]
7fffde981000-7fffde982000 rw-p 00000000 00:00 0                  [stack]
7fffde982000-7fffde98a000 ---p 00000000 00:00 0
7fffde98a000-7fffdf181000 rw-p 00000000 00:00 0
7fffdf809000-7fffdf80a000 r-xp 00000000 00:00 0                  [vdso]

Native stacktrace:

	/usr/bin/mono-sgen(+0xcb17b) [0x7f4d7116317b]
	/usr/bin/mono-sgen(+0x319a0) [0x7f4d710c99a0]
	/usr/lib/libpthread.so.0(+0x123c0) [0x7f4d70e813c0]
	/lib64/ld-linux-x86-64.so.2(+0xd005) [0x7f4d7106d005]
	/lib64/ld-linux-x86-64.so.2(+0x14406) [0x7f4d71074406]
	/usr/lib/libc.so.6(_dl_catch_exception+0x77) [0x7f4d70dc8e77]
	/lib64/ld-linux-x86-64.so.2(+0x13dff) [0x7f4d71073dff]
	/usr/lib/libc.so.6(+0x137371) [0x7f4d70dc8371]
	/usr/lib/libc.so.6(_dl_catch_exception+0x77) [0x7f4d70dc8e77]
	/usr/lib/libc.so.6(_dl_catch_error+0x33) [0x7f4d70dc8f13]
	/usr/lib/libc.so.6(+0x137477) [0x7f4d70dc8477]
	/usr/lib/libc.so.6(__libc_dlopen_mode+0x4a) [0x7f4d70dc851a]
	/usr/lib/libpthread.so.0(+0x129ac) [0x7f4d70e819ac]
	/usr/lib/libpthread.so.0(+0x12bd4) [0x7f4d70e81bd4]
	/usr/lib/libpthread.so.0(__pthread_unwind+0x45) [0x7f4d70e7fcd5]
	/usr/lib/libpthread.so.0(+0x8d19) [0x7f4d70e77d19]
	/usr/bin/mono-sgen(+0x30387a) [0x7f4d7139b87a]
	/usr/bin/mono-sgen(+0x23af6c) [0x7f4d712d2f6c]
	/usr/lib/libpthread.so.0(+0x7a9d) [0x7f4d70e76a9d]
	/usr/lib/libc.so.6(clone+0x43) [0x7f4d70d8ca43]

Debug info from gdb:

(lldb) command source -s 0 '/tmp/mono-gdb-commands.f8ZCHh'
Executing commands in '/tmp/mono-gdb-commands.f8ZCHh'.
(lldb) process attach --pid 21880
error: attach failed: unable to attach

=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

Error: One or more errors occurred.
	GitVersion: Process returned an error (exit code 134).


I've tried adding some debug logging to build.cake but it never gets hit.

@nickspoons
Copy link
Member

nickspoons commented Sep 15, 2018

I managed to get GitVersion working using techniques described here:

  1. Install libgit2, which on my system is done with
    sudo pacman -S libgit2
  2. Edit tools/gitversion.commandline.4.0.0-beta0012/GitVersion.CommandLine/tools/LibGit2Sharp.dll.config to point to the installed libgit2.so
    <configuration>
        <dllmap os="linux" cpu="x86-64" wordsize="64" dll="git2-baa87df" target="/usr/lib/libgit2.so" />
        <dllmap os="osx" cpu="x86,x86-64" dll="git2-baa87df" target="lib/osx/libgit2-baa87df.dylib" />
    </configuration>

I suspect that a build on Ubuntu would now have worked, but on Arch there is no Version, so I had to change build.cake#L51 to the following (added the ? to make Version nullable):

        var version = platform.Version?.ToString();

Following that, I can build! I need the --use-global-dotnet-sdk flag, or the .dotnet/dotnet-install.sh script errors out (again because archlinux uses rolling releases and has no version):

./build.sh --target Quick --verbosity Verbose --use-global-dotnet-sdk

Success!

@rchande
Copy link

rchande commented Sep 17, 2018

@nickspoons Nice! Thanks for sharing your steps here.

@akshita31
Copy link
Contributor Author

@nickspoons I tried following the steps as you mentioned above. I am using Ubuntu 18.04.

Here is my LibGit2Sharp.dll.config file:

<configuration>
 <dllmap os="linux" cpu="x86-64" wordsize="64" dll="git2-baa87df" target="/usr/lib/x86_64-linux-gnu/libgit2.so.0" />
 <dllmap os="osx" cpu="x86,x86-64" dll="git2-baa87df" target="lib/osx/libgit2-baa87df.dylib" />
</configuration>

Now I am getting the following error:

Unhandled Exception:
System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.EntryPointNotFoundException: git_libgit2_init
  at (wrapper managed-to-native) LibGit2Sharp.Core.NativeMethods.git_libgit2_init()
  at LibGit2Sharp.Core.NativeMethods+LibraryLifetimeObject..ctor () [0x00006] in <1a5aafd5a5444cd6a1420741ccbb6f8a>:0 
  at LibGit2Sharp.Core.NativeMethods..cctor () [0x00058] in <1a5aafd5a5444cd6a1420741ccbb6f8a>:0 
   --- End of inner exception stack trace ---
  at LibGit2Sharp.Core.NativeMethods+LibraryLifetimeObject.Finalize () [0x00000] in <1a5aafd5a5444cd6a1420741ccbb6f8a>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.EntryPointNotFoundException: git_libgit2_init
  at (wrapper managed-to-native) LibGit2Sharp.Core.NativeMethods.git_libgit2_init()
  at LibGit2Sharp.Core.NativeMethods+LibraryLifetimeObject..ctor () [0x00006] in <1a5aafd5a5444cd6a1420741ccbb6f8a>:0 
  at LibGit2Sharp.Core.NativeMethods..cctor () [0x00058] in <1a5aafd5a5444cd6a1420741ccbb6f8a>:0 
   --- End of inner exception stack trace ---
  at LibGit2Sharp.Core.NativeMethods+LibraryLifetimeObject.Finalize () [0x00000] in <1a5aafd5a5444cd6a1420741ccbb6f8a>:0 
Error: One or more errors occurred.
	GitVersion: Process returned an error (exit code 255).

@nickspoons
Copy link
Member

I'm not sure sorry @akshita31, I've only got my Arch system to test on currently, but that target of yours (/usr/lib/x86_64-linux-gnu/libgit2.so.0) is quite different to mine (/usr/lib/libgit2.so), do you have a libgit2.so file on your system?

An alternative might be to clone and build LibGit2Sharp.NativeBinaries and use that, as described here: GitTools/GitVersion#1097 (comment)

@tlo-johnson
Copy link
Contributor

tlo-johnson commented Nov 18, 2018

Not sure GitVersion is still an issue but I was able to get past it by running git fetch --unshallow. The issue doesn't seem to be with GitVersion but with the way git clones the repository.

@akshita31
Copy link
Contributor Author

@tadesegha Where do I need to execute this command ?

@tlo-johnson
Copy link
Contributor

tlo-johnson commented Dec 11, 2018

@akshita31 That's a good question. I forget.

I think I ran it within my cloned omnisharp folder. Sadly I can't reproduce the error to confirm. I'll spend some time later on digging into it.

In the case that it helps, here's how I came by running the command. Running build.sh pulls in GitVersion via nuget. I tried running the GitVersion.exe pulled in and got an error. A google search on that error led to running the git fetch --unshallow command.

@nickspoons
Copy link
Member

I have just tried again in a fresh clone. I tried running git fetch --unshallow and got this response:

fatal: --unshallow on a complete repository does not make sense

I then had to go through the same steps described above to get a working build.

The LibGit2Sharp.dll.config step feels like something we ought to be able to automate - would it be possible to add a config option to build.cake to set a path to libgit2.so, which could then be inserted into the config file to override using the version shipped with GitVersion?

@tlo-johnson
Copy link
Contributor

I'm unable to reproduce this. Any chance there's a docker image that displays this behavior?

Here's a GitVersion issue that may be related to this. Perhaps the issue I encountered was slightly different? LibGit2Sharp.NotFoundException

@itn3000
Copy link
Contributor

itn3000 commented Dec 14, 2018

I could resolve DllNotFoundException by installing libcurl3 by apt-get,
but another problem is occured.
downloading dotnet-runtime-1.1.2 was failured because it was not supported in ubuntu-18.04.
Here is error message.

dotnet-install: Downloading link: https://dotnetcli.azureedge.net/dotnet/Runtime/1.1.2/dotnet-runtime-1.1.2-linux-x64.tar.gz
--2018-12-14 10:40:50--  https://dotnetcli.azureedge.net/dotnet/Runtime/1.1.2/dotnet-runtime-1.1.2-linux-x64.tar.gz
Connecting to 172.16.1.238:8080... connected.
Proxy request sent, awaiting response... 404 Not Found
2018-12-14 10:40:51 ERROR 404: Not Found.

dotnet-install: Cannot download: https://dotnetcli.azureedge.net/dotnet/Runtime/1.1.2/dotnet-runtime-1.1.2-linux-x64.tar.gz
dotnet-install: Downloading legacy link: https://dotnetcli.azureedge.net/dotnet/Runtime/1.1.2/dotnet-ubuntu.18.04-x64.1.1.2.tar.gz
--2018-12-14 10:40:51--  https://dotnetcli.azureedge.net/dotnet/Runtime/1.1.2/dotnet-ubuntu.18.04-x64.1.1.2.tar.gz
Connecting to 172.16.1.238:8080... connected.
Proxy request sent, awaiting response... 404 Not Found
2018-12-14 10:40:51 ERROR 404: Not Found.

dotnet-install: Cannot download: https://dotnetcli.azureedge.net/dotnet/Runtime/1.1.2/dotnet-ubuntu.18.04-x64.1.1.2.tar.gz
dotnet_install: Error: Could not find/download: `.NET Core Runtime` with version = 1.1.2
dotnet_install: Error: Refer to: https://aka.ms/dotnet-os-lifecycle for information on .NET Core support
An error occurred when executing task 'InstallDotNetCoreSdk'.

@JulioJu
Copy link
Contributor

JulioJu commented Dec 16, 2018

Hi

Bisect

This error was introduced by

first bad commit: [cae1738] pinned gitversion by @david-driscoll

Possibles solutions

  1. On current master, run $ git revert cae1738feff3266ccea41e9fe3f92419e773c6cf fix the problem.

  2. An other solution seems to replace

#tool "nuget:?package=GitVersion.CommandLine&prerelease&version=4.0.0-beta0012"

by

#tool "nuget:?package=GitVersion.CommandLine"

What do you think about that ?

Note

I've bisected thanks:

git bisect run /tmp/bisect.sh

#!/bin/bash
# -*- coding: UTF8 -*-


git branch -D bisect
git checkout -b bisect
git stash pop
./build.sh --target Quick --verbosity Verbose --use-global-dotnet-sdk
returnValue=$?
git stash
exit "$returnValue"

@rchande
Copy link

rchande commented Dec 17, 2018

@JulioJu Before that commit, our CI machines would pick up the most recent version of the GitVersion nuget package. They shipped a version with a bug and we started getting inexplicable failures in CI. @david-driscoll pinned us to a known working version. That said, @david-driscoll, it looks like the NuGet package isn't officially supported (see https://gitversion.readthedocs.io/en/latest/usage/nuget-library/). Should we be consuming this some other way?

@JulioJu
Copy link
Contributor

JulioJu commented Dec 17, 2018

@rchande @david-driscoll and maybe it could cause errors described at #1363 ?

@amarnath-mishra
Copy link

amarnath-mishra commented Apr 15, 2019

Does anyone found any solution for this ??
I am also getting the same error on Ubuntu 16.04. my LibGit2Sharp.dll.config file is also like @akshita31's only.

@akshita31
Copy link
Contributor Author

@amarnath-mishra I got it to working by changing the path in the libgit2.config.dll to point to the correct path where the libgit2.so existed.

@asbjornu
Copy link

asbjornu commented Jun 27, 2019

Even though @akshita31 provided a fix, I hope that after upgrading to LibGit2Sharp 0.26 in GitTools/GitVersion#1713, this problem should be remedied. Please try the latest build of GitVersion and report back whether it fixes this problem or not.

@ColdSpirit0
Copy link

Cant build it on Manjaro linux. Im followed instruction, was checkout f45056b and changed target libgit, but still have that error:
Error: One or more errors occurred. (GitVersion: Process returned an error (exit code 1).) GitVersion: Process returned an error (exit code 1).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.