views:

506

answers:

3

I am trying to statically cross compile Mono for MIPS. I am able to compile Mono, but it is always dynamically linked with it's dependencies, even though I specify static to the compiler.

I wrote a test program and I am able to statically compile it with my toolchain and run it on the target platform. I am not sure if I am missing something or if it isn't possible. I built my toolchain using buildroot.

EDIT

To make things a little more clear, I would like to statically compile mono with it's dependencies. The dependencies that mono rely's on are: GLib, pkg-config, and gettext. I believe GLib is a direct dependency and GLib depends on pkg-config and gettext.

I can post my environment variables and configure command if needed.

+1  A: 

In order to get a fully statically linked Mono you will have to build all it's dependencies (and their dependencies recursively) as static libraries first. Only then you can build a truly static Mono.

lothar
I was afraid this might be the answer. In buildroot, I chose the packages that mono depended on to be built with the toolchain, so they'd be in the lib and bin folders of the toolchain for linking. I just didn't want to have to go through the process without somebody else thinking the same. I will give it a try and report back the steps.
Dale Ragan
+1  A: 

Well, it's been a while since I tried this, but I wanted to report what I learned. For one, I found out that the MIPS processor is 64-bit and not 32-bit like I was initially told for the embedded device that I was targeting. Second, when I was working on this, Mono didn't have MIPS 64-bit support yet. After a little research, I saw that a group at N-iX was porting Mono to support the MIPS 64-bit architecture based off the 32-bit port that was already done. The 64-bit port was being done for a company called SiCortex, Inc. and N-iX was trying to get their patches applied to the main Mono development trunk. You can check this forum thread out for more information. I posted stating I wanted to help with testing, but I never got a response.

As far as statically compiling Mono, I learned that Mono uses libtool for linking it's libraries together. I will need to learn more about this tool, before trying to statically compile. I stopped after learning that Mono didn't support MIPS 64-bit yet. I will also need to see if the 64-bit port patches ever got applied to Mono.

I hope this helps.

Dale Ragan
A: 

On one of the stackoverflow podcasts recently, Miguel said they ported Mono to iPhone, using a lot of static I think. While not 64-bit, it shows nasty things can be done to Mono.

Jakob Eriksson
What they did was statically compile a .NET application, which comes with a lot of draw backs. Close to what I am looking for, but not quite. I am looking to statically compile the Mono runtime. This would negate the need to statically compile a .NET application, because the runtime will be available.
Dale Ragan