# ld complains about wrong arch when build ports with distcc



## michaelmichael (Feb 13, 2014)

Hi,

This problem is about linking and different architectures. I am not sure if this is the correct subforum, but I guess you will tell me, so here is the problem.

On a FreeBSD 9.2-RELEASE-p3 machine (amd64) I installed ccache and distcc and tried to get it running for building ports. After configuring the following files (with the help of this post: http://nix-addict.blogspot.ch/2011/03/freebsd-distcc-ccache.html) **EDIT* - better not, see post below!
/etc/make.conf

```
WITH_CCACHE_BUILD="YES"
# implies to use pkg instead of pkg_* (EOL 1.9.2014)
WITH_PKGNG="YES"
# build no x11 packages or libraries since this is a headless system (for now)
WITHOUT_X11="YES"

BUILDFLAGS= /usr/local/share/bsdadminscripts/buildflags.mk
.if exists(${BUILDFLAGS})
.include "${BUILDFLAGS}"
.endif

WRKDIRPREFIX=           /var/ports
DISTDIR=                /var/ports/distfiles
PACKAGES=               /var/ports/packages
INDEXDIR=               /var/ports
```

and setting the following environment variables

```
setenv PATH                     /usr/local/libexec/ccache:$PATH
setenv DISTCC_DIR               /usr/local/etc/distcc
setenv DISTCC_HOSTS             "Distcc64 luke localhost"
setenv CCACHE_PATH              /usr/bin:/usr/local/bin
setenv CCACHE_DIR               /var/tmp/ccache
setenv CCACHE_LOGFILE           /var/log/ccache.log
setenv CCACHE_PREFIX            distcc
```
Distcc64 is an amd64 test machine and I have put localhost at the end because I wanted to see the build distribute.

I get this error message when building ports:

```
/usr/bin/ld: i386 architecture of input file `.libs/libpcre32_la-pcre_chartables.o' is incompatible with i386:x86-64 output
```
This is only one line of many when trying to build www/nginx (for example).

Note: due to the lack of csh and tcsh being able to have functions, I use shells/bash to build ports. I have defined the following function:

```
dmake(){
        make CC="ccache gcc" CXX="ccache g++" "$@"
}
```
**EDIT* - This turned out to be obsolete and seemed to cause or be part of the problem. When resolving this, it turned out I do not need this function and therefore do not need bash for compiling with distcc. See post below.

I am rather clueless, because I do not remember having something configured or installed to compile for i386. Also, I could not get distcc to distribute to other machines on the network (it worked with local threads though), but this I will post separately.

Cheers and thanks,
Michael


----------



## michaelmichael (Mar 5, 2014)

*Re: ld complains about wrong arch when build ports with dist*

After a couple of days of mourning I tried the following:


deinstalled devel/ccache
deinstalled devel/distcc
REinstalled both in the same order
abandoned the function dmake() (see initial post)
did not use shells/bash for building (don't know, on my journey through the Internet for help setting up distcc for ports I stumbled across some thread which looked sane and I tried it. Upon first successes with that, I stuck to it. Turned out it was crap though.)

Also I anticipated that distccmon on a REMOTE machine would indicate that some other machine is compiling on it. This is wrong, because distccmon seems to only display build threads (on local AND remote) if the build is run on the same machine.

After that, it seems to work fine.


----------

