Problems compiling ROOT on SunOS 5.6 with egcs 1.1.2

From: Daniel Flath (dflath@SLAC.stanford.edu)
Date: Thu Oct 07 1999 - 19:27:31 MEST


Hello,

With a little effort I have been able to compile ROOT 2.22/10 on SunOS
5.6 using egcs 1.1.2.  The following were problems that I encountered.

PROBLEM 1:

Receive following error message during build:

g++ -O2 -o /u/ey/dflath/Gismo/sunroot/root//bin/root.exe MAIN_rmain.o
-L/u/ey/dflath/Gismo/sunroot/root//lib -lNew -lBase -lCint -lClib -lCont
-lFunc -lGraf -lGraf3d -lHist -lHtml -lMatrix -lMeta -lMinuit -lNet
-lPhysics -lPostscript -lProof -lTree -lUnix -lZip -lGpad -lGui -lGX11
-lX3d -lXpm -lRint -L/usr/openwin/lib -lX11 -lm -lgen -ldl -lsocket
Undefined                       first referenced
 symbol                             in file
sincos
/u/ey/dflath/Gismo/sunroot/root//lib/libBase.so

Solution:

(a) Changed lines in MAIN_rmain.cxx as follows:

FROM:

(See below for description of change)

#if ((defined(sun) && !defined(R__I386) && !defined(__SunOS_5_6)) || 
    (defined(__OPTIMIZE__) && (__GNUC__ > 2 || (__GNUC__ == 2 &&
__GNUC_MINOR__ > 7))))
        extern "C" void sincos(Double_t, Double_t*, Double_t*);
#else
    inline void sincos(Double_t a, Double_t *sinp, Double_t *cosp) 
        { *cosp = cos(a); *sinp = sin(a); }
#endif

TO:

#if (!defined(__SunOS_5_6) && ((defined(sun) && !defined(R__I386)) || 
    (defined(__OPTIMIZE__) && (__GNUC__ > 2 || (__GNUC__ == 2 &&
__GNUC_MINOR__ > 7)))))
        extern "C" void sincos(Double_t, Double_t*, Double_t*);
#else
    inline void sincos(Double_t a, Double_t *sinp, Double_t *cosp) 
        { *cosp = cos(a); *sinp = sin(a); }
#endif


(b) and added " -D__SunOS_5_6 " to the CXXFLAGS variable in
Makefile.solarisegcs.  Obviously this would have to be done manually by
anyone using SunOS 5.6, but it would be nice if that was the only change
that was necessary.

Comments:

I made the " !defined(__SunOS_5_6) " a necessary condition in the if
statement.  I have seen RootTalk issues that dealt with this by changing
" defined(sun) " to " !defined(sun) " -- but this is more restrictive
than I need and doesn't work anyway because the expression that made the
if statement evaluate true was  "... || (defined(__OPTIMIZE__) &&
(__GNUC__ > 2 || (__GNUC__ ==2 && __GNUC_MINOR__ > 7))) ".  I have gcc
2.91.66.  If one was using earlier versions of gcc I assume the other
fix would work but the fix I'm suggesting should work in both cases.

Is there a preferred solution to this, and will the distribution source
be modified in a future release?    I couldn't find any comments from
Rene or Fons addressing the earlier postings of this issue.


PROBLEM 2:

More undefined symbols, this time things like:
	socket,
	getHostByAddress,
	getHostByName,
	etc.

To fix this I added the statement " -L/usr/include/sys -lsocket -lnsl "
to the SYSLIBS variable definition in Makefile.solarisegcs.  The
variable SYSXLIBS attempts to include the socket library from
/usr/openwin/lib.  It won't find it there on my solaris machine.  It
won't find the getHostByAddress function in any of the libraries it
looks for, either, so I had to add the sys/nsl library for that.

Is this just a difference in the setup from one solaris machine to the
next, or has anyone else encountered this problem on SunOS 5.6?  I
couldn't find anything in RootTalk dealing with this.  If this is a
common problem it would be nice if it were corrected in a future
release.

Regards,
Dan.

Daniel Flath
LCD Group
Stanford Linear Accelerator Center
<dflath@slac.stanford.edu>
(650) 926-8794



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:40 MET