How to build Npgsql-2.1.x on linux

357 views
Skip to first unread message

murali...@gmail.com

unread,
Oct 30, 2014, 2:03:31 AM10/30/14
to npgsq...@googlegroups.com
Hi,

Please tell me the step to build Npgsql-2.1.x on linux.

Shay Rojansky

unread,
Oct 30, 2014, 5:24:32 AM10/30/14
to npgsq...@googlegroups.com, murali...@gmail.com
You shouldn't need to build Npgsql yourself - just use the standard nuget mechanism to set up Npgsql in your project.

If you can't use nuget for some reason, you can download the ZIP file with binaries for the .NET version you want.

Murali Krishna

unread,
Oct 30, 2014, 6:03:45 AM10/30/14
to Shay Rojansky, npgsq...@googlegroups.com
Hi,

Earlier we have used mono binaries on linux. Now i have downloaded
npgsql-2.2.1.zip from
(https://github.com/npgsql/npgsql/releases/tag/v2.2.1 ) this link. But
i didn't find any binaries like Npgsql.dll . Please tell me the steps
to generate binaries on linux.
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Npgsql Help" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/npgsql-help/Jjk-FEleJcA/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> npgsql-help...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/npgsql-help/2563c4c4-d3a5-4569-b5f5-4074df781ee5%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Shay Rojansky

unread,
Oct 30, 2014, 6:44:21 AM10/30/14
to npgsq...@googlegroups.com, ro...@roji.org, murali...@gmail.com
Not sure what you downloaded... If you get https://github.com/npgsql/npgsql/releases/download/v2.2.1/Npgsql-2.2.1-net45.zip, you will see Npgsql.dll in there.


On Thursday, October 30, 2014 12:03:45 PM UTC+2, Murali Krishna wrote:
Hi,

Earlier we have used mono binaries on linux. Now i  have downloaded
npgsql-2.2.1.zip from
(https://github.com/npgsql/npgsql/releases/tag/v2.2.1 ) this link. But
i didn't  find any binaries like Npgsql.dll . Please tell me the steps
to generate binaries on linux.

On Thu, Oct 30, 2014 at 2:54 PM, Shay Rojansky <ro...@roji.org> wrote:
> You shouldn't need to build Npgsql yourself - just use the standard nuget
> mechanism to set up Npgsql in your project.
>
> If you can't use nuget for some reason, you can download the ZIP file with
> binaries for the .NET version you want.
>
> On Thursday, October 30, 2014 8:03:31 AM UTC+2, murali...@gmail.com wrote:
>>
>> Hi,
>>
>> Please tell me the step to build Npgsql-2.1.x on linux.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Npgsql Help" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/npgsql-help/Jjk-FEleJcA/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to

Murali Krishna

unread,
Oct 30, 2014, 7:43:25 AM10/30/14
to Shay Rojansky, npgsq...@googlegroups.com
Hi,

Thanks for your quick response.

Up to Npgsql2.0.x series we are using binaries from
Npgsql2.0.14.3-bin-mono2.0.zip file for linux platform and

we are using binaries from 4 zip files i.e Npgsql2.0.14.3-bin-ms.net2.0.zip, Npgsql2.0.14.3-bin-ms.net3.5sp1.zip , Npgsql2.0.14.3-bin-ms.net4.0.zip and Npgsql2.0.14.3-bin-ms.net4.5.zip for windows platform.

From Npgsql2.1.x series onwards i can't able to find any mono zip file and i can able to find only .net related  zip files. 

So no my question is which binaries i have to use for linux platform form Npgsql2.1.x series onwards or i have to generate separate binaries for linux, if yes then what are the steps to generate binaries. 

Murali Krishna

unread,
Oct 30, 2014, 8:35:45 AM10/30/14
to Shay Rojansky, npgsq...@googlegroups.com
On Thu, Oct 30, 2014 at 5:13 PM, Murali Krishna <murali...@gmail.com> wrote:
Hi,

Thanks for your quick response.

Up to Npgsql2.0.x series we are using binaries from
Npgsql2.0.14.3-bin-mono2.0.zip file for linux platform and

we are using binaries from 4 zip files i.e Npgsql2.0.14.3-bin-ms.net2.0.zip, Npgsql2.0.14.3-bin-ms.net3.5sp1.zip , Npgsql2.0.14.3-bin-ms.net4.0.zip and Npgsql2.0.14.3-bin-ms.net4.5.zip for windows platform.

From Npgsql2.1.x series onwards i can't able to find any mono zip file and i can able to find only .net related  zip files. 

So no my question is which binaries i have to use for linux platform form Npgsql2.1.x series onwards or i have to
   Sorry spell mistake no*
   So now my question is which binaries i have to use for linux platform form Npgsql2.1.x series onwards or i have to

Shay Rojansky

unread,
Oct 30, 2014, 9:21:54 AM10/30/14
to npgsq...@googlegroups.com, ro...@roji.org, murali...@gmail.com
Ah, I understand.

We no longer have a mono-specific release - the same release works on both Microsoft .NET and mono. We didn't stop supporting mono, it's just that we release only one binary.

Let me know if you have any issues,

Shay

Murali Krishna

unread,
Oct 31, 2014, 5:10:38 AM10/31/14
to Shay Rojansky, npgsq...@googlegroups.com
Hi,

For Npgsql-2.2.1 version four zip files are available those are Npgsql-2.2.1-net20.zipNpgsql-2.2.1-net35.zipNpgsql-2.2.1-net40.zip and Npgsql-2.2.1-net45.zip. So among those which one i have to use for linux development. What are the difference between net20, net35 , net40 and net45 zip files. 

Shay Rojansky

unread,
Nov 1, 2014, 10:54:27 AM11/1/14
to npgsq...@googlegroups.com, ro...@roji.org, murali...@gmail.com
The four ZIPs are for the 4 .NET versions. It doesn't matter whether your on Microsoft .NET or mono, your project targets .NET 2.0, 3.5, 4.0 or 4.5, and you need to choose the ZIP according to that.

But have you already tried installing Npgsql via nuget? It really is the best way to do it and it takes care of details such as .NET versions...

Murali Krishna

unread,
Nov 3, 2014, 3:50:07 AM11/3/14
to Shay Rojansky, npgsq...@googlegroups.com
Hi,

My intension is to  install Npgsql-2.2.1 on linux. Please clarify my below doubts.

1) How to install  Npgsql-2.2.1 on linux

2) How to test Npgsql connection with PostgreSql-9.3 for this if you have any test case please let me know.


Shay Rojansky

unread,
Nov 3, 2014, 4:12:28 AM11/3/14
to npgsq...@googlegroups.com, ro...@roji.org, murali...@gmail.com
Murali, I think I've explained things several times already.

If you're a newcomer to C#/.NET, please read about nuget - it is the standard mechanism for installing packages, on mono or Microsoft .NET. If the IDE you're using is monodevelop, simply install the Npgsql nuget package in your project.

Once your project is set up with Npgsql, you can write standard ADO.NET code. Some basic samples can be found in our user manual.

Murali Krishna

unread,
Nov 4, 2014, 4:19:14 AM11/4/14
to Shay Rojansky, npgsq...@googlegroups.com
Hi,

I have installed mono-2.10.4 and PostgreSQL-9.4 on my linux box in addition to that i have downloaded Npgsql-2.2.1-net45.zip from http://pgfoundry.org/frs/?group_id=1000140 link and unzip that one.

After that i have copied small C# code from user manual given by you. I got the compilation success but i am getting execution error.

I run the below step for compilation:
[murali@localhost ~]$ /opt/mono-2.10.4/bin/mcs npgsqltest.cs -r:/opt/mono-2.10.4/lib/mono/4.0/System.Data.dll -r:/opt/PostgreSQL/Npgsql/ms.net45/Npgsql.dll

I run the below step for execution:

[murali@localhost ~]$ /opt/mono-2.10.4/bin/mono npgsqltest.exe 

but my execution failed with below error:

Npgsql.NpgsqlConnection doesn't implement interface System.Collections.IEnumerator

Stacktrace:

  at NpgsqlUserManual.Main (string[]) <0x0004b>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <0xffffffff>

Native stacktrace:

/opt/mono-2.10.4/bin/mono() [0x48c786]
/lib64/libpthread.so.0() [0x302ae0f710]
/lib64/libc.so.6(gsignal+0x35) [0x302aa32925]
/lib64/libc.so.6(abort+0x175) [0x302aa34105]
/opt/mono-2.10.4/bin/mono() [0x5cdf02]
/opt/mono-2.10.4/bin/mono() [0x5cdfda]
/opt/mono-2.10.4/bin/mono() [0x48f9e3]
/opt/mono-2.10.4/bin/mono() [0x4906dc]
/opt/mono-2.10.4/bin/mono() [0x490d03]
[0x41eedbba]

Debug info from gdb:

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

Aborted (core dumped)

Please guide me if i am doing anything wrong with any step.







To unsubscribe from this group and all its topics, send an email to npgsql-help...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/npgsql-help/961c779e-fe34-48b8-ba00-64c9d8bf740b%40googlegroups.com.

Shay Rojansky

unread,
Nov 4, 2014, 4:49:59 AM11/4/14
to npgsq...@googlegroups.com, ro...@roji.org, murali...@gmail.com
Murali, first of all, mono 2.10.4 is ancient. Please upgrade to a 3.x version if possible, not sure if this could be the cause of your problems but you should do it regardless.

If you still get the same error, point me to the exact code you're running from our manual.

Murali Krishna

unread,
Nov 4, 2014, 5:02:23 AM11/4/14
to Shay Rojansky, npgsq...@googlegroups.com
Even though i am using mono-3.10.0 i getting the same error.

Below command i am using to know the mono version

[murali@localhost ~]$ /opt/mono/bin/mono --version
Mono JIT compiler version 3.10.0 (tarball Sat Oct  4 15:25:02 UTC 2014)
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 
LLVM:          yes(3.4svn-mono-/)
GC:            sgen

Below are the steps i am using for compilation and execution

[murali@localhost ~]$ /opt/mono/bin/mcs npgsqltest.cs -r:/opt/mono/lib/mono/4.0/System.Data.dll -r:/opt/PostgreSQL/Npgsql/ms.net45/Npgsql.dll 
[murali@localhost ~]$ /opt/mono/bin/mono npgsqltest.exe 

I am written below code in my npgsqltest.cs

using System;
using System.Data;
using Npgsql;

public static class NpgsqlUserManual
{
  public static void Main(String[] args)
  {
    NpgsqlConnection conn = new NpgsqlConnection("Server=127.0.0.1;Port=5432;User Id=postgres;Password=postgres;Database=postgres;");
    conn.Open();
    conn.Close();
  }
}


Shay Rojansky

unread,
Nov 4, 2014, 5:40:41 AM11/4/14
to Murali Krishna, npgsq...@googlegroups.com
Murali, the new Npgsql.dll which you downloaded is in some other directory mono doesn't know about (/opt/PostgreSQL/Npgsql/). It therefore goes to the GAC (global assembly cache) and finds a very old version of Npgsql.dll that mono bundles. But that version is so ancient it causes the error.

Copy your npgsqltest.exe into the directory where you have the new Npgsql.dll which you downloaded and it will fix the problem. This kind of issue can be avoided by using a standard csproj with nuget, which take care of all the copying and referencing for you. Please take a look at monodevelop.

One unrelated  note: you're referencing the .NET 4.0 version of System.Data.dll instead of the .NET 4.5, replace your reference with /opt/mono/lib/mono/4.5/System.Data.dll.

Here's what I think is happening: your new Npgsql.dll is in some directory which mono doesn't know about (
Reply all
Reply to author
Forward
0 new messages