Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Mar 2005 12:39:30 +0100
From:      Michael Hopkins <michael.hopkins@hopkins-research.com>
To:        Axel Gonzalez <loox@e-shell.net>, "freebsd-amd64@freebsd.org" <freebsd-amd64@freebsd.org>
Cc:        freebsd-emulation@freebsd.org
Subject:   Re: Cross-compiling/porting to Linux
Message-ID:  <BE704E82.36B2F%michael.hopkins@hopkins-research.com>
In-Reply-To: <200503292222.39751.loox@e-shell.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On 30/3/05 5:22 am, "Axel Gonzalez" <loox@e-shell.net> wrote:

> On Tuesday 29 March 2005 05:32, Michael Hopkins wrote:
>> Hi all
>>=20
>> I have just installed mingwin32 from the ports and it works beautifully =
-
>> can now port all my Unix command line code (including linking to win32
>> libraries) to win32 with the flick of a make switch.  Marvellous!
>=20
> Glad to know it works now.. I should have checked more often
>=20
Hi Axel

Seems to work well but not tested exhaustively across different code and
Windows versions yet.

>>=20
>> Now to linux...  I haven't tried any of the linux compatibility stuff ye=
t,
>> either for running binaries or cross-compiling.  I thought I would ask h=
ere
>> first because I have seen quite a few messages suggesting potential issu=
es
>> on amd64.
>>=20
>> At the moment I am mainly interested in cross-compiling and wanting to
>> target 32-bit linux, but obviously 64-bit will be useful in the future.
>> Would like to get some advice on what to install and any kernel
>> configuration or module loading that I might need to do.
>=20
> This should be well documented elsewhere, if i remember correctly:
>=20
> on kernel, add the options:
>=20
> options         LINPROCFS
> options         COMPAT_43
> options         COMPAT_LINUX32
>=20
> Install the emulators/linux_base-8 port
>=20
> and enable on rc.conf
>=20
> linux_enable=3D"YES"
>=20
> After that you should have a running linux enviroment
>=20
> $ /compat/linux/bin/bash
> $ uname -a
> Linux moonlight 2.4.2 FreeBSD 5.3-STABLE #0: Thu Feb  3 23:08:02 CST 2005
> amd64 amd64 amd64 GNU/Linux
>=20
Did exactly these steps and got this far at 4:30am this morning!  :o}

root@Athlon ~ # cd /compat/linux/bin
root@Athlon /compat/linux/bin # ./uname -a
Linux Athlon 2.4.2 FreeBSD 5.3-RELEASE-p5 #2: Wed Mar 30 01:46:52 BST 2005
amd64 amd64 amd64 GNU/Linux

>=20
> Then, the real thing, the cross compile
>=20
> NOTE: At this point I'm guessing, tell us if it works ;)
>=20
> Get a GCC RPM and install it (check the Makefile on the linux port, to se=
e the
> flags it uses, and see you dont overwrite system GCC)
>=20
This is where I got badly stuck, though I might have the answer - see below=
.
=20
I first tried about 10 RPMs from various places that are meant to be for
Redhat 8 on i386 (or i586 or i686 - I am guessing it shouldn=B9t matter?) and
whenever I try to install them with the recommended command, e.g. :

rpm -i --ignoreos --root /compat/linux --dbpath /var/lib/rpm
/mnt/Desktop/apt-0.5.5cnc6-fr0.rh80.1.i386.rpm

I get this message:

 "package apt-0.5.5cnc6-fr0.rh80.1 is for a different architecture"

I then thought that the recently-installed linux rpm might be the right way
to deal with this, so:

/compat/linux/bin/rpm -i --ignoreos --root /compat/linux --dbpath
/var/lib/rpm /mnt/Desktop/apt-0.5.5cnc6-fr0.rh80.1.i386.rpm

warning: /mnt/Desktop/apt-0.5.5cnc6-fr0.rh80.1.i386.rpm: V3 DSA signature:
NOKEY, key ID e42d547b
error: Failed dependencies:
        rpm >=3D 4.0.0 is needed by apt-0.5.5cnc6-fr0.rh80.1
        libstdc++ is needed by apt-0.5.5cnc6-fr0.rh80.1
        /sbin/ldconfig is needed by apt-0.5.5cnc6-fr0.rh80.1
        /bin/sh is needed by apt-0.5.5cnc6-fr0.rh80.1
        libbz2.so.1 is needed by apt-0.5.5cnc6-fr0.rh80.1
        libc.so.6 is needed by apt-0.5.5cnc6-fr0.rh80.1
        libc.so.6(GLIBC_2.0) is needed by apt-0.5.5cnc6-fr0.rh80.1
        libc.so.6(GLIBC_2.1) is needed by apt-0.5.5cnc6-fr0.rh80.1
        libc.so.6(GLIBC_2.1.3) is needed by apt-0.5.5cnc6-fr0.rh80.1
        libc.so.6(GLIBC_2.2) is needed by apt-0.5.5cnc6-fr0.rh80.1
        libc.so.6(GLIBC_2.2.3) is needed by apt-0.5.5cnc6-fr0.rh80.1
        libc.so.6(GLIBC_2.3) is needed by apt-0.5.5cnc6-fr0.rh80.1
        libelf.so.0 is needed by apt-0.5.5cnc6-fr0.rh80.1
        libgcc_s.so.1 is needed by apt-0.5.5cnc6-fr0.rh80.1
        libgcc_s.so.1(GCC_3.0) is needed by apt-0.5.5cnc6-fr0.rh80.1
        libm.so.6 is needed by apt-0.5.5cnc6-fr0.rh80.1
        libncurses.so.5 is needed by apt-0.5.5cnc6-fr0.rh80.1
        libpopt.so.0 is needed by apt-0.5.5cnc6-fr0.rh80.1
        libpthread.so.0 is needed by apt-0.5.5cnc6-fr0.rh80.1
        libpthread.so.0(GLIBC_2.0) is needed by apt-0.5.5cnc6-fr0.rh80.1
        libpthread.so.0(GLIBC_2.1) is needed by apt-0.5.5cnc6-fr0.rh80.1
        libreadline.so.4 is needed by apt-0.5.5cnc6-fr0.rh80.1
        librpm-4.1.so is needed by apt-0.5.5cnc6-fr0.rh80.1
        librpmdb-4.1.so is needed by apt-0.5.5cnc6-fr0.rh80.1
        librpmio-4.1.so is needed by apt-0.5.5cnc6-fr0.rh80.1
        librt.so.1 is needed by apt-0.5.5cnc6-fr0.rh80.1
        libstdc++.so.5 is needed by apt-0.5.5cnc6-fr0.rh80.1
        libstdc++.so.5(GLIBCPP_3.2) is needed by apt-0.5.5cnc6-fr0.rh80.1
        libz.so.1 is needed by apt-0.5.5cnc6-fr0.rh80.1

Even though all of these executables and libraries are installed as standar=
d
in linux_base-8.

Then another thought; use '--ignorearch' with the FreeBSD rpm command. This
seems to install linux apt as required!  :o)  Maybe this is the right way t=
o
go?  I will investigate further and let you know.

> Maybe some extra RPMs.. make, libtool etc
>=20
> Run gcc from the linux bash (check the path to be sure its really using
> linux's gcc)
>=20

Will try these later today.

> *IF* this work, you should be able to compile and run linux32 programs (y=
ou
> using a linux compiler right ?)
>=20

So I can't get to these steps until I have worked out how to install the GC=
C
tools for linux.  As far as I can tell I have the following options:

1) Work out how to make RPMs work as discussed above.  Would like this
anyway to be able to use more linux stuff.

2) Install linux_devtools from ports - but:
/usr/ports/devel/linux_devtools % make
=3D=3D=3D>  linux_devtools-8.0_3 is only for i386, and you are running amd64.

3) Find a tarball of the GCC toolset for RH8 i*86 and extract it into
/compat/linux

4) ? Any others ?

> For linux64, well first step is to get binaries working
>=20
I will just be happy to have 32-bit working for now!

Thanks for the input

Michael



_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_=
/

        _/    _/   _/_/_/             Hopkins Research Ltd
       _/    _/   _/    _/
      _/_/_/_/   _/_/_/          http://www.hopkins-research.com/
     _/    _/   _/   _/
    _/    _/   _/     _/               'touch the future'
                  =20
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_=
/




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BE704E82.36B2F%michael.hopkins>