Tag Archive for 'Mono'

Compiling Firebird 2.1.0 for OSX using Mono 1.2.6

I’m thinking of doing a project with C#, and I’d like to use an embeddable database, so I browsed the interweb and found this interesting project: http://www.firebirdsql.org/. I think this project is one reason Firefox had to change it’s name a second time.

The source distribution for Firebird 2.1.0 has a solution file for building on Windows, and a couple makefiles to build at the command line. The only makefile that might have worked, NETProvider/build/linux/makefile contains odd errors that do not allow me to compile the sources successfully. This is the first error:

make
makefile:40: *** multiple target patterns. Stop.

First, I’m not sure why it’s in there, but it contains a start and end div tag. I’m pretty sure that’s not allowed in a makefile, so you can just remove the start and end tag. Inside the makefile, there are several make rules that span multiple lines, and they are not “continued” properly. The simplest fix is to remove the newlines for each of the rules that span more than one line. For example:

COMMON_RESOURCES =
-resource:${RESOURCES}/isc_error_msg.resources...

Needs to be changed to:

COMMON_RESOURCES = -resource:${RESOURCES}/isc_error_msg.resources...

This has to be repeated for SCHEMA_RESOURCES, and the newlines need to be removed from PROVIDER_FLAGS, PROVIDER_TESTS_FLAGS, the compile line of the UnitTests.dll rule, and the copy command that spans two lines.

Next, move the all: rule down to the targets section. I’m not sure why it’s so high in the makefile.

If you run make at this point, you’ll receive an error:

error CS1566: Error reading resource file `../../source/FirebirdSql/FirebirdSql/Data/Schema/FbMetaData.xml'

The SCHEMA_RESOURCES variable has an extra FirebirdSql in the path to FbMetaData.xml. You need to remove it.


error CS2001: Source file `../../source/FirebirdSql/Data/UnitTest/*.cs' could not be found

This error exists because that path should point to UnitTests. Change the PROVIDER_TESTS_SOURCES variable.

Since i don’t have nunit.framework.dll, I had to compile it and install it. I’m sure you can figure it out with google. I loaded the nunit_VS2005.sln file into Monodevelop and only compiled the nunit.framework.dll assembly, and installed it using gacutil -i nunit.framework.dll.

Next, -reference:System.Transactions.dll needs to be added to the PROVIDER_TESTS_FLAGS variable. Also, -reference:System.Configuration.dll needs to be added to the same variable to fix the error CS0103: The name `ConfigurationManager' does not exist in the current context messages.

After running make again, I got error CS3002: Return type of `FirebirdSql....BuildConnectionStringBuilder()' is not CLS-compliant and two other similar messages. Because I’m not a C# expert, I just googled it, and placed [CLSCompliantAttribute(false)] above all the offending methods in the BaseTests.cs file. You’ll also have to do the same for the offending method in FbConnectionTest.cs. I’m not worried if it’s compliant or not, since I just want to use it with C#.

After all this, it finally complies! Unfortunately, when I try to install it using the gacutil, it refuses:
Failure adding assembly to the cache: Attempt to install an assembly without a strong name.

I added -keyfile:FirebirdSql.Data.FirebirdClient.snk to the end of the FirebirdClient.dll compile command, and everything compiled and installed fine. I haven’t tested the library to tell if it works, but that’ll be another post.

Modified makefile