Skip to content

port Sage to FreeBSD 11 #22679

Closed
Closed
@dimpase

Description

@dimpase

Please see #26249 for the followup (for FreeBSD 12).

FreeBSD as of version 10 uses clang by default, and is closer to OSX in other ways too, so it would be a good free testing ground for the use of clang with Sage.

preparing tools:

  • install gcc6 and create fake gfortran by making a link to gfortran6
  • make sure as is new enough: pkg install binutils will install as version 2.28, and you need it to come first in PATH (i.e. make sure that /usr/local/bin comes before /usr/bin).
  • remove stale /lib/libgcc_s.so.1 and point it to the right one in /usr/local/lib/gcc6/ (perhaps there is a better way...)
  • install gmake, gawk, gsed, and create fake make and sed to point to gmake and gsed
  • make sure /bin/sh is actually bash
  • install pkgconf (FreeBSD's replacement of pkg-config)
  • install wget (needed for AtlasRep GAP package).
  • install icu (needed for R)

building Sage itself

starting from a clean git repo:

export CFLAGS="-fPIC"
export CXXFLAGS="-fPIC"
export LDFLAGS="-L/usr/local/lib -Wl,--add-needed -lm"
./configure CC=cc CXX=c++  #(this is clang 3.8.0 a.t.m.)
MAKE="make -j7" make build
MAKE="make -j4" make # building docs is very memory-hungry

HISTORICAL: Sage itself:

  • hack configure.ac to make freebsd allowed platform
  • deal with cephes' complex.h conflicting with numpy - cephes' complex.h conflicts with a numpy header on FreeBSD #22786
  • gf2x: only builds with SAGE_FAT_BINARY on
  • upgrade sqlite to version 3.17 - otherwise there are compiling problems with editline (see update sqlite to version 3.17 #22687)
  • flint: remove "-ascii -pedantic" flags from CFLAGS in configure
  • libraries (libgap, cddlib, etc) need -fPIC for CFLAGS (so we build with CC="cc -fPIC -pipe" ; (-pipe is probably not really needed)) - see on clang libgap needs -fPIC #22784
  • but gap cannot be built with CC="cc -fPIC -pipe", as it does something weird in ./configure, setting BASECC to be cc, and generating broken Makefile (with -fPIC and -pipe on two separate lines); so build gap with CC=cc
  • giac needs CFLAGS="-I/usr/local/include" to find libintl.h and LDFLAGS="-L/usr/local/lib -lintl" to link.
  • either provide /bin/bash or fix this properly (get rid of /bin/bash #22689)
  • Sage builds and runs, modulo linking issues with flint and arb, which can be fixed ad hoc by hand.
  • deal with cephes' libm not pulling system's libm, unless some arcane linker flags are used (see comments below)
  • old freebsd workaround for libgd removed in remove obsolete FreeBSD workaround in libgd #22785
  • ...

Depends on #12426
Depends on #23700

CC: @sagetrac-stephen @kiwifb @jdemeyer @jpflori

Component: porting: BSD

Author: Dima Pasechnik

Branch/Commit: u/dimpase/fbsd-support @ 4aaeeb4

Reviewer: Dima Pasechnik

Issue created by migration from https://trac.sagemath.org/ticket/22679

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions