[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: m68k not a release arch for etch; status in testing, future plans?



Hi,

On Sun, 22 Oct 2006, Michael Schmitz wrote:

> > However I also experimented using a cross-compiler through the use
> > of distcc. Results are on debian-68k archives and are positive.
> > This would allow packages to build much more quickly.
> 
> The use of distcc (running ./configure and testsuites natively) would be
> helpful indeed.

In case anyone wants to try it, here is what I did to install it 
transparantly. I using this now for some time already and it works great, 
the only problem right now is that the cross compiler doesn't have objc 
support, so this will fail, but it's also fixable (a cross compiler for 
objc can be built, it's just not packaged yet).

First the native compiler needs to be renamed:

# dpkg-divert --divert /usr/bin/gcc-real-4.1 --rename /usr/bin/gcc-4.1
# dpkg-divert --divert /usr/bin/g++-real-4.1 --rename /usr/bin/g++-4.1

Then distcc has to find the native compiler again, in case it has to 
fallback to it, so I created some symlinks in a separate dir:

# ls -l /usr/real-bin
total 0
lrwxrwxrwx 1 root root 21 2006-09-10 18:10 g++ -> /usr/bin/g++-real-4.1
lrwxrwxrwx 1 root root 21 2006-09-10 18:10 g++-4.1 -> /usr/bin/g++-real-4.1
lrwxrwxrwx 1 root root 21 2006-08-25 17:57 gcc -> /usr/bin/gcc-real-4.1
lrwxrwxrwx 1 root root 21 2006-08-25 17:57 gcc-4.1 -> /usr/bin/gcc-real-4.1
lrwxrwxrwx 1 root root 21 2006-09-10 18:11 m68k-linux-gnu-g++ -> /usr/bin/g++-real-4.1
lrwxrwxrwx 1 root root 21 2006-09-10 18:10 m68k-linux-gnu-g++-4.1 -> /usr/bin/g++-real-4.1
lrwxrwxrwx 1 root root 21 2006-08-25 17:58 m68k-linux-gnu-gcc -> /usr/bin/gcc-real-4.1
lrwxrwxrwx 1 root root 21 2006-08-25 17:58 m68k-linux-gnu-gcc-4.1 -> /usr/bin/gcc-real-4.1

Then I installed the attached program as gcc-4.1/g++-4.1, which only sets 
up the search path for distcc and calls it.
Now all is left is to set up distcc itself, I added the remote host
directly to /etc/distcc/hosts, so it's done globally, in case of a slow 
network the ",lzo" option might be useful.

Finally it's probably a good idea to test the setup:

# DISTCC_VERBOSE=1 gcc -c -O2 crosscc.c
# DISTCC_VERBOSE=1 gcc -c -O2 -x c crosscc.c

Check the distcc output, in the first case it should be compiled on the 
remote host and in the second case it should properly fall back to the 
localhost.

Have fun. :)

bye, Roman

PS: Maybe someone wants to make a package out of this so it can be easily 
installed?
#include <alloca.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>

#define DISTCC		"/usr/bin/distcc"
#define REAL_PATH	"/usr/real-bin:"
#define REMOTE_GCC	"m68k-linux-gnu-gcc"
#define REMOTE_GPP	"m68k-linux-gnu-g++"

int main(int ac, char **av)
{
	char **av2 = alloca((ac + 2) * sizeof(char *));
	char *path, *path2;

	memcpy(av2 + 2, av + 1, (ac - 1) * sizeof(char *));
	av2[ac + 1] = NULL;
	av2[0] = DISTCC;
	av2[1] = strchr(strrchr(av[0], '/') ?: av[0], '+') ? REMOTE_GPP : REMOTE_GCC;

	path = getenv("PATH");
	path2 = alloca(strlen(path) + 128);
	strcpy(path2, REAL_PATH);
	strcat(path2, path);
	setenv("PATH", path2, 1);

	return execv(av2[0], av2);
}


Reply to: