Search code examples
c#linuxmonoredhatglibc

Program generated by mkbundle (from C# program) works on Ubuntu, but doesn't work on Redhat


I have written a program on Visual C# 2010 Express on Windows 7, 64 bit. After some struggling, I managed to make it work under my Ubuntu Virtual Machine (32 bit) (Recompiled in MonoDevelop and used mkbundle). Client told me that he has the following version: "Linux version 2.6.18-274.el5.028stab093.2 (root@rhel5-build-x64) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-46))". The command "cat /etc/redhat-release" returns "CentOS release 5.7 (Final)". I have accessed his server, and uploaded the output of mkbundle (which works fine under Ubuntu). The program returned the following error:

$ ./ProgName img.jpg
./ProgName: /lib/libc.so.6: version `GLIBC_2.9' not found (required by ./ProgName)
./ProgName: /lib/libc.so.6: version `GLIBC_2.11' not found (required by ./ProgName)
./ProgName: /lib/libc.so.6: version `GLIBC_2.8' not found (required by ./ProgName)

How do I solve this problem? I have a very little knowledge about Linux systems. I assume that I need to download the libraries given above, but I have the following questions:

  1. If I download these libraries, can it in any way harm the server? I wouldn't want to harm client's server.
  2. Why does a program, which was "mkbundled" need any additional libraries? I used "--static" with mkbundle, and the output is 5.7 mb file, so I thought it already has all necessary libraries inside.

Is there any other way to solve this issue?

EDIT: I think, that maybe if I manage to compile the project on client's server, it would work, but I cannot find mono for this version of Linux. Is there a way to install mono on that system? If not, then what other options do I have? In the worst case, I am thinking of rewriting my program in C++.


Solution

  • In general producing one binary for different linux distros is a painful and difficult endeavour, in particular if you don't know much about linux. The problem is that binary compatibility between distros (or even different versions of the same distro) is rare.

    My suggestion would be to distribute the managed assembly (i.e. not run the program through mkbundle), but I realize there might be good reasons you're not doing it. The other option is to run mkbundle on a system similar to your client's, and ship that version to him.