EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: More base 3.14.12 problems on solaris-spac (version 5.8)
From: Dirk Zimoch <[email protected]>
To: EPICS <[email protected]>
Date: Fri, 01 Apr 2011 12:06:35 +0200
I got a few build failures but I could solve them.

My system is quite old: SunOS 5.8 Generic 108528-19 January 2003

4 files did not compile. 2 are tests, one belongs to CAS and one is related to ca-perl (Cap5).

Details below.

Dirk

---------------------------------------------------------------------------

make[3]: Entering directory `/afs/psi.ch/group/8431/dirk/cvs/base-3.14.12/src/libCom/test/O.solaris-sparc' /afs/psi.ch/sys/@sys/sepp/bin/CC -c -D_POSIX_C_SOURCE=199506L -D_XOPEN_SOURCE=500 -DUNIX -DSOLARIS=8 -mt -D__EXTENSIONS__ -O +w -I. -I../O.Common -I. -I.. -I/afs/psi.ch/group/8431/dirk/solaris/epics-3.14.12/include/os/solaris -I/afs/psi.ch/group/8431/dirk/solaris/epics-3.14.12/include ../epicsTimeTest.cpp "/usr/include/sys/time.h", line 50: Error: Type name expected instead of "time_t".

An analysis of the preprocessed code shows:

extern "C" {
namespace std {
typedef unsigned size_t ;
typedef long clock_t ;
typedef long time_t ;
struct tm {
int tm_sec ;
int tm_min ;
int tm_hour ;
int tm_mday ;
int tm_mon ;
int tm_year ;
int tm_wday ;
int tm_yday ;
int tm_isdst ;
} ;
extern char * asctime ( const struct tm * ) ;
extern clock_t clock ( void ) ;
extern char * ctime ( const time_t * ) ;
extern double difftime ( time_t , time_t ) ;
extern struct tm * gmtime ( const time_t * ) ;
extern struct tm * localtime ( const time_t * ) ;
extern time_t mktime ( struct tm * ) ;
extern time_t time ( time_t * ) ;
extern size_t strftime ( char * , size_t , const char * , const struct tm * ) ;
}
}
extern "C" {
struct timeval {
time_t tv_sec ;     /* here it fails */
suseconds_t tv_usec ;
} ;
struct timezone {
int tz_minuteswest ;
int tz_dsttime ;
} ;
}
using std :: time_t ;

It seems that at the moment extern "C" struct timeval is defined, time_t is only available in namespace std. Looks like a bug in the system headers. Can be solved by moving
using namespace std;
in front of
#include <ctime>

------------------------------------------------------------------

make[3]: Entering directory `/afs/psi.ch/group/8431/dirk/cvs/base-3.14.12/src/libCom/test/O.solaris-sparc' /afs/psi.ch/sys/@sys/sepp/bin/CC -c -D_POSIX_C_SOURCE=199506L -D_XOPEN_SOURCE=500 -DUNIX -DSOLARIS=8 -mt -D__EXTENSIONS__ -O +w -I. -I../O.Common -I. -I.. -I/afs/psi.ch/group/8431/dirk/solaris/epics-3.14.12/include/os/solaris -I/afs/psi.ch/group/8431/dirk/solaris/epics-3.14.12/include ../epicsTimeTest.cpp /afs/psi.ch/sys/@sys/sepp/bin/CC -o epicsTimeTest -L/afs/psi.ch/group/8431/dirk/solaris/epics-3.14.12/lib/solaris-sparc -R/afs/psi.ch/group/8431/dirk/solaris/epics-3.14.12/lib/solaris-sparc -mt -z ignore -z combreloc -z lazyload epicsTimeTest.o -lCom /afs/psi.ch/sys/@sys/sepp/bin/CC -c -D_POSIX_C_SOURCE=199506L -D_XOPEN_SOURCE=500 -DUNIX -DSOLARIS=8 -mt -D__EXTENSIONS__ -O +w -I. -I../O.Common -I. -I.. -I/afs/psi.ch/group/8431/dirk/solaris/epics-3.14.12/include/os/solaris -I/afs/psi.ch/group/8431/dirk/solaris/epics-3.14.12/include ../epicsExceptionTest.cpp
[...]
"../epicsExceptionTest.cpp", line 111: Error: Cannot create a variable for abstract class exThread.

The reason is here that the base class epicsThreadRunable has a pure virtual destructor and the derived class exThread does not define a destructor.

On the one hand, C++ specifies that if the programmer does not write a destructor, the compiler generates one. On the other hand a pure virtual method in the base class is meant to force the programmer to implement the method. It is hard to say what is correct compiler behavior if both applies.

Anyway, the solution is to define a destructor for exThread:
class exThread : public epicsThreadRunable {
public:
    exThread ();
    void waitForCompletion ();
    ~exThread() {};
private:
    epicsThread thread;
    bool done;
    void run ();
};

------------------------------------------------------------------------

make[4]: Entering directory `/afs/psi.ch/group/8431/dirk/cvs/base-3.14.12/src/cas/build/O.solaris-sparc' /afs/psi.ch/sys/@sys/sepp/bin/CC -c -D_POSIX_C_SOURCE=199506L -D_XOPEN_SOURCE=500 -DUNIX -DSOLARIS=8 -mt -D__EXTENSIONS__ -O +w -xcode=pic32 -I. -I../O.Common -I. -I.. -I../../../../src/cas/generic -I../../../../src/cas/io/bsdSocket -I../../../../src/cas/generic/st -I../../../../src/cas/../ca -I/afs/psi.ch/group/8431/dirk/solaris/epics-3.14.12/include/os/solaris -I/afs/psi.ch/group/8431/dirk/solaris/epics-3.14.12/include ../../../../src/cas/generic/st/casStreamOS.cc "../../../../src/cas/generic/st/casStreamOS.cc", line 325: Error: "casStreamOS::armSend()" has already been called and cannot be defined inline.

This can easily be solved by moving the inline functions in front of the calls. That means
inline void casStreamOS::armSend()
must come before
epicsTimerNotify::expireStatus casStreamEvWakeup::expire(const epicsTime &)

------------------------------------------------------------------------

make[3]: Entering directory `/afs/psi.ch/group/8431/dirk/cvs/base-3.14.12/src/cap5/O.solaris-sparc'
cc: Warning: illegal option -fno-strict-aliasing
/afs/psi.ch/sys/@sys/sepp/bin/cc -c -D_POSIX_C_SOURCE=199506L -D_XOPEN_SOURCE=500 -DUNIX -DSOLARIS=8 -mt -D__EXTENSIONS__ -xO4 -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -xcode=pic32 -I. -I../O.Common -I. -I.. -I/afs/psi.ch/group/8431/dirk/solaris/epics-3.14.12/include/os/solaris -I/afs/psi.ch/group/8431/dirk/solaris/epics-3.14.12/include -I/usr/local/lib/perl5/5.8.8/sun4-solaris/CORE Cap5.c
cc: Warning: illegal option -fno-strict-aliasing
"/usr/local/lib/perl5/5.8.8/sun4-solaris/CORE/proto.h", line 31: syntax error before or at: __attribute__ "/usr/local/lib/perl5/5.8.8/sun4-solaris/CORE/proto.h", line 31: warning: syntax error: empty declaration "/usr/local/lib/perl5/5.8.8/sun4-solaris/CORE/proto.h", line 41: syntax error before or at: __attribute__
[... 1700 more lines of error messages ]

Obviously the C code has been generated for the gnu compiler, not for the native compiler. Checking the result of "perl perlConfig.pl cc" shows the discrepancy. A modification in the Makefile skips this build if the current compiler and the compiler used for perl do not match:

ifeq ($(findstring $(OS_CLASS),WIN32 cygwin32),)
  # Doesn't build on WIN32
ifndef Cap5_COMPILER
Cap5_COMPILER := $(shell $(PERL) perlConfig.pl ccname)
export Cap5_COMPILER
endif
ifeq ($(notdir $(firstword $(CC))),$(Cap5_COMPILER))
  # build only when compilers for perl and EPICS match

  LOADABLE_LIBRARY_HOST = Cap5

  PERL_SCRIPTS += cainfo.pl
  PERL_SCRIPTS += caput.pl
  PERL_SCRIPTS += caget.pl
  PERL_SCRIPTS += capr.pl
  PERL_SCRIPTS += camonitor.pl

  PERL_MODULES += CA.pm
endif
endif


Replies:
Re: More base 3.14.12 problems on solaris-spac (version 5.8) Andrew Johnson
References:
base 3.14.12 problem on solaris-spac Dirk Zimoch
More base 3.14.12 problem on solaris-spac Dirk Zimoch
Re: More base 3.14.12 problem on solaris-spac Dirk Zimoch

Navigate by Date:
Prev: 3.14.12 Breaks DB file dependency checking Craig.Haskins
Next: MAXv question Dirk Zimoch
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: More base 3.14.12 problem on solaris-spac Mark Rivers
Next: Re: More base 3.14.12 problems on solaris-spac (version 5.8) Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·