🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.interviews
Article #472

IV 3.1beta and gcc 2.2.2

#472
From: Graham Roberts
Date: Fri, 14 Aug 1992 16:05
286 lines
8516 bytes
As there have been a number of responses to my previous message about
dynamic link libraries with gcc2.2.2, I am posting the patches and local.def
file that I used to compile them. 

The problems compiling IV3.1beta with gcc 2.2.2 are due to compiler bugs,
not any inherent incompatibility between the two. There are only a 
handful of patches needed and they only took short time to find (experience
helps a lot here, both of Interviews and unix programming).

My setup is SUN4 running OS 4.1.1, gcc 2.2.2 and libg++2.2. I did not
make the Dispatch classes as iostream in libg++ is significantly different
from that assumed by Dispatch (and I already had useable rpc classes for
c++ with InterViews).

All the src/bin example programs compiled, with the exception of doc
which is the victim of another compiler bug. I have not attempted to 
patch doc.

I also discovered one runtime bug with steppers on scrollbars which caused
a segmentation fault. Also up direction steppers on scrollbars didn't work.
There is a semi-fix for this in scrbox.c but it needs doing properly.

The dynamic libraries are in use at this site by a number of people
and seem to be holding up fine. 

Graham
G.Roberts@uk.ac.ucl.cs

------------------------------ cut here -------------------------
Patches to source code for gcc 2.2.2 with libg++2.2 on SUN4 SunOS 4.1.1,
producing dynamic link libraries:
In lib/InterViews
diff adjust.c adjust.c.orig
107c107
<     if (Math::equal(s, float(0), float(1e-4))) {
---
>     if (Math::equal(s, float(0), 1e-4)) {

diff scrbox.c scrbox.c.orig
88,91c88,89
< //    impl_ = new TBScrollBoxImpl;
<     timpl_ = new TBScrollBoxImpl;  
< //    TBScrollBoxImpl& sb = *impl_;
<     TBScrollBoxImpl& sb = *timpl_;
---
>     impl_ = new TBScrollBoxImpl;
>     TBScrollBoxImpl& sb = *impl_;
100,101c98
< //    delete impl_;
<     delete timpl_;
---
>     delete impl_;
106,107c103
< //    TBScrollBoxImpl& sb = *impl_;
<     TBScrollBoxImpl& sb = *timpl_;
---
>     TBScrollBoxImpl& sb = *impl_;
142,143c138
< //    TBScrollBoxImpl& sb = *impl_;
<     TBScrollBoxImpl& sb = *timpl_;
---
>     TBScrollBoxImpl& sb = *impl_;
161,162c156
< //    TBScrollBoxImpl& sb = *impl_;
<     TBScrollBoxImpl& sb = *timpl_;
---
>     TBScrollBoxImpl& sb = *impl_;
180,181c174
< //    TBScrollBoxImpl& sb = *impl_;
<     TBScrollBoxImpl& sb = *timpl_;
---
>     TBScrollBoxImpl& sb = *impl_;
201,202c194
< //    impl_->canvas_ = nil;
<     timpl_->canvas_ = nil;
---
>     impl_->canvas_ = nil;
207,208c199
< //    impl_->changed_ = true;
<     timpl_->changed_ = true;
---
>     impl_->changed_ = true;
287,288c278
< //    TBScrollBoxImpl& sb = *impl_;
<     TBScrollBoxImpl& sb = *timpl_;
---
>     TBScrollBoxImpl& sb = *impl_;
303,304c293
< //    TBScrollBoxImpl& sb = *impl_;
<     TBScrollBoxImpl& sb = *timpl_;
---
>     TBScrollBoxImpl& sb = *impl_;
316,321d304
< if (new_start < sb.start_)
<   {
<     if (new_start != 0)
<       sb.start_ = new_start - 1 ;
<   }
< else


 diff stepper.c stepper.c.orig
37,38c37,38
< // declareIOCallback(Stepper);
< // implementIOCallback(Stepper);
---
> declareIOCallback(Stepper);
> implementIOCallback(Stepper);
40,51d39
< class StepperCallBack : public IOHandler
<   {
<     public :
<       StepperCallBack(Stepper* s)  { rec = s ; }
< 
<       virtual void timerExpired(long s, long u) { rec->tick(s,u) ; }
< 
<     private :
<       Stepper* rec ;
<   } ;
< 
< 
61,62c49
< //    timer_ = new IOCallback(Stepper)(this, &Stepper::tick);
<     timer_ = new StepperCallBack(this) ;
---
>     timer_ = new IOCallback(Stepper)(this, &Stepper::tick);

In lib/Unidraw
diff catcmds.c catcmds.c.orig 
283,285c283
< //    domain = (domain == nil) ? "component" : domain;
<       if (domain == nil)
<           domain = "component" ;
---
>       domain = (domain == nil) ? "component" : domain;
372,375c370
< //            domain = (domain == nil) ? "component" : domain;
<       if (domain == nil)
<           domain = "component" ;
< 
---
>             domain = (domain == nil) ? "component" : domain;
422,425c417
< //    domain = (domain == nil) ? "component" : domain;
<       if (domain == nil)
<           domain = "component" ;
< 
---
>     domain = (domain == nil) ? "component" : domain;

In include/InterViews
diff scrbox.h scrbox.h.orig
80,81c80
< //    TBScrollBoxImpl* impl_;
<     TBScrollBoxImpl* timpl_;
---
>     TBScrollBoxImpl* impl_;


   ---------------------------------------------------------------------
My version of local.def (params.def is left unchanged).

/*
 * For now, just assume cfront 2.0.
 * If you are using cfront 2.1, then use -Dcplusplus_2_1.
 */
#undef LanguageCCDefines
#define LanguageCCDefines -Dcplusplus_2_0

/*
 * Default customization of kits.
 * Possible flags to define:
 *	sgi_motif_kit (SMFKit), motif_kit (MFKit),
 *	openlook_kit (OLKit), bw_kit (MonoKit)
 */
#ifndef KitFlags
#define KitFlags -Dmotif_kit -Dsgi_motif_kit -Ddefault_kit=SMFKit
#endif

/*
 * Delete this definition if your /tmp space is less than five megabytes.
 */
#undef HasLargeTmp
#define HasLargeTmp YES

/*
 * If you do not want to create a symbolic link called "/interviews"
 * that points at /..../iv/installed, you should replace /interviews
 * below with the name of the symbolic link you do want to use (say,
 * /usr/local/interviews).  If you don't want to create a symbolic
 * link at all, replace /interviews with the absolute pathname of
 * /..../iv/installed so InterViews applications still can find the
 * installed data files.
 */
#undef InstalledRoot
#define InstalledRoot /cs/research/coside/local/croissant/InterViews_3.1

/*
 * If the X11 config files are not in /usr/lib/X11/config, the X11
 * includes are not in /usr/include, or the X11 libraries are not in
 * /lib, /usr/lib, or /usr/local/lib, then you should specify their
 * actual locations here.
 *
 * If you have to set XConfigDir, don't forget to override XCONFIGDIR
 * on the command line when saying "make World" for the first time.
 */
/*
#undef XConfigDir
#define XConfigDir /usr/X11R5/lib/X11/config
#undef XIncDir
#define XIncDir /usr/X11R5/include
#undef XLibDir
#define XLibDir /usr/X11R5/lib
*/

#undef XConfigDir
#define XConfigDir /usr/ucl/lib/X11/config
#undef XIncDir
#define XIncDir /usr/ucl/include/X11
#undef XLibDir
#define XLibDir /usr/ucl/lib/X11

#undef CCDriver
#define CCDriver g++

#undef HasSunOSSharedLibraries
#define HasSunOSSharedLibraries YES

#undef InstallRelative
#define InstallRelative NO

#undef OSMajorVersion
#define  OSMajorVersion 4

#undef OSMinorVersion
#define OSMinorVersion 1

#undef RemoveAfterInstall 
#define RemoveAfterInstall NO

#undef DependCCFlags
#define DependCCFlags $(CCDEFINES) $(CCINCLUDES) -I/cs/research/coside/local/croissant/lib/g++-include -I/cs/research/coside/local/croissant/lib/gcc-lib/sparc-sun-sunos4.1/2.2.2/include

#undef SharedCCFlags
#define SharedCCFlags 

#undef ExtraCCIncludes
#define ExtraCCIncludes -I/cs/research/coside/local/croissant/lib/g++-include

#undef CCFlags
#define CCFlags -g $(APP_CCFLAGS) $(IV_CCFLAGS) $(EXTRA_CCFLAGS)


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

In rules.def I changed the shared library rule to remove
the assert pure-text stuff
/*
 * Make a shared library.
 */
#ifndef NormalSunOSSharedLibraryTarget
#define NormalSunOSSharedLibraryTarget(libname,rev,depobjs,ldobjs)	@@\
AOUT = Concat(lib,libname.so.rev)					@@\
SHARED_CCFLAGS = SharedCCFlags						@@\
									@@\
AllTarget(Concat(lib,libname.so.rev))					@@\
									@@\
Concat(lib,libname.so.rev): depobjs					@@\
	@echo "building $@"						@@\
	$(RM) $@~							@@\
	$(LD) -o $@~ ldobjs				@@\
	$(RM) $@							@@\
	$(MV) $@~ $@							@@\
									@@\
clean::									@@\
	$(RM) Concat(lib,libname.so.rev)
#endif


The diff from the original is:
diff rules.def rules.def.orig
412c412
<       $(LD) -o $@~ ldobjs                             @@\
---
>       $(LD) -o $@~ -assert pure-text ldobjs                           @@\
Technical Details
Message-ID: <2862@ucl-cs.uucp>
Path: arc1-ca.pugleaf.net!sparky!uunet!pipex!warwick!nott-cs!ucl-cs!news

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!pipex!warwick!nott-cs!ucl-cs!news
From: G.Roberts@cs.ucl.ac.uk (Graham Roberts)
Newsgroups: comp.windows.interviews
Subject: IV 3.1beta and gcc 2.2.2
Message-ID: <2862@ucl-cs.uucp>
Date: 14 Aug 92 16:05:06 GMT
Sender: news@cs.ucl.ac.uk
Lines: 288