TianoCore on FreeBSD/amd64

I’m attempting to build the TianoCore code base on FreeBSD/amd64. Here’s what I did so far.

  • In order to be able to check out the EDK2 sources, I installed the devel/subversion port. To check out the source tree, I did this in my home directory:

    $ svn co https://edk2.tianocore.org/svn/edk2/trunk/edk2 edk2
    
  • I installed the java/diablo-jdk15 port.
  • Downloaded Apache Ant 1.6.5. I didn’t install it through the port but instead downloaded the binary distribution and extracted the archive under /opt since the EDK2 build framework requires very specific versions of the tools.
  • Did the same thing with Ant-Contrib 1.0b3, XMLBeans 2.1.0 and Saxon 8.1.1.
  • I created a symbolic link at /opt/xmlbeans-2.1.0/lib to /opt/saxon-8.1.1/saxon8.jar. The build notes for the EDK said a copy was needed, but a symbolic link works just as good. I guess they were running Windows or didn’t know about links. Whatever.
  • Then I set up the environment for the build process as described in the build notes. This is what I did (note that my shell is bash):

    $ export WORKSPACE=/home/phs/edk2
    $ export JAVA_HOME=/usr/local/diablo-jdk1.5.0
    $ export ANT_HOME=/opt/apache-ant-1.6.5
    $ export XMLBEANS_HOME=/opt/xmlbeans-2.1.0
    $ export PATH=$PATH:$ANT_HOME/bin:$XMLBEANS_HOME/bin
    
  • I kicked off the build process with this command:

    $ bash edksetup.sh newbuild
    

    Unfortunately, the build fails with an error:

    BUILD FAILED
    /usr/home/phs/edk2/Tools/build.xml:22: The following error occurred while executing this line:
    /usr/home/phs/edk2/Tools/CCode/Source/build.xml:247: The following error occurred while executing this line:
    /usr/home/phs/edk2/Tools/CCode/Source/PeCoffLoader/build.xml:68: ar failed with return code 139
    /phs/edk2/Tools/CCode/Source/PeCoffLoader/build.xml:68: ar failed with return code 139
    

    This error can be solved by using a GCC that produces PE/COFF binaries instead of the default ELF images.