[Mono-dev] Cross-compile mono to MIPS SOC w/CodeSourcery 3.93?

87 views
Skip to first unread message

the mad mole

unread,
Mar 28, 2012, 1:53:38 PM3/28/12
to mono-de...@lists.ximian.com
Hello---

I'm trying to cross-compile mono 2.10.2 from the source tarball.  My build machine is an x86 Linux PC running Fedora (could use one of the other distros of that makes things easier).  The target is a SOC with a vanilla MIPS 24Kc core (little-endian, no FPU).

I found some instructions for ARM (http://mono-project.com/Mono%3aARM & http://stackoverflow.com/questions/4955314/cross-compile-mono-for-arm) which I tried to adapt for MIPS, but have come up short.  I'll spare the error messages, but it dies in ./configure.  I believe the root cause is not setting the right combination of environment variables for confogure to properly use the CodeSourcery 3.93 toolchain.

Specifically, I don't see (from looking at the output of ./configure --help) how to override the default x86 headers and libraries, which would be needed in addition to the compiler, linker, etc.  Does anyone have more detailed instructions on how I might accomplish this?  I am not a newbie, but am somewhat new to cross-compiling.  The tutorial information I've been able to find on automake, etc, is very general.

If I get enough hints to pull this off I'll be happy to write up a detailed Wiki by way of compensation.

Thx in advance---

Maadmole
================

_prefix=mips-linux-gnu
export CC=$CSRC_ROOT/${_prefix}-gcc
export CXX=$CSRC_ROOT/${_prefix}-g++
export CPP=$CSRC_ROOT/${_prefix}-cpp

./configure --prefix=/usr/local --disable-mcs-build --host=mipsel --enable-minimal=profiler,debug,logging,soft_debug --without-mcs-docs --disable-mono-debugger

Autif Khan

unread,
Mar 28, 2012, 7:11:53 PM3/28/12
to the mad mole, mono-de...@lists.ximian.com

See of the following config options work for you.

I use them for my embedded mono (x86 and arm)

--disable-mcs-build mono_cv_uscore=no --with-tls=pthread
--with-sigaltstack=no --with-mcs-docs=no
_______________________________________________
Mono-devel-list mailing list
Mono-de...@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Autif Khan

unread,
Mar 28, 2012, 7:21:59 PM3/28/12
to the mad mole, mono-de...@lists.ximian.com

Oh, I also had to apply a few patches - they are included below. The
last one will not be required for 2.10.11

--- mono-2.10.8.1.orig/Makefile.am 2012-01-25 14:24:43.564002232 -0500
+++ mono-2.10.8.1/Makefile.am 2012-01-25 14:25:02.036002218 -0500
@@ -4,10 +4,10 @@
MOONLIGHT_SUBDIRS = $(libgc_dir) eglib/src mono

if CROSS_COMPILING
-SUBDIRS = po $(libgc_dir) eglib mono $(ikvm_native_dir) data runtime
scripts man samples msvc $(docs_dir)
+SUBDIRS = po $(libgc_dir) eglib mono $(ikvm_native_dir) support data
runtime scripts man samples msvc $(docs_dir)
# Keep in sync with SUBDIRS
## 'tools' is not normally built
-DIST_SUBDIRS = po libgc eglib mono ikvm-native data runtime
scripts man samples tools msvc docs
+DIST_SUBDIRS = po libgc eglib mono ikvm-native support data runtime
scripts man samples tools msvc docs
else
if ONLY_MOONLIGHT
SUBDIRS = $(MOONLIGHT_SUBDIRS) runtime

--- mono-2.10.8.1.orig/data/config.in 2012-01-27 09:29:07.072001924 -0500
+++ mono-2.10.8.1/data/config.in 2012-01-27 09:30:59.740001933 -0500
@@ -15,7 +15,7 @@
<dllmap dll="i:msvcrt.dll" target="@LIBC@" os="!windows"/>
<dllmap dll="sqlite" target="@SQLITE@" os="!windows"/>
<dllmap dll="sqlite3" target="@SQLITE3@" os="!windows"/>
- <dllmap dll="libX11" target="@X11@" os="!windows" />
+ <dllmap dll="libX11" target="libX11.so.6" os="!windows" />
<dllmap dll="libcairo-2.dll" target="libcairo.so.2" os="!windows"/>
<dllmap dll="libcairo-2.dll" target="libcairo.2.dylib" os="osx"/>
<dllmap dll="libcups" target="libcups.so.2" os="!windows"/>

--- mono-2.10.8.1.orig/mcs/class/Makefile 2012-01-27 16:20:36.319297999 -0500
+++ mono-2.10.8.1/mcs/class/Makefile 2012-01-27 20:37:30.867593825 -0500
@@ -55,10 +55,8 @@
Novell.Directory.Ldap \
Mono.Security.Win32 \
System.DirectoryServices \
- RabbitMQ.Client \
Mono.Messaging \
System.Messaging \
- Mono.Messaging.RabbitMQ \
System.ServiceProcess \
System.Drawing.Design \
System.Design \

the mad mole

unread,
Apr 4, 2012, 12:06:17 AM4/4/12
to Autif Khan, mono-de...@lists.ximian.com
Thanks for the tips... After some additional futzing, I've gotten very close.  Everything compiles, but native links fail with messages like "librt.so: could not read symbols: File in wrong format".  I determined this is because the "-Wl,-EL" flags I specify for the compiles aren't being passed on to libtool.  libtool is smart enough to pull in the little-endian libraries, but without the link flag it generates this error because it expects everything to be big endian.

When I manually extracted the actual link command line generated by libtool (by removing the --quiet arg) to a script, and manually edited in "-Wl,-EL" I was able to successfully create libmono-2.0.so.1.0.0.  So my question is, anyone know how can I pass link flags into libtool?

TIA --- TMM
Reply all
Reply to author
Forward
0 new messages