Differences between revisions 8 and 9
Revision 8 as of 2009-07-28 20:18:57
Size: 29227
Editor: PeterJeremy
Comment: Don't restrict to amd64
Revision 9 as of 2009-07-30 19:05:08
Size: 28326
Editor: PeterJeremy
Comment: Update pre-patch Atlas error message
Deletions are marked like this. Additions are marked like this.
Line 136: Line 136:
  libraries f77blas,cblas,atlas_r not found in /home/pjeremy/sage-3.4/local/lib   libraries f77blas,cblas,atlas_r not found in /usr/home/peter/sage-4.1/local/lib
Line 139: Line 139:
/home/pjeremy/sage-3.4/spkg/build/numpy-1.2.0.p0/src/numpy/distutils/system_info.py:1340: UserWarning: /usr/home/peter/sage-4.1/spkg/build/numpy-1.3.0.p0/src/numpy/distutils/system_info.py:1383: UserWarning:
Line 147: Line 147:
  libraries f77blas,cblas,atlas_r not found in /home/pjeremy/sage-3.4/local/lib
  libraries lapack_atlas not found in /home/pjeremy/sage-3.4/local/lib
  libraries f77blas,cblas,atlas_r not found in /usr/home/peter/sage-4.1/local/lib
  libraries lapack_atlas not found in /usr/home/peter/sage-4.1/local/lib
Line 152: Line 152:
/home/pjeremy/sage-3.4/spkg/build/numpy-1.2.0.p0/src/numpy/distutils/system_info.py:1247: UserWarning: /usr/home/peter/sage-4.1/spkg/build/numpy-1.3.0.p0/src/numpy/distutils/system_info.py:1290: UserWarning:
Line 158: Line 158:
...
/home/pjeremy/sage-3.4/local/bin/gfortran -Wall build/temp.freebsd-7.0-STABLE-amd64-2.5/numpy/linalg/lapack_litemodule.o build/temp.freebsd-7.0-STABLE-amd64-2.5/numpy/linalg/python_xerbla.o -L/home/pjeremy/sage-3.4/local/lib -L/usr/local/lib/gcc-4.3.4/gcc/x86_64-portbld-freebsd7.0/4.3.4 -llapack -lblas -lgfortran -o build/lib.freebsd-7.0-STABLE-amd64-2.5/numpy/linalg/lapack_lite.so
build/temp.freebsd-7.0-STABLE-amd64-2.5/numpy/linalg/lapack_litemodule.o(.text+0x41): In function `check_object':
numpy/linalg/lapack_litemodule.c:103: undefined reference to `PyType_IsSubtype'
build/temp.freebsd-7.0-STABLE-amd64-2.5/numpy/linalg/lapack_litemodule.o(.text+0x7b):numpy/linalg/lapack_litemodule.c:114: undefined reference to `PyErr_Format'
build/temp.freebsd-7.0-STABLE-amd64-2.5/numpy/linalg/lapack_litemodule.o(.text+0xb7):numpy/linalg/lapack_litemodule.c:109: undefined reference to `PyErr_Format'

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

Note that this page is under construction and currently incomplete. In particular, it still includes references to sage-3.4 in areas that have not been converted to sage-4.1.

Contents

Overall build environment differences

  • sh and /bin/sh are a POSIX shell, rather than bash.

  • make is the BSD make, not GNU make

Preparatory work

  • Install ports/shells/bash or ports/shells/bash3 (I used 4.0.24)
  • Install ports/devel/gmake
  • Install ports/lang/gcc43 - FreeBSD no longer ships with a Fortran compiler by default.
  • Install ports/devel/autoconf262
  • Install ports/converters/libiconv - This may be optional but is definitely used if found

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

Building Sage

The Sage build chain automatically unpacks and builds each spkg, however in order to build on FreeBSD, a number of spkgs need patching. Rather than manually unpack, patch and repack each spkg, I have instead modified base/sage-spkg to automatically apply a local patch if it exists.

On FreeBSD 7.x

  • Unpack sage-4.1.rc1.tar
  • cd sage-4.1.rc1

  • mkdir -p local/bin spkg/patches

  • Create symlinks to mask name differences.
    • ln -s /usr/local/bin/gmake local/bin/make

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

    • ln -s /usr/local/bin/gcc43 local/bin/gcc

    • ln -s /usr/local/bin/g++43 local/bin/g++

    • ln -s /usr/local/bin/gfortran43 local/bin/gfortran

  • Copy the patches listed below into spkg/patches

  • Build Sage
    • SAGE_FORTRAN_LIB=/usr/local/lib/gcc-43/libgfortran.so gmake

Current Status

Notes on spkgs and attached patches

A number of the following patches change make to ${MAKE}. This the recommended way to recursively invoke make to ensure that the subordinate make is the same as the parent make (and also ensures that the two make instances will communicate on things like '-jX').

base.patch

base.txt

  • The patch to base/sage-spkg enables the local patching that the rest of the patches rely on. Note that this patch is not intended to be merged into sage but provides a convenient mechanism to apply local patches without requiring that the spkg files are locally re-rolled.

atlas-3.8.3.p5

Various fixes to make it compile on FreeBSD

  • FreeBSD uses an '_fbsd' suffix on the ELF format supported by ld - prevents ld: unrecognised emulation mode: elf_x86_64 error during atlas build. Reported upstream as https://sourceforge.net/tracker/?func=detail&atid=379483&aid=2728930&group_id=23725

  • Building the libclapack.so should result in a libclapack.so being created. This appears to be a copy-and-paste error in atlas and has been reported as https://sourceforge.net/tracker/?func=detail&atid=379483&aid=2728935&group_id=23725 (Note that this is not relevant to sage as libclapack is not built or used).

  • numpy on FreeBSD expects atlas to build different and (according to the FreeBSD numpy port, static) threaded libraries: libatlas_r instead of libatlas and libalapack_r instead of liblapack. libatlas_r is built as part of the threaded version of atlas. libalapack_r is a FreeBSD special which explicitly combines all of liblapack from the atlas lapack build with the threaded atlas version of liblapack. Adapting this for Sage is still under investigation.
  • Treat shared libraries the same as Linux - otherwise they aren't correctly detected by (eg) numpy. (sage-specific)

numpy error from last point above:

atlas_blas_info:
  libraries f77blas,cblas,atlas_r not found in /usr/home/peter/sage-4.1/local/lib
  NOT AVAILABLE

/usr/home/peter/sage-4.1/spkg/build/numpy-1.3.0.p0/src/numpy/distutils/system_info.py:1383: UserWarning:
    Atlas (http://math-atlas.sourceforge.net/) libraries not found.
    Directories to search for the libraries can be specified in the
    numpy/distutils/site.cfg file (section [atlas]) or by setting
    the ATLAS environment variable.
  warnings.warn(AtlasNotFoundError.__doc__)
...
atlas_info:
  libraries f77blas,cblas,atlas_r not found in /usr/home/peter/sage-4.1/local/lib
  libraries lapack_atlas not found in /usr/home/peter/sage-4.1/local/lib
numpy.distutils.system_info.atlas_info
  NOT AVAILABLE

/usr/home/peter/sage-4.1/spkg/build/numpy-1.3.0.p0/src/numpy/distutils/system_info.py:1290: UserWarning:
    Atlas (http://math-atlas.sourceforge.net/) libraries not found.
    Directories to search for the libraries can be specified in the
    numpy/distutils/site.cfg file (section [atlas]) or by setting
    the ATLAS environment variable.
  warnings.warn(AtlasNotFoundError.__doc__)
...

sage_scripts-4.1.rc1

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.