Difference between revisions of "Solaris Build Environment"
Line 3: | Line 3: | ||
Our current Solaris build hardware is a Sun Fire V240 running Solaris 10 U10. |
Our current Solaris build hardware is a Sun Fire V240 running Solaris 10 U10. |
||
− | Solaris 10 includes a variety of free software tools in /usr/sfw, but not the full set of dependencies needed to checkout, build, and test the krb5 tree. We have chosen to use |
+ | Solaris 10 includes a variety of free software tools in /usr/sfw, but not the full set of dependencies needed to checkout, build, and test the krb5 tree. We have chosen to use [https://opencsw.org/ OpenCSW] to add most of the dependencies, and local builds in /usr/local for the remaining few. |
− | (The procedure described below is incomplete and still being tested. Also, wget can't establish https connections without configuration we haven't done yet.) |
||
+ | ==Shell setup== |
||
− | ==Building a newer gcc== |
||
+ | A root login by default uses a very minimal shell (/bin/sh) with a very minimal path (/usr/sbin:/usr/bin). For any operations performed as root, we begin by starting a functional shell as follows: |
||
− | (This may be unnecessary.) |
||
+ | bash |
||
+ | export PATH=/opt/csw/bin:/usr/sbin:/usr/bin:/usr/sfw/bin:/usr/ccs/bin |
||
+ | export MANPATH=/opt/csw/share/man:/usr/share/man:/usr/sfw/share/man |
||
− | 1. Set up a shell with a path containing the needed system utilities: |
||
+ | ==Setting up OpenCSW== |
||
− | /bin/bash |
||
+ | Begin by installing the pkgutil command (in /opt/csw/bin/pkgutil) and updating its catalog. |
||
− | export PATH=/usr/sbin:/usr/bin:/usr/sfw/bin:/usr/ccs/bin |
||
− | 2. Create /usr/local/src: |
||
+ | pkgadd -d http://get.opencsw.org/now |
||
+ | pkgutil -U |
||
− | mkdir /usr/local/src |
||
+ | "pkgutil -l" lists installed packages. "pkgutil -a string" looks up string in the catalog. "pkgutil -i packagename" installs a package; the -y flag can be used to skip prompts. |
||
− | cd /usr/local/src |
||
− | 3. From https://ftp.gnu.org/, fetch the latest versions of gmp, mpfr, and mpc, and fetch gcc 5.4.0. Untar them in /usr/local/src. |
||
+ | ==Install required OpenCSW packages== |
||
− | 4. Build gmp, mpfr, and mcc as follows. |
||
+ | pkgutil -y -i git |
||
+ | pkgutil -y -i libssl_dev |
||
+ | pkgutil -y -i autoconf |
||
+ | pkgutil -y -i expect |
||
+ | pkgutil -y -i bison |
||
+ | pkgutil -y -i emacs |
||
+ | pkgutil -y -i gdb |
||
− | cd /usr/local/src/gmp-''version'' |
||
+ | OpenSSL 0.9 is present in /usr/sfw/lib, but we need 1.0 or later for PKINIT so we install the OpenCSW version. emacs and gdb are not needed to build krb5, but are handy to have around for manual testing and debugging work. |
||
− | ./configure --disable-shared ABI=32 |
||
− | gmake && gmake install |
||
− | cd /usr/local/src/mpfr-''version'' |
||
− | ./configure --disable-shared LDFLAGS=-L/usr/local/lib |
||
− | gmake && gmake install |
||
− | cd /usr/local/src/mpc-''version'' |
||
− | ./configure --disable-shared LDFLAGS=-L/usr/local/lib |
||
− | gmake && gmake install |
||
− | 5. Build gcc as follows. This build takes many hours. |
||
+ | ==Local builds of remaining dependencies== |
||
− | cd /usr/local/src/gcc-5.4.0 |
||
+ | For now, the only dependency we need to build by hand is dejagnu: |
||
− | edit gcc/config/sol2.h; where it says "#ifndef USE_GLD" and subsequently talks about using a mapfile, change it to: |
||
− | #if !defined(USE_GLD) && defined(ENABLE_SHARED_LIBGCC) |
||
− | ./configure --with-gmp=/usr/local --with-mpfr=/usr/local --with-mpc=/usr/local --disable-shared --enable-languages=c,c++ |
||
− | gmake && gmake install |
||
− | ==Setting up pkgsrc== |
||
+ | mkdir /usr/local /usr/local/src |
||
+ | From https://ftp.gnu.org/gnu/dejagnu/ fetch the latest dejagnu; untar it in /usr/local/src |
||
+ | cd /usr/local/src/dejagnu-''version'' |
||
+ | ./configure && gmake install |
||
− | If it becomes necessary to restart this process, "rm -rf /usr/pkgsrc /usr/pkg /var/db/pkg /var/db/pkg.refcount" will clean the slate. |
||
+ | ==Create user accounts== |
||
− | |||
− | 1. Set up the shell and fetch the pkgsrc tar file: |
||
− | |||
− | /bin/bash |
||
− | export PATH=/usr/pkg/sbin:/usr/pkg/bin:/usr/sbin:/usr/bin:/usr/sfw/bin:/usr/ccs/bin |
||
− | cd /tmp |
||
− | wget https://ftp.netbsd.org/pub/pkgsrc/stable/pkgsrc.tar.gz |
||
− | cd /usr |
||
− | gtar xzf /tmp/pkgsrc.tar.gz |
||
− | |||
− | 2. Bootstrap pkgsrc: |
||
− | |||
− | cd /usr/pkgsrc/bootstrap |
||
− | CFLAGS='-O2' CC='gcc -std=gnu99 -Wno-implicit-declaration' ./bootstrap |
||
− | #CFLAGS='-O2 -Wno-implicit-function-declaration' CC=/usr/local/bin/gcc ./bootstrap |
||
− | edit /usr/pkg/etc/mk.conf, add "CC= gcc -std=gnu99 -Wno-implicit-declaration" |
||
− | pkg_admin -K /var/db/pkg fetch-pkg-vulnerabilities |
||
− | (cd /usr/pkgsrc/shells/bash && bmake install) |
||
− | edit /usr/pkg/etc/mk.conf, change TOOLS_PLATFORM.sh to /usr/pkg/bin/bash |
||
− | exit out of the shell, run /usr/pkg/bin/bash, and set the path as in step 1 |
||
− | (cd /usr/pkgsrc/devel/scmcvs && bmake install) |
||
− | (cd /usr/pkgsrc && cvs update) |
||
− | |||
− | 3. Build packages useful for krb5 development: |
||
− | |||
− | (cd /usr/pkgsrc/devel/git && bmake install) |
||
− | |||
− | ==Creating user accounts== |
||
By default, /home on Solaris is controlled by the automounter. To avoid needing to change the automounter configuration, we create user accounts with home directories in /export/home: |
By default, /home on Solaris is controlled by the automounter. To avoid needing to change the automounter configuration, we create user accounts with home directories in /export/home: |
||
− | useradd -d /export/home/ghudson -m ghudson |
+ | useradd -d /export/home/ghudson -s /bin/bash -m ghudson |
Creating an account allows the Kerberos principal of the same name in the ATHENA.MIT.EDU realm to log in on that account. |
Creating an account allows the Kerberos principal of the same name in the ATHENA.MIT.EDU realm to log in on that account. |
||
− | ==Problem log== |
||
+ | To set a reasonable path for development work, the user can edit .profile to add: |
||
− | |||
− | A number of problems were encountered when trying simpler or mistaken variants of the above procedure. For the sake of easier debugging, here is a record of them: |
||
− | |||
− | * It initially looked like cvs wasn't present in pkgsrc. The directory is named devel/scmcvs, because devel/cvs would conflict with the CVS metadata directory on case-insensitive filesystems. |
||
− | |||
− | * When attempting to build pkgsrc with /usr/sfw/bin/gcc, a circular dependency between pkgtools/digest and lang/gcc2 was encountered. This resulted from running bmake without /usr/sfw/bin in $PATH. After correcting the path, it was necessary to run "bmake clean" in pkgtools/digest to clear the issue. |
||
− | |||
− | * When attempting to build pgksrc with /usr/sfw/bin/gcc, devel/p5-gettext and other packages would fail when they included <stdbool.h>, because that Solaris header is incompatible with the default standards environment of gcc 3.4.3. This can be worked around by bootstrapping pkgsrc with "gcc -std=gnu99 -Wno-implicit declaration" and setting CC to that value in /usr/pkg/etc/mk.conf after bootstrap. (Without "-Wno-implicit-declaration", the bootstrap process fails when building bsdinstall.) Building with gcc 5.4.x works around the <stdbool.h> problem, as it defaults to the gnu11 standards environment, but it also requires -Wno-implicit-function-declaration for bsdinstall to build correctly during bootstrap. |
||
− | |||
− | * After removing /usr/pkgsrc and /usr/pkg, bootstrapping pkgsrc again wouldn't install anything in /usr/pkg except /usr/pkg/etc/mk.conf. To start over, it is necessary to also remove /var/db/pkg and /var/db/pkg.refcount. |
||
− | |||
− | * When attempting to build pkgsrc with "/usr/sfw/bin/gcc -std=gnu99 -Wno-implicit-declaration", /bin/bash segmentation faults were encountered in several packages (starting with p5-Error) when executing long shell lines. To work around this issue, the above procedure builds the pkgsrc bash and uses it for the build after the bootstrap. (This diagnosis and workaround may be incorrect. In p5-TimeDate where this problem first occurs, a core file exists for perl, and the error message is consistent with bash seeing a perl segmentation fault. The problem continues to occur after mk.conf is configured to use the pkgsrc bash, although the error message still references /bin/bash.) |
||
− | |||
− | * When attempting to build pkgsrc with "/usr/sfw/bin/gcc -std=gnu99 -Wno-implicit-declaration", pkg_create for some packages failed with stat failures, where the offending pathnames contained gcc error messages such as "gcc: unrecognized option `-print-multiarch': No such file or directory". To work around this problem, we build a newer version of gcc in /usr/local/bin before building pkgsrc. (However, the real problem may have been /dev/null being a regular file instead of a link; see below.) |
||
− | * When building gcc's dependencies, mpc complains that libgmp uses an incompatible ABI. This is because gmp overrides the default 32-bit ABI and chooses the 64-bit ABI for performance reasons. Configuring gmp with "ABI=32" works around the issue. |
||
+ | PATH=/usr/local/bin:/opt/csw/bin:/usr/bin:/usr/sfw/bin:/usr/ccs/bin |
||
+ | MANPATH=/usr/local/share/man:/opt/csw/share/man:/usr/share/man:/usr/sfw/share/man |
||
+ | export PATH MANPATH |
||
− | * gcc does not use the configured LDFLAGS when linking some of its programs; therefore, configuring with LDFLAGS=-L/usr/local/lib is not sufficient to find its dependencies there, and configuring with LDFLAGS=-R/usr/local/lib does not allow built programs to find the shared library. To work around this problem, we configure the dependencies with --disable-shared and configure gcc with --with-gmp=/usr/local --with-mpfr=/usr/local --with-mpc=/usr/local. |
||
+ | The following shell function, or a variant of it, may be useful for configuring a build with the correct paths. This variant is designed to work in a separate build directory placed next to the src directory within a checkout. |
||
− | * If gcc is configured without --disable-shared, programs built with /usr/local/bin/gcc will not run wth the default runtime linker path. We could perhaps modify the runtime linker path to include /usr/local/lib, but we prefer solutions that require fewer global system configuration changes. |
||
+ | k5configure() { ../src/configure --enable-maintainer-mode --prefix=$HOME/inst --with-ldap CFLAGS=-g CPPFLAGS="-I/opt/csw/include" LDFLAGS="-L/opt/csw/lib -R/opt/csw/lib" "$@"; } |
||
− | * If gcc is configured with --disable-shared, the build fails with "ld: fatal: file libgcc-unwind.map: stat failed: No such file or directory". (see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65725). To work around this problem, we apply a small change to fix the bug, taken from the aforementioned bug report. |
||
+ | ==To do== |
||
− | * If gcc is configured with --disable-shared, the build fails with "libtool: compile: not configured to build any kind of library" while building Java classpath materials. To work around this problem, we configure gcc with support for just C and C++. |
||
+ | * We do not install OpenLDAP and the MIT krb5 build currently fails with the native Solaris LDAP library for a couple of reasons (see {{bug|8167}}). This should be fixed. |
||
− | * When building the bash pkgsrc package with gcc 5.4.0 from /usr/local/bin, the subsidiary build of devel/gettext-tools fails with "pkg_create: lstat failed for file # ### BEGIN LIBTOOL TAG CONFIG: disable-static: No such file or directory". The offending string appears in work/.PLIST. Upon investigation, this problem appeared to arise from /dev/null being a regular file instead of a device, for unknown reasons. To work around this problem, we corrected /dev/null (removing the file and replacing it with a symbolic link to ../devices/pseudo/mm@0:null) and restarted the pkgsrc build. |
||
+ | * The system needs to be set up as a buildbot worker. |
Revision as of 03:01, 19 November 2016
This page contains notes on the setup of a Solaris buildbot worker for MIT krb5.
Our current Solaris build hardware is a Sun Fire V240 running Solaris 10 U10.
Solaris 10 includes a variety of free software tools in /usr/sfw, but not the full set of dependencies needed to checkout, build, and test the krb5 tree. We have chosen to use OpenCSW to add most of the dependencies, and local builds in /usr/local for the remaining few.
Contents
Shell setup
A root login by default uses a very minimal shell (/bin/sh) with a very minimal path (/usr/sbin:/usr/bin). For any operations performed as root, we begin by starting a functional shell as follows:
bash export PATH=/opt/csw/bin:/usr/sbin:/usr/bin:/usr/sfw/bin:/usr/ccs/bin export MANPATH=/opt/csw/share/man:/usr/share/man:/usr/sfw/share/man
Setting up OpenCSW
Begin by installing the pkgutil command (in /opt/csw/bin/pkgutil) and updating its catalog.
pkgadd -d http://get.opencsw.org/now pkgutil -U
"pkgutil -l" lists installed packages. "pkgutil -a string" looks up string in the catalog. "pkgutil -i packagename" installs a package; the -y flag can be used to skip prompts.
Install required OpenCSW packages
pkgutil -y -i git pkgutil -y -i libssl_dev pkgutil -y -i autoconf pkgutil -y -i expect pkgutil -y -i bison pkgutil -y -i emacs pkgutil -y -i gdb
OpenSSL 0.9 is present in /usr/sfw/lib, but we need 1.0 or later for PKINIT so we install the OpenCSW version. emacs and gdb are not needed to build krb5, but are handy to have around for manual testing and debugging work.
Local builds of remaining dependencies
For now, the only dependency we need to build by hand is dejagnu:
mkdir /usr/local /usr/local/src From https://ftp.gnu.org/gnu/dejagnu/ fetch the latest dejagnu; untar it in /usr/local/src cd /usr/local/src/dejagnu-version ./configure && gmake install
Create user accounts
By default, /home on Solaris is controlled by the automounter. To avoid needing to change the automounter configuration, we create user accounts with home directories in /export/home:
useradd -d /export/home/ghudson -s /bin/bash -m ghudson
Creating an account allows the Kerberos principal of the same name in the ATHENA.MIT.EDU realm to log in on that account.
To set a reasonable path for development work, the user can edit .profile to add:
PATH=/usr/local/bin:/opt/csw/bin:/usr/bin:/usr/sfw/bin:/usr/ccs/bin MANPATH=/usr/local/share/man:/opt/csw/share/man:/usr/share/man:/usr/sfw/share/man export PATH MANPATH
The following shell function, or a variant of it, may be useful for configuring a build with the correct paths. This variant is designed to work in a separate build directory placed next to the src directory within a checkout.
k5configure() { ../src/configure --enable-maintainer-mode --prefix=$HOME/inst --with-ldap CFLAGS=-g CPPFLAGS="-I/opt/csw/include" LDFLAGS="-L/opt/csw/lib -R/opt/csw/lib" "$@"; }
To do
- We do not install OpenLDAP and the MIT krb5 build currently fails with the native Solaris LDAP library for a couple of reasons (see [krbdev.mit.edu #8167]). This should be fixed.
- The system needs to be set up as a buildbot worker.