summaryrefslogtreecommitdiff
path: root/Build/source/doc/README.solaris
blob: 972a2efdba65c1252c81762d92d834609cd8915a (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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
(This file public domain.  Originally written by Mojca Miklavec, 2015-16.)

Compiling TeX binaries on Solaris

Solaris 9 has been out of official support for a while and making
software compile on that platform is challenging, so it hardly makes any
sense to try to support it.

Solaris 10 reaches end of support in January 2021:
    http://en.wikipedia.org/wiki/Solaris_(operating_system)#Version_history
and TeX Live binaries try to stay compatible with that OS version.

Every once in a while a new Update is shipped:
    U1  2006-01
    U2  2006-06
    U3  2006-11
    U4  2007-08
    U5  2008-05
    U6  2008-10
    U7  2009-05
    U8  2009-10
    U9  2010-09
    U10 2011-08
    U11 2013-01
and the problem is that binaries compiled on an updated system might not
run on an older one.

You can check the libc version with
> pvs -no /usr/lib/libc.so

> pvs -d /lib/libc.so.1 | grep SUNW
        SUNW_1.23;
        SUNW_1.22.7;
        SUNW_1.22.6;
        /.../
        SUNW_1.1;
        SUNW_0.9;
        SUNW_0.8;
        SUNW_0.7;

Building for 64-bit
===================

All binaries have been compiled with gcc-5.2.
The only thing that is needed to build for 64-bit is to define
    export CC="/path/to/gcc-5.2 -m64"
    export CXX="/path/to/g++-5.2 -m64"

Building wget
=============

Building wget on the latest version of Solaris 10 will make the binary
useless on older Updates of Solaris 10 as it would depend on SUNW_1.22.7.

One option to build wget in a "compatible way" would be to build it on
Solaris 9 with "cc".  The other hack is the usage of map files.

To make it work on older systems the following hack was used (thanks to
the OpenCSW community):
    https://buildfarm.opencsw.org/source/xref/opencsw/csw/mgar/pkg/wget/trunk/files/map.wget

> cat mapfile
libc.so - SUNW_1.22 SUNWprivate_1.1 $ADDVERS=SUNW_1.22;

export LD_OPTIONS="-M $PWD/mapfile"

And the following configuration was used to get rid of dependencies (which
are not installed on Solaris by default):

> ./configure --enable-ipv6 --disable-iri --disable-nls \
              --disable-ntlm --disable-pcre --without-libiconv-prefix \
              --without-libintl-prefix --without-libuuid --without-libpsl \
              --without-ssl --without-zlib

The binary was built with gcc 5.2.
The definition '#define _XOPEN_SOURCE 500' has been removed from 'src/sysdep.h'
to avoid compile error due to the fact that GCC 5 switched to -std=99. 

On i386 and x86_64 one has to manually add "-lsocket -lnsl" to the last linker command.
This should be reported upstream.

> pvs Master/tlpkg/installer/wget/wget.sparc-solaris
    libsocket.so.1 (SUNW_1.4);
    libnsl.so.1 (SUNW_1.7);
    librt.so.1 (SUNW_1.2);
    libc.so.1 (SUNW_1.22, SUNWprivate_1.1);

> ./Master/tlpkg/installer/wget/wget.sparc-solaris --version
    GNU Wget 1.17.1 built on solaris2.10.
    +digest -gpgme -https +ipv6 -iri +large-file -metalink -nls -ntlm 
    +opie -psl -ssl 

(That list of configure options is current as of the above version of
wget; not all those dependencies are present in earlier versions.)

Building xz
===========

The xz binaries would likewise depend on SUNW_1.22.6 by default, so we
used the same hack with a map file to make it work on slightly older
systems.

> cat mapfile
libc.so - SUNW_1.22 SUNWprivate_1.1 $ADDVERS=SUNW_1.22;

> export LD_OPTIONS="-M $PWD/mapfile"
> ./configure --disable-nls --disable-shared

> pvs Master/tlpkg/installer/xz/xz.sparc-solaris
    librt.so.1 (SUNW_1.2);
    libpthread.so.1 (SUNW_1.2);
    libc.so.1 (SUNW_1.22);
> pvs Master/tlpkg/installer/xz/xzdec.sparc-solaris
    libc.so.1 (SUNW_1.22);

If users need binaries to run on even older systems, we can target what
is desired by changing the map file.

Building asymptote
==================

Asymptote has been built with the following flags:

export CC=/opt/csw/bin/gcc-5.2
export CXX=/opt/csw/bin/g++-5.2
./configure --prefix=/tmp/asyinst --enable-texlive-build \
    --disable-fftw --disable-offscreen \
    --disable-gl --disable-gsl --disable-readline

Even though GL, GSL and readline should generally not be disabled,
the resulting binaries would not be portable enough otherwise.

Because a newer gcc compiler was used we had to link statically against stdlib.
In the last command that builds the asy binary the following part:
    -lnsl -lrt -lz -lm gc-7.4.2/.libs/libgc.a
was replaced by:
    gc-7.4.2/.libs/libgc.a -nodefaultlibs -Wl,-Bstatic -lstdc++ \
    -Wl,-Bdynamic -lnsl -lrt -lz -lm -lgcc_eh -lgcc -lc

The resulting binary depends on:

> pvs asy
    libnsl.so.1 (SUNW_0.7);
    librt.so.1 (SUNW_1.2);
    libm.so.2 (SUNW_1.2);
    libc.so.1 (SUNW_1.22, SUNWprivate_1.1);
> ldd asy
    libnsl.so.1 =>   /lib/libnsl.so.1
    librt.so.1 =>    /lib/librt.so.1
    libz.so.1 =>     /usr/lib/libz.so.1
    libm.so.2 =>     /lib/libm.so.2
    libc.so.1 =>     /lib/libc.so.1
    libmp.so.2 =>    /lib/libmp.so.2
    libmd.so.1 =>    /lib/libmd.so.1
    libscf.so.1 =>   /lib/libscf.so.1
    libaio.so.1 =>   /lib/libaio.so.1
    libdoor.so.1 =>  /lib/libdoor.so.1
    libuutil.so.1 => /lib/libuutil.so.1
    libgen.so.1 =>   /lib/libgen.so.1

Additional notes:

* gc-7.4.2 doesn't support sparc properly, so the sources for sparc were fetched from
  https://github.com/ivmai/bdwgc/tree/release-7_4
  and put into gc-7.4.2
  Running ./autogen.sh was needed before proceeding

* Workarounds were needed for:
  * https://github.com/vectorgraphics/asymptote/issues/19
    CC and CXX env variables are not respected when building GC
  * https://github.com/vectorgraphics/asymptote/issues/20
    Provide a configure-time option to disable sigsegv
  * https://github.com/vectorgraphics/asymptote/pull/21
    Makefile.in: replace 'test ! -e' => 'test ! -s'
  * https://github.com/vectorgraphics/asymptote/issues/22
    Wrong expansion of revision in Bourne Shell

* Patches used are listed below.

Building texlive
================

Additional settings were needed to compile TeX Live with gcc 5.2:
  * ./Build --without-iconv

The '--without-iconv' makes sure to avoid linking against libiconv
which is not available on SunOS by default.

luajittex seems to be broken on Solaris 10 x86_64 (even if it works
with Solaris 11) and doesn't support Sparc, so it was only compiled
for i386.

upmendex is broken on x86_64 by default. A workaround is to use
    export CFLAGS='-DU_IS_BIG_ENDIAN=0'
    export CXXFLAGS='-DU_IS_BIG_ENDIAN=0'
which seems to result in slower binaries for mysterious reasons.
For that reason binaries were compiled twice, once without those flags
and --disable-upmendex and the second time with those two flags,
but taking just 'upmendex'.

Patches for Asymptote
=====================

--- Makefile.in (revision 40918)
+++ Makefile.in (working copy)
@@ -114,7 +114,7 @@
        fi
 
 version: $(GCLIB) $(FILES:=.o)
-       if test ! -e revision.cc -o "$(revision)" != "$(last)"; then     \
+       if test ! -s revision.cc -o "$(revision)" != "$(last)"; then     \
          echo $(REVISION)\"$(revision)\"\; > revision.cc; \
        fi
        $(CXX) $(OPTS) $(INCL) -o revision.o -c revision.cc;
@@ -160,7 +160,7 @@
          mv gc-7.2 gc-7.2d; \
        fi
        cd $(GC) && \
-       ./configure $(GCOPTIONS); \
+       ./configure CC="$(CC)" CXX="$(CXX)" $(GCOPTIONS); \
        $(MAKE) check

 $(GCPPLIB): $(GCLIB)
--- configure.ac        (revision 40918)
+++ configure.ac        (working copy)
@@ -223,15 +223,15 @@
 AC_SUBST(OPTIONS)
 
 # Checks for libraries.
-AC_CHECK_LIB([ncurses], [setupterm], [AC_DEFINE(HAVE_LIBCURSES)
-                        LIBS=$LIBS"-lncurses "],
-                        AC_CHECK_LIB([curses], [setupterm]))
+#AC_CHECK_LIB([ncurses], [setupterm], [AC_DEFINE(HAVE_LIBCURSES)
+#                       LIBS=$LIBS"-lncurses "],
+#                       AC_CHECK_LIB([curses], [setupterm]))
 AC_CHECK_LIB([m], [sqrt],,
 AC_MSG_ERROR([*** Please install libm on your system ***]))
 AC_CHECK_LIB([z], [deflate],,
 AC_MSG_ERROR([*** Please install libz or zlib-devel on your system ***]))
 AX_PTHREAD
-AC_CHECK_LIB([sigsegv], [stackoverflow_install_handler])
+#AC_CHECK_LIB([sigsegv], [stackoverflow_install_handler])
 AC_CHECK_LIB([rt], [sched_yield])
 
 AC_ARG_ENABLE(readline,
@@ -254,7 +254,7 @@
 # Checks for header files.
 AC_HEADER_SYS_WAIT
 AC_CHECK_HEADERS([fenv.h stddef.h libintl.h])
-AC_CHECK_HEADERS([ncurses/curses.h ncurses.h curses.h], [break])
+#AC_CHECK_HEADERS([ncurses/curses.h ncurses.h curses.h], [break])
 AC_CHECK_HEADERS(fpu_control.h)
 
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include "xstream.h"])],