Why so many problems installing on Solaris?

These notes were contributed by (simon.hood@umist.ac.uk) while installing PM3-1.1.14 on a Sun Ultra 5 running Solaris 2.8. They describe various problems and their solution or workaround.

The installation of PM3 on Solaris systems is particularly prone to problems as these systems tend to be an unpredictable (from the point of view of the PM3 people) mixture of Sun and Gnu software --- Sun do not bundle a C compiler with the operating system.

My machine has gcc version 2.95.2 installed; it has Sun's versions of make, ld, as and ar installed within /usr/ccs/bin; Gnu's version of these tools are not installed.

My installation was successful, after a bit of fiddling around with the configuration/template files and environment variables. Some of the fixes are trivial (if you know what you are doing), while others --- for me at least --- were not --- I am a Modula 3 novice and far from experienced with Solaris.

The issues that arose are:

Initial Problems

Paths
gcc is usually installed in /usr/local/bin; on a Solaris machine, ar, as, make and ld are all in /usr/ccs/bin, by default. Hence these must both be on root's path (assuming you are installing as root). Neither were; I have not changed any paths since installation of Solaris 2.8 on a new machine a few days ago.

This is in addition to /usr/local/pm3/bin, as mentioned by the PM3 installation instructions.


byacc/yacc
The build required byacc. yacc is installed in /usr/ccs/bin; a soft link:
     lrwxrwxrwx   1 root     other          4 Aug 11 15:45 byacc -> yacc
  
solved this problem.


Library Paths
In addition to /usr/local/pm3/lib/m3 as mentioned by the PM3 installation instructions LD_LIBRARY_PATH must include /usr/local/lib so that libstdc++ (part of the gcc distribution) can be found.


CC
In addition I found that the environment variable CC needed to be set to /usr/local/bin/gcc. This is of course mentioned in the PM3 installation instructions.

Linking Problems

The two controlling configuration files for the SOLgnu distribution are With the configuration files pm3-1.1.14/m3config/src/COMMON and pm3-1.1.14/m3config/src/SOLgnu. These appear to be set with options appropriate to Gnu's ld. Sun's ld does not understand the option -soname <thing> and this leads to problems.

Whilst compiling m3core (to obtain libm3core.a and libm3core.so)

   ---------- building m3core in libs ----------
the following error message scrolled past (and did not cause the build to stop):
     -> archiving libm3core.a
   /usr/ccs/bin/ld: illegal option -- X
   /usr/ccs/bin/ld: illegal option -- X
   ld: fatal: file libm3core.so.1: open failed: No such file or directory
As a result the shared object (libm3core.so) is not built which leads to
  /usr/local/pm3/lib/m3/pkg/m3core/SOLgnu
    libm3core.so
 
   m3ship: quake error: quake error: runtime error: install failed with \
       error code: 1
 
   --procedure--  -line-  -file---
   error              --  
   install_file       51  /export/home/simonh/__download/_m3/pm3-1.1.14/src/ \
       ../m3config/src/SOLgnu
   224 /export/home/simonh/__download/_m3/pm3-1.1.14/libs/m3core/SOLgnu/.M3SHIP
I made the following changes. To pm3-1.1.14/m3config/COMMON, within the procedure m3_make_shared_lib:
    %local cmd = [MAKESHLIB_CMD, "-o", lib_so, SONAME_OPTION, lib_sox, objects]
    local cmd = [MAKESHLIB_CMD, "-o", lib_so, objects]
(This stops the -soname <thing> option being sent to the linker.) And to pm3-1.1.14/m3config/SOLgnu:
    %VERBOSE = ""
    VERBOSE = "T"
(to try to force the build to tell us more of what its actually doing --- the commands it issues) and
    %MAKESHLIB = [ "/usr/ccs/bin/ld", "-dy", "-G", "-z", "text" ]
    MAKESHLIB = ["gcc","-shared"]  % Shared library builder
which means that gcc is called to do the linking (it in turn calls /usr/ccs/bin/ld).

The above changes cured the problems I encountered with the build of the Modula 3 system itself. In addition two packages --- gnuemacs and m3gdb --- failed to build. I have not yet forced them to build successfully. Details below.

The gnuemacs package

This package would not build. The error message is given below. The package requires that Gnu Emacs is installed on the system. Since it is not installed on all systems a flag is available within pm3-1.1.14/src/m3makefile...simply define it (to anything):

      SKIP_GNUEMACS="T"
and this package will be skipped. (Gnu Emacs *is* on my system, installed under /usr/local; I have not yet been able to build this package.)

---------- building gnuemacs in language/modula3/m3tools ----------

/export/home/simonh/__download/_m3/pm3-1.1.14/src/../boot-SOLgnu/m3build/SOLgnu/m3build -T /export/home/simonh/__download/_m3/pm3-1.1.14/src/../m3config/src -F /export/home/simonh/__download/_m3/pm3-1.1.14/src/../SOLgnu/config.tmpl
--- building in SOLgnu ---
emacs -batch -f batch-byte-compile m3tags.el

m3build: quake error: quake error: runtime error: exec failed: errno=22 *** emacs

--procedure--  -line-  -file---
exec               --  
emacs_compile     357  /export/home/simonh/__download/_m3/pm3-1.1.14/m3config/src/COMMON
CompiledGnuemacs      --  
                   26  /export/home/simonh/__download/_m3/pm3-1.1.14/language/modula3/m3tools/gnuemacs/src/m3makefile


m3build: quake error: quake error: runtime error: m3build failed with error code: 1

--procedure--  -line-  -file---
error              --  
BuildChunk        169  /export/home/simonh/__download/_m3/pm3-1.1.14/src/m3makefile
PkgInfo           248  /export/home/simonh/__download/_m3/pm3-1.1.14/src/m3makefile
                  455  /export/home/simonh/__download/_m3/pm3-1.1.14/src/PACKAGES

*** Error code 1
make: Fatal error: Command failed for target `packages'

The m3gdb package

This package would not build. The error message is given below. A comment in pm3-1.1.14/src/m3makefile indicates that there have been problems building this package on other platforms; a flag is available within this makefile...simply define it (to anything):

      SKIP_M3GDB="T"
and this package will be skipped.


In file included from /usr/include/sys/old_procfs.h:32,
                 from /usr/include/sys/procfs.h:29,
                 from ../../gdb/gdb/sparc-tdep.c:33:
/usr/include/sys/procfs_isa.h:57: conflicting types for `prgregset_t'
/usr/include/sys/regset.h:107: previous declaration of `prgregset_t'
/usr/include/sys/procfs_isa.h:165: conflicting types for `prfpregset_t'
/usr/include/sys/regset.h:277: previous declaration of `prfpregset_t'
*** Error code 1
make: Fatal error: Command failed for target `sparc-tdep.o'
Current working directory /export/home/simonh/__download/_m3/pm3-1.1.14/language/modula3/m3tools/m3gdb/SOLgnu/gdb
*** Error code 1
make: Fatal error: Command failed for target `all-gdb'
Current working directory /export/home/simonh/__download/_m3/pm3-1.1.14/language/modula3/m3tools/m3gdb/SOLgnu
--- building in SOLgnu ---

m3build: quake error: quake error: runtime error: Failed to build m3gdb

--procedure--  -line-  -file---
error              --  
                   60  /export/home/simonh/__download/_m3/pm3-1.1.14/language/modula3/m3tools/m3gdb/src/m3makefile


m3build: quake error: quake error: runtime error: m3build failed with error code: 1

--procedure--  -line-  -file---
error              --  
BuildChunk        169  /export/home/simonh/__download/_m3/pm3-1.1.14/src/m3makefile
PkgInfo           248  /export/home/simonh/__download/_m3/pm3-1.1.14/src/m3makefile
                  150  /export/home/simonh/__download/_m3/pm3-1.1.14/src/PACKAGES

*** Error code 1
make: Fatal error: Command failed for target `packages'


Hope this helps! 2000 August 16, ISD, UMIST, England.