When I noticed that Novell does not offer RPMS of Mono 2.0 for RedHat Linux, I had a look at the Fedora 10 Beta and found that there is a Mono 2.0 Source RPM:
Update: mono-2.0.1-12.fc10.src.rpm

Because we work with CentOS4/RedHat Enterprise Linux 4, I installed the source package on that system, and tried to build the rpms.

Building the code was fine after I deactivated a couple of dependencies.
But I ran into some problems at the file checking stage. I wondered if I can prevent the build stage to happen again and again. That way I should be able to debug the file list check etc.

Reading the man page, these parameters are interesting:


So with rpmbuild -bl mono.spec I was able to just run the file checking stage.

The errors I got were like this:
rpm build errors: File not found: /var/tmp/mono-2.0-6-root-root/usr/bin/certmgr/usr/bin/chktrust/usr/bin/gacutil/usr/bin/gmcs/usr/bin/mcs/usr/bin/mcs1

But the files do exist in the /var/tmp/mono-2.0-6-root-root/ directory

I finally realised that the problem was caused by the Macros.
see also http://rpm.org/wiki/PackagerDocs/Macros
I had to first add curly brackets to each Macro call:
%{macro parameters}
But even then only the first line of the Macro had an effect.
This command was helpful in the files section to see that the Macros just were not resolved correctly:
%{echo: %{your_macro_here}}

In the end, I ended up adding the missing files to my own mono.spec file.
I also had a look at the last available RedHat spec file from Novell for Mono 1.9.x, and I guess there is a different rpm version for RHEL 4 and RHEL 5.

Here is my modified mono.spec file that works for RHEL4/CentOS4 for Mono 2.0:

Please download the src.rpm file from the Fedora 10 Beta, or later, and install it:
rpm -i mono-2.0-6.fc10.src.rpm
Then copy my modified mono.spec to /usr/src/redhat/SPECS, and build the packages:
rpmbuild -ba mono.spec

Alternatively, here is a zip file with the compiled RPM files for CentOS4/RHEL4:
I cannot guarantuee that it actually works, but feel free to use it for your own experiments!

Building a mono 2.0 RPM for RHEL4/CentOS4
Tagged on:             

2 thoughts on “Building a mono 2.0 RPM for RHEL4/CentOS4

  • April 30, 2009 at 1:26 pm

    Hello i have one question, is there any difference on the Oracle client against regular mono packages ? Because those packages you have build are the only ones I have found that works with a piece of sw our company bought (a proprietary batchserver) and doesnt throw the exception:

    Error: Could not allocate new OCI Handle of type Statement at System.Data.OracleClient.Oci.OciHandle.Allocate (OciHandleType type) [0x00000]

    any other packages newer (2.2, 2.4) or older (1.9.1) thow this error.

    Regards Alois Vopicka

  • April 30, 2009 at 1:32 pm

    Hello Alois,
    I just used the source rpm from the Beta of Fedora 10.
    I don’t know which version that was in the Mono SVN repository.
    You could download and check mono-2.0.1-12.fc10.src.rpm (see link in post) if there are any patches for Oracle.
    Otherwise the best action is probably to report the problem to the Mono project.
    I hope you will find a solution soon,

Comments are closed.