summaryrefslogtreecommitdiff
path: root/bootstrap/README.Solaris
blob: d80c5ff9316362a640079fe47a843929f3449234 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
$NetBSD: README.Solaris,v 1.25 2022/04/05 14:00:02 nia Exp $

This README describes pkgsrc on a variety of Solaris-derived operating
systems.  It corresponds to pkgsrc/platform/SunOS.mk.  The relevant
operating systems are:
  - illumos (open source fork, OpenIndiana, OmniOS, SmartOS, and others)
  - Solaris (from Sun/Oracle, also Sun Solaris, Oracle Solaris)
  - OpenSolaris (from Sun; superseded long ago by illumos)

As of 2022, the primary platforms of interest where pkgsrc is known to
work well are illumos distributions, Solaris 10, and Solaris 11.
pkgsrc is not currently known to work on SunOS 4 or OpenSolaris.

Prerequisites
-------------

You will need a working C compiler.  The two known options are gcc and
Sun/Solaris Studio.  gcc can come from the OS vendor, or other places.
On some systems, it may only be possible to use the vendor gcc, or
there might be no vendor gcc available by default.  In general, there's
better support for gcc in third-party software, and much better support
for gcc on illumos.

As with pkgsrc on other platforms, one should use the same compiler
family and ideally the same compiler version for building all packages.

At some time in the past, GNU binutils was not usable on some systems,
but the status is unclear in 2022.

The following packages are the minimum required on Solaris 8 to
bootstrap and build packages.

	- SUNWsprot
	- SUNWarc
	- SUNWbtool
	- SUNWtoo
	- SUNWscpu
	- SUNWxcu4

Realistically you will need more, such as SUNWlibm, and SUNWlibC for
C++ packages if you are using SunPro.

Solaris Zones:

If you are trying to bootstrap pkgsrc in a Solaris [8-10] Zone then you will
need to install the following packages (assuming you will bootstrap using
Sun's gcc package):

	- SUNWgccruntime
	- SUNWgcc
	- SUNWbinutils
	- SUNWbtool
	- SUNWggrp
	- SUNWxcu4
	- SUNWcs
	- SUNWsprot
	- SUNWlibm
	- SUNWloc
	- SUNWsndm

On illumos you can configure a ipkg or sparse branded zone to host your
pkgsrc tree. Since the software database is generally managed
independently from the host, the same essential development tools,
required to deploy pkgsrc on the host distribution, need to be installed
within the zone.

OmniOS also provides pkgsrc branded zones. A pkgsrc zone is a sparse
zone which is pre-configured to use Joyent’s binary package repository.
Refer to https://omnios.org/setup/zones

General
------

Solaris and illumos come by default with a mixed {32,64}-bit
userland.  This can include the compiler, which may have shipped as a
32-bit ELF.  In this case, the compiler by default will create 32-bit
executables and shared libraries, unless told otherwise.

To build 64-bit binaries, pass '--abi=64' to bootstrap, and also see
the crle(1) man page to configure the runtime linking environment.
64-bit runtime libraries can be usually found at /usr/lib/amd64.
NB: passing '-m64' to the compiler is not needed when using --abi=64.

It is unclear whether --abi=64 is still a requirement on some modern
illumos distributions, which provide a 64bit compiler. Joyent doesn't
mention it in their pkgsrc bootstrap guide for SmartOS.

Generally, illumos-based distributions come with gcc, and gcc is the
standard approach.  As of 2022, there are no recent reports of using
Sun/Oracle toolchains on illumos.


If you are using gcc
--------------------

If the gcc installation is not in your $PATH you will need to pass
additional flags to bootstrap, for example:

	env CC=/opt/gcc-4.6.3/bin/gcc \
	    GCCBASE=/opt/gcc-4.6.3 \
	    ./bootstrap --abi=64

It is recommended that an external gcc be used only for bootstrapping,
and that you set USE_PKGSRC_GCC=yes in mk.conf so that the appropriate
pkgsrc gcc is installed and used.

Binary SVR4 packages of gcc can be found through:
https://www.opencsw.org/get-it/packages/
The CSW repo is most useful on Solaris 10, OpenSolaris and SXCE. 

On Solaris 11 it is preferrable to install the IPS package for the
preferred GCC version, available in the official repository. 

See https://wiki.netbsd.org/pkgsrc/solarish/ for information about
installing gcc on various illumos distributions.  One can use a
distribution-provided gcc, or a gcc that has been built from sources.

Alternatively, see https://pkgsrc.joyent.com/install-on-illumos/ for
binary kits and initial packages (including gcc) that run on illumos
variants.


If you are using Solaris Studio
---------------------------

This section describes the use of Sun-provided compilers, variously
termed WorkShop and Studio.

You must ensure that the compiler tools and your $prefix are in your
PATH.  This includes /usr/ccs/{bin,lib} and e.g. /usr/pkg/{bin,sbin}.

Usually, passing 'env CC=cc PKGSRC_COMPILER=sunpro' should be enough to
use Solaris Studio. Additional compiler settings will be generated
automatically by the boostrap process and written to $PREFIX/etc/mk.conf   

In the past, however, the following mk.conf variables have been
recommended:

	CC= 	cc
	CXX=	CC
	CPP=	cc -E
	CXXCPP=	CC -E

NB: The make variable CC holds the command for the C compiler, and the
command for the C++ compiler is CC.

The following indented sections provide a list of Solaris packages
that must be installed in order for pkgsrc to build C and C++
packages.

    WorkShop 5.0:

	SPROcc		Sun WorkShop Compiler C 5.0
	SPROcpl		Sun WorkShop Compiler C++ 5.0
	SPROild		Sun WorkShop Incremental Linker
	SPROlang	Sun WorkShop Compilers common components

    Sun ONE Studio 8:

	SPROcc		Sun ONE Studio 8 Compiler C
	SPROcpl		Sun ONE Studio 8 Compiler C++
	SPROdwrfb	DwarfSupportLibrary binaries
	SPROild		Sun ONE Studio 8 Incremental Linker
	SPROlang	Sun ONE Studio 8 Compilers Common Components
	SPROsbld	Sun ONE Studio 8 Linker Stab Library
	SPROscl		Sun ONE Studio 8 Standard Class Library for C++
	SPROtlbn7	Sun ONE Studio 8 Tools.h++ 7.1 Class Library for C++
	SPROutool	Sun ONE Studio 8 Common Tools

	The corresponding 64-bit packages are also required to build
	64-bit binaries and libraries.

    Oracle Studio 12 (IPS):

	pkg:/developer/developerstudio-12[3-6]	studio
	pkg:/system/library/studio-runtime	Runtime Support For Solaris Studio

	This will install the whole toolchain, along with the
	observability tools and the studio IDE.

	If you want to select individual packages, make sure to have
	runtime libraries installed. For instance, on Studio 12.6, you
	can do that with:

	pkg install --accept developerstudio-126/library/c++-libs \
	    developerstudio-126/library/c-libs \
	    developerstudio-126/library/f90-libs \
	    developerstudio-126/library/math-libs \
	    developerstudio-126/library/perflib \
	    developerstudio-126/library/studio-gccrt

        To build with Studio 12 on Solaris 11:

	env CC=/opt/developerstudio12.*/bin/cc \
	    SUNWSPROBASE=/opt/developerstudio12.* \
	    PKGSRC_COMPILER=sunpro \
	    ./bootstrap --abi=64

	pkgsrc defaults to finding the Sun compiler in /opt/SUNWspro.
	If you use a different prefix, pass SUNWSPROBASE in the
	environment to bootstrap.  If 'cc' is not in your path, pass
	CC as well.  So, to build 64-bit Sun compiler bootstrap with a
	non-standard install:

	env CC=/opt/studio12/SUNWspro/bin/cc \
	    SUNWSPROBASE=/opt/studio12/SUNWspro \
	    ./bootstrap --abi=64

	When bootstrap is finished your default mk.conf will contain
	ABI and SUNWSPROBASE so you will not need to set these
	variables again.

Common problems
---------------

Sometimes, when using libtool, /bin/ksh crashes with a segmentation fault. The
workaround is to use another shell for the configure scripts, for example by
installing shells/bash and adding the following lines to your mk.conf:

	CONFIG_SHELL=   ${LOCALBASE}/bin/bash
	WRAPPER_SHELL=  ${LOCALBASE}/bin/bash

Then, rebuild the devel/libtool-base package.