Building HELIX 7.1.1 on FreeBSD 8 amd64

Developer Article

Article Information

This article applies to the following ZCS versions.
  ZCS 7.1 Article  ZCS 7.1

General information

Please, read Zimbra_on_FreeBSD for all the details.

This guide describes building HELIX-711 on FreeBSD-8_amd64.

At this point it's good to note that everything should be run as root unless stated otherwise.

Getting the source via Perforce

You need to install Perforce from /usr/ports:

cd /usr/ports/devel/p4 && make install distclean

If you are using a csh derivate shell, which is the FreeBSD default, run:


Setup the perforce enviroment:

setenv P4PORT
setenv P4USER public
setenv P4CLIENT public-view 
setenv P4PASSWD public1234

Fire up the workspace editor:

p4 client

which may look like this:

# A Perforce Client Specification.
#  Client:      The client name.
#  Update:      The date this specification was last modified.
#  Access:      The date this client was last used in any way.
#  Owner:       The user who created this client.
#  Host:        If set, restricts access to the named host.
#  Description: A short description of the client (optional).
#  Root:        The base directory of the client workspace.
#  AltRoots:    Up to two alternate client workspace roots.
#  Options:     Client options:
#                      [no]allwrite [no]clobber [no]compress
#                      [un]locked [no]modtime [no]rmdir
#  SubmitOptions:
#                      submitunchanged/submitunchanged+reopen
#                      revertunchanged/revertunchanged+reopen
#                      leaveunchanged/leaveunchanged+reopen
#  LineEnd:     Text file line endings on client: local/unix/mac/win/share.
#  View:        Lines to map depot files into the client workspace.
# Use 'p4 help client' to see more about client views and options.

Client: public-view

Update: 2008/04/08 04:45:37

Access: 2010/05/13 11:43:08

Owner:  public

               Created by admin.

Root:   /home/public/p4


Options:        noallwrite noclobber nocompress unlocked modtime normdir

SubmitOptions:  submitunchanged

LineEnd:        local

        //depot/zcs/... //public-view/...

and change Root: some_path to Root: /home/zimbrasrc.

Run the sync:

p4 sync -f //depot/zcs/HELIX-711/...
cd /home/zimbrasrc

which should be now downloaded to /home/zimbrasrc/HELIX-711.

Getting the source from


mkdir -p /home/zimbrasrc && \
    cd /home/zimbrasrc && \
        fetch && \
            tar xzf HELIX-711-src.tgz

Initial pre-build steps

Let's check our system:

uname -a
FreeBSD 8.2-RELEASE-p2 FreeBSD 8.2-RELEASE-p2 #0: Wed Jun  8 02:07:09 CEST 2011  amd64

We love some optimizations:

cat /etc/make.conf
COPTFLAGS= -O2 -pipe
CFLAGS= -O2 -fno-strict-aliasing -pipe

Preparing build enviroment via /usr/ports

I created simple "meta" ports which will take care of everything. Since I am a very very creative person I named those: mail/zimbra-rundeps and mail/zimbra-builddeps.

The first installs all dependencies needed to run HELIX-711 while the second installs all dependencies needed to build HELIX-711. For reasons vastly uknown the second requires the first one.

cd /usr/ports/mail
fetch && \
    tar xzf usrports_zimbra-rundeps-7.1.1.tgz && \
        rm -f usrports_zimbra-rundeps-7.1.1.tgz
fetch && \
    tar xzf usrports_zimbra-builddeps-7.1.1.tgz && \
        rm -f usrports_zimbra-builddeps-7.1.1.tgz
cd /usr/ports/mail/zimbra-builddeps && make -DWITHOUT_X11 -DWITHOUT_XPM -DWITH_XS config-recursive install

followed by an optional:

make distclean

to completely clean the build mess including source files.

If you are able to use /usr/ports you should be able to figure out the configure options (not that it matters much, mostly unimportant stuff - just be sure NOT TO configure diablo-jdk16 for POLICY (as your build will be doomed to fail)). Be warned that HELIX-711 requires diablo-jdk16 to build/run and building diablo-jdk16 requires downloading some java stuff.

There are also those 117+ Perl modules..

If you are using a csh derivate shell, which is the FreeBSD default, run:


Preparing build enviroment via

Since some people like to compile and others like to install-only I built all the necessary zimbra-builddeps packages.

cd /tmp && \
    fetch && \
        tar xzf zimbra-builddeps-8_amd64-7.1.1.tgz && \
            cd zimbra-builddeps-8_amd64-7.1.1 && \
                pkg_add zimbra-builddeps-7.1.1.tbz && cd /tmp && rm -rf zimbra-builddeps-8_amd64-7.1.1

You need to accept diablo-jdk16 license.

If you are using a csh derivate shell, which is the FreeBSD default, run:


Grats, you just saved yourself a lot of time.

Quick-hacks for a better day

Since Zimbra is a Linux lover by nature everything is /bin/bash but guess what.. we have /usr/local/bin/bash:

ln -s /usr/local/bin/bash /bin/bash

Since Zimbra uses gmake and since some ThirdParty (specifically snmp install script) does not honor ${MAKE} macro we have to replace make with gmake globally, otherwise some stuff just won't make (it) with weird errors:

cp -p /usr/bin/make /usr/bin/make.orig && cp /usr/local/bin/gmake /usr/bin/make

We need to compile with diablo-jdk16 so you should now get something like this:

java -version
java version "1.6.0_07"
Diablo Java(TM) SE Runtime Environment (build 1.6.0_07-b02)
Diablo Java HotSpot(TM) 64-Bit Server VM (build 10.0-b23, mixed mode)

Patching HELIX-711 to comply with FreeBSD

Download the HELIX-711 FreeBSD patch and patch the source tree:

cd /home/zimbrasrc && \
    fetch && \
        cd HELIX-711 && patch -p1 -s < ../HELIX-711.FreeBSD.patch

Remove unnecessary files:

find . -name "*.orig" -delete

Change modes of our new build/install scripts else the build will fail:

chmod 0755 ZimbraBuild/rpmconf/Spec/Scripts/FreeBSD/*

Rest is handled by libexec/zmfixperms after installation.

Putting diablo-jdk16 into ThirdPartyBuilds

Zimbra requires you to supply jdk16 so we are happy to oblige by using installed version of diablo-jdk16:

mkdir -p ThirdPartyBuilds/FreeBSD_amd64/java && cd ThirdPartyBuilds/FreeBSD_amd64/java && \
    cp -pr /usr/local/diablo-jdk1.6.0 diablo-jdk1.6.0_07 &&\
        tar zcf diablo-jdk1.6.0_07.tgz diablo-jdk1.6.0_07 && \
            rm -rf diablo-jdk1.6.0_07 && cd ../../../

The destination tarball version must match with ZimbraBuild/defs/ThirdParty/FreeBSD_amd64.def!

Putting JCE files into ThirdPartyBuilds

Zimbra requires you to supply Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 6 so we are not so happy to oblige by downloading those from oracle to ThirdPartyBuilds/FreeBSD_amd64/java and unzipping the resulting

mkdir -p ThirdPartyBuilds/FreeBSD_amd64/java && cd ThirdPartyBuilds/FreeBSD_amd64/java && \
    unzip &&\
        rm -f && \
            cd ../../../

Building Zimbra Collaboration Suite: HELIX-711

First build yourself the native library and push it to the proper place:

cd ZimbraNative && make push && cd ../

Get junit package just in case:

cd ZimbraCommon/jars && \
    fetch && \
        cd ../../

Now (finally!) that's the part where real Zimbra developer's magic kicks in:

cd ZimbraBuild
./ -t

Let's clean up after the build:

cp -p /usr/bin/make.orig /usr/bin/make && rm -f /usr/bin/make.orig

You should have a fresh build inside:

cd zcs-7.*

Installing Zimbra Collaboration Suite: HELIX-711 after a successful build


Further reading


--Solko 03:50, 13 June 2011 (PDT)

Jump to: navigation, search