On Tue, Dec 3, 2019 at 5:05 AM kamallochan Jena via Boost-users <boost-users@lists.boost.org> wrote:
Hi  Piotr and All,

On further analysis in boost code, I found below line of code causing "./bootstrap.sh"  to fail in SunOS.
Can some one look into it and suggest for a fix for Error 2.

Error 1  :    ./build.sh: syntax error at line 143: `machine=$' unexpected
   
      File name:   build.sh
      Line No    :   143 
      Fix           :    machine=`gcc -dumpmachine 2>/dev/null`     <-------  Piotr suggested


Error 2      clock_gettime                       timestamp.o
                    ld: fatal: symbol referencing errors. No output written to bootstrap/jam0

      File name: boost_1_70_0/tools/build/src/engine/timestamp.c
      Function:  timestamp_current() 
      Problematic code : line no 135 to 144, which are introduced in latest boost releases.

===============
   126  void timestamp_current( timestamp * const t )
   127  {
   128  #ifdef OS_NT
   129          /* GetSystemTimeAsFileTime()'s resolution seems to be about 15 ms on Windows
   130          * XP and under a millisecond on Windows 7.
   131          */
   132         FILETIME ft;
   133         GetSystemTimeAsFileTime( &ft );
   134         timestamp_from_filetime( t, &ft );
   135  #elif defined(_POSIX_TIMERS) && defined(CLOCK_REALTIME) && \
   136      (!defined(__GLIBC__) || (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 17))
   137         /* Some older versions of XCode define _POSIX_TIMERS, but don't actually
   138          * have clock_gettime.  Check CLOCK_REALTIME as well.  Prior to glibc 2.17,
   139          * clock_gettime requires -lrt.  This is a non-critical feature, so
   140          * we just disable it to keep bootstrapping simple.
   141          */
   142          struct timespec ts;
   143          clock_gettime( CLOCK_REALTIME, &ts );            <------------------------ It is causing ./bootstrap.sh fail with Error: 
ld: fatal: symbol referencing errors. No output written to bootstrap/jam0  

The clock_gmtime function is part of POSIX. But it looks like your compiler is not including the appropriate POSIX runtime library automatically. If it's the SunOS "cc" compiler you can change this line <https://github.com/boostorg/build/blob/boost-1.70.0/src/engine/build.sh#L253> to:

    BOOST_JAM_CC="cc -lrt"

Per current Oracle docs <https://docs.oracle.com/cd/E19109-01/tsolaris7/805-8069/6j7j9vnt1/index.html>. If it's some other compiler you'll have to find the equivalent BOOST_JAM_CC line and add that "-lrt" option.

--
-- Rene Rivera
-- Grafik - Don't Assume Anything
-- Robot Dreams - http://robot-dreams.net