Sage FreeBSD 7.x and 8.x build notes for Sage 4.1 and 4.1.1


Overall build environment differences

Preparatory work

It's possible there are other dependencies, I haven't tried building sage in a clean (tinderbox) environment.

Building Sage

On FreeBSD 7.x

Current Status

Currently, the following tests fail on FreeBSD 7.2/i386 (the same tests fail on both versions of sage). Full logs at sage-4.1.freebsd32.test.log and sage-4.1.1.rc2.freebsd32.test.log.

        sage -t  "4.1/devel/sage/sage/ext/fast_callable.pyx"
        sage -t  "4.1/devel/sage/sage/rings/number_field/"
        sage -t  "4.1/devel/sage/sage/rings/"
        sage -t  "4.1/devel/sage/sage/rings/integer.pyx"
        sage -t  "4.1/devel/sage/sage/schemes/elliptic_curves/"
        sage -t  "4.1/devel/sage/sage/misc/"
        sage -t  "4.1/devel/sage/sage/libs/pari/gen.pyx"

The actual failures are a mixture of:

Notes on spkgs and attached patches

The following lists versions for sage-4.1. The actual patch content remains the same for sage-4.1.1.rc2, though some patch names (as well as internal pathnames) change.



Various fixes to make it compile on FreeBSD


Add hooks to ensure that the local Sage versions of dependencies are used by FreeBSD. Otherwise you get:

            matplotlib: 0.98.6svn
                python: 2.5.2 (r252:60911, Apr  1 2009, 08:50:05)  [GCC
                        4.3.4 20090326 (prerelease)]
              platform: freebsd7

                 numpy: no
                        * You must install numpy 1.1 or later to build
                        * matplotlib.
Error building matplotlib package.

Add support for FreeBSD later than 6.x. Otherwise you get :

Traceback (most recent call last):
  File "", line 119, in <module>
    if not check_for_numpy():
  File "/home/pjeremy/sage-3.4/spkg/build/matplotlib-", line 499, in check_for_numpy
  File "/home/pjeremy/sage-3.4/spkg/build/matplotlib-", line 320, in add_base_flags
    [os.path.join(p, 'include') for p in basedir[sys.platform] ])
KeyError: 'freebsd7'
Error building matplotlib package.

gcc4.3 (though not gcc4.2) appears to define putchar() in a way that breaks the putchar() definitions inside ttconv. I couldn't quickly identify what the underlying cause was so I took the easy way out and undef'd the offending putchar() macro.

Individual character bounding boxes in AFM files do not have to be integral so convert each bounding box to a list of floats, rather than a list of ints. This corrects a problem where most of the tests would fail with ValueError: invalid literal for int() with base 10: '539.621'.

All three sub-patches are in #5873



Pass CFLAGS, CPPFLAGS and LDFLAGS from the environment into the build process. This also corrects a typo in CPPFLAGS.

Note that FreeBSD needs the path to libiconv to be explicitly specified. In theory, --with-libiconv-prefix should work but configure script is broken and ignores that path when looking for libiconv. Hard-wire /usr/local/include and /usr/local/lib via xxFLAGS.

Note that the X11 detection in spkg-install will not work anywhere other than Linux. This needs future work.

These patches are all local to Sage.



Patch sage-spkg to apply local patches. This patch also disables deletion of the spkg/build/FOO temporary directories - which was useful during porting. This latter patch can be safely removed.

freebsd/sage-4.1 (last edited 2009-10-01 19:17:50 by PeterJeremy)