Difference between revisions of "Solaris Build Environment"
Line 6: | Line 6: | ||
==Building a newer gcc== |
==Building a newer gcc== |
||
− | |||
⚫ | /usr/sfw contains gcc 3.4.3, which is adequate for building most free software but has several problems for building new packages |
||
1. Set up a shell with a path containing the needed system utilities: |
1. Set up a shell with a path containing the needed system utilities: |
||
Line 19: | Line 17: | ||
cd /usr/local/src |
cd /usr/local/src |
||
− | 3. From ftp.gnu.org, fetch the latest versions of gmp, mpfr, and mpc, and fetch gcc 5.4.0. Untar them in /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. |
4. Build gmp, mpfr, and mcc as follows. Without "ABI=32" in the configure line, gmp chooses the 64-bit ABI over the default 32-bit ABI for performance reasons. |
4. Build gmp, mpfr, and mcc as follows. Without "ABI=32" in the configure line, gmp chooses the 64-bit ABI over the default 32-bit ABI for performance reasons. |
||
Line 38: | Line 36: | ||
./configure --with-gmp=/usr/local --with-mpfr=/usr/local --with-mpc=/usr/local |
./configure --with-gmp=/usr/local --with-mpfr=/usr/local --with-mpc=/usr/local |
||
gmake && gmake install |
gmake && gmake install |
||
+ | |||
+ | ==Setting up pkgsrc== |
||
+ | |||
+ | If it becomes necessary to restart this process, "rm -rf /usr/pkgsrc /usr/pkg /var/db/pkg" will clean the slate. |
||
+ | |||
+ | 1. Set up the shell and fetch the pkgsrc tar file: |
||
+ | |||
+ | /bin/bash |
||
+ | export PATH=/usr/pkg/sbin:/usr/pkg/bin:/usr/local/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=/usr/local/bin/gcc -Wno-implicit-declaration" ./bootstrap |
||
+ | 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) |
||
+ | |||
+ | ==Problem log== |
||
+ | |||
+ | 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.) |
||
+ | |||
⚫ | * /usr/sfw contains gcc 3.4.3, which is adequate for building most free software but has several problems for building new packages. It defaults to the gnu89 standards environment, which leads to build failures when including C99 Solaris headers such as <stdbool.h>. (This could be worked around using "gcc -std=gnu99 -Wno-implicit-declaration" during bootstrap, and setting CC to that value in /usr/pkg/etc/mk.conf.) More importantly, it does not understand the -pthread or -print-multiarch options, which causes fatal errors building Python 2.7 and other pkgsrc packages. |
||
+ | |||
+ | * 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. |
||
+ | |||
+ | * 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. |
||
+ | |||
+ | * 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 files 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. |
Revision as of 11:22, 12 November 2016
This page contains notes on the setup of a Solaris buildbot worker.
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. Our chosen approach to building these additional dependencies is to use the NetBSD pkgsrc collection.
Building a newer gcc
1. Set up a shell with a path containing the needed system utilities:
/bin/bash export PATH=/usr/sbin:/usr/bin:/usr/sfw/bin:/usr/ccs/bin
2. Create /usr/local/src:
mkdir /usr/local/src 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.
4. Build gmp, mpfr, and mcc as follows. Without "ABI=32" in the configure line, gmp chooses the 64-bit ABI over the default 32-bit ABI for performance reasons.
cd /usr/local/src/gmp-version ./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/mcc-version ./configure --disable-shared LDFLAGS=-L/usr/local/lib gmake && gmake install
5. Build gcc as follows. This build takes many hours.
cd /usr/local/src/gcc-5.4.0 ./configure --with-gmp=/usr/local --with-mpfr=/usr/local --with-mpc=/usr/local gmake && gmake install
Setting up pkgsrc
If it becomes necessary to restart this process, "rm -rf /usr/pkgsrc /usr/pkg /var/db/pkg" will clean the slate.
1. Set up the shell and fetch the pkgsrc tar file:
/bin/bash export PATH=/usr/pkg/sbin:/usr/pkg/bin:/usr/local/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=/usr/local/bin/gcc -Wno-implicit-declaration" ./bootstrap 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)
Problem log
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.)
- /usr/sfw contains gcc 3.4.3, which is adequate for building most free software but has several problems for building new packages. It defaults to the gnu89 standards environment, which leads to build failures when including C99 Solaris headers such as <stdbool.h>. (This could be worked around using "gcc -std=gnu99 -Wno-implicit-declaration" during bootstrap, and setting CC to that value in /usr/pkg/etc/mk.conf.) More importantly, it does not understand the -pthread or -print-multiarch options, which causes fatal errors building Python 2.7 and other pkgsrc packages.
- 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.
- 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.
- 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 files 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.