Re: pop-forum Re: poplog-dev A look at Poplog on the Macintosh



Brent,

After fixing my lseek problem, I am now having a
problem
with the poplink command.

Ah I remember struggling with this!

When trying to make pglink produce a 'sh' rather than a 'csh' shell
script for linking and when trying to make it put unexpanded environment
variables into the script, so that the script could be more portable, I
found all sorts of difficulties, since that part of poplog has nowhere
been fully documented (as far as I know), and it is quite complex.

Basics (some of which you obviously already know):

The poplog system-building and porting utilities include a mixture of
shell scripts and pop11 programs (used as pre-built saved images)
for

a. compiling pop11 source code
using the shell script pcomp, which calls
the pop11 program popc

b. building poplog libraries from the compiled sources
using the shell script pglibr, which calls the
pop11 program poplibr

c. relinking poplog on the basis of various unix/linux libraries
and some or all of the poplog libraries (see b.)
using the shell script pglink, which calls the
popll program poplink

The programs popc, poplibr and poplink are documented for end-users
in HELP POPC and REF POPC

What I don't think is explained anywhereis what you need to change to
change how they work, or to make them work for a new system.

More gory details:

Here is what I have learnt.
When you run pglink (to run poplink) it does

1. setting up lots of environment variables, some, but not all,
based on the arguments it is given, some based on the popenv
login scripts

2. It then runs poplink to create the .o files and the poplink_cmnd
shell script

3. It then runs that script to create a newpop11 binary

4. It possibly (depending on arguments) does a few other things,
like making a newpop11.map file and possibly a binary rsvpop11
(which used to be required for commercial products based on
poplog, so that they could be distributed without a poplog
user licence).

All that behaviour depends on environment variables having been set as a
result of sourcing the login scripts:

$popcom/poplog

or for non-csh/tchs users

$popcom/poplog.sh

which in turn sources

$popcom/popenv (.sh)

$popsys/popenv (.sh) (if it exists)

[I suspect $popcom/popenv will need to be extended for OSX]

and, though it's not relevant to pglink it allows extra local
environment variables to be set here:

$poplocal/local/com/poplog (.sh)


In that process some environment variables are set (especially in the
popenv scripts) that are not relevant to ordinary users but are required
for rebuilding poplog. Some of those are concerned with the X11
subsystem.

The variables include

for motif
POP_XM_EXLIBS
XM_VER
XM_DIRS
XM_FILES

for openlook (defunct?)
POP_XOL_EXLIBS
XOL_VER
XOL_DIRS
XOL_FILES

for basic X11
POP_XT_EXLIBS
XT_VER
XT_DIRS
XT_FILES

used by pglink
POP_XLINK_EXLIBS

for compiling pop X sources
POP_X_INCLUDE

More on pglink:

'pglink' itself is a shell script

$popsys/pglink

which (eventually, after setting lots of environment variables and
building up parameters) runs the poplink program:

$popsys/poplink

That is actually a link to the $popsys/corepop executable, which, when
it finds it is run with a different name (pop_poplink) looks to see if
there is an environment variable $pop_poplink, which it uses as
argument.

So if $pop_poplink is defined as:

+/usr/local/poplog/current-poplog/pop/pop/poplink.psv

Then poplink runs:

corepop +/usr/local/poplog/current-poplog/pop/pop/poplink.psv

i.e. the equivalent of

corepop +$popsys/poplink.psv

That command uses the saved image poplink.psv created by

$popsrc/mksyscomp poplink

(mksyscomp can be used to make up to three of the poplog system-building
saved images,
$popsys/popc.psv
$popsys/poplibr.psv
$popsys/poplink.psv)

As you can tell(?) from the mksyscomp script, the poplink.psv saved
image is made by compiling the pop11 code in

$popsrc/syscomp/make_poplink.p

So, the make_poplink.p file (and the files it compiles) are used to
specify how to build the various .o files, using

some unix/linux system libraries,
the library files in $popexternlib
and the files produced by pgcomp and pglibr in
$usepop/pop/obj/
i.e. src.wlb src.olb, vedsrc.wlb vedsrc.olb, xsrc.wlb xsrc.olb

That means that when porting to a new system, in addition to changing
the pop11 compiler code it is necessary to change the files relevant
to linking:

$popcom/popenv
$popsys/pglink
$popsrc/syscomp/make_poplink.p

and unfortunately the latter can use environment variables set up in
the others in quite obscure ways.

I currently compile the various *.p and *.s files
using the pgcomp command,

after which you presumably run pglibr to create the three sets of .wlb
and .olb files in

$usepop/pop/obj/

which leaves me with everything I
need except for the poplink_[1234].o and
poplink_data.o files.

For now, I copied them from the 15.53e tree.
I can then link a working newpop11 using the
poplink_cmnd
file from the original 15.53e tree.

I can also generate the src.wlb/src.old files
using the "pglibr -c ./ *.w" command.

So far, so good.

Since all of this works, I then tried running the
pglink command to produce the newpop11 executable,
but this fails:

Chaz:~/Projects/poplog/poplog_osx/v15.6/pop/pop brent$
pglink -safe
UNINITIALISED CONSTANT $-Sys$-_exfunc_clos_action (NP)
UNINITIALISED (USED) CONSTANT $-Sys$-_entry_point (NP)
UNINITIALISED CONSTANT $-Sys$-_cache_flush (NP)
UNINITIALISED CONSTANT _popenter (NP)
UNINITIALISED CONSTANT _pfsub (NP)
UNINITIALISED CONSTANT _moveq (NP)
UNINITIALISED CONSTANT _prolog_restore (NP)

[ ... more stuff ... ]

UNINITIALISED CONSTANT _biset (NP)
UNINITIALISED CONSTANT _popuenter (NP)
UNINITIALISED CONSTANT _prolog_deref (NP)
UNINITIALISED CONSTANT _pf_extend_s_to_d (NP)
UNINITIALISED CONSTANT _conspair (NP)

;;; MISHAP - POPLINK: ABORTED (see above)
Chaz:~/Projects/poplog/poplog_osx/v15.6/p

So, I need to figure out what's going on here. Is
there a way to get debug output during the pglink
process?

The only way I can think of would be to put print commands
in the file make_poplink (and others it invokes, i.e.

load lib.p
load sysdefs.p
load mcdata.p
load files.p
load wordflags.p
load asmout.p
load os_comms.p
load w_util.p
load w_module.p
load poplink_main.p

E.g. the 'UNINITIALISED CONSTANT' errors come from

$popsrc/syscomp/poplink_main.p

(found using grep)

But the problems may be in other files.

Since these errors are generated by the poplog
program (rather than errors during the final link
at the OS level), I'm not sure how best to
troubleshoot it.

If you can understand what poplink_main.p is doing, then maybe you
can tell whether the problem is

some environment variable needing to be chnaged
some operating system setting in the pop11 code in the syscomp
directory needing to be changed

If you change anything, then rebuild poplink by

$popsrc/mksyscomp poplink

Then try running pglink again. Of course if the problem is some
environment variable needing to be different you may have to alter

$popcom/popenv

or the shell script
$popsys/pglink


It is all very powerful and very flexible. But I wonder if it could have
been simpler!

Aaron
http://www.cs.bham.ac.uk/~axs/

.



Relevant Pages

  • Files appear to be cross linked
    ... script requires a number of standard environment variables to be set ... so it calls a second shell script to set these at the session level, ... control should return to the first shell script, ... that the script executes to the last line prior to the displaying of ...
    (comp.unix.solaris)
  • Re: [PHP] Catch STDERR
    ... into your PHP script? ... Or do you just need STDOUT in one variable, and STDERR in another, ... Another option is to try to write a .sh shell script to get what you ...
    (php.general)
  • Re: basic questions
    ... Setting a script that runs at 3:00 ... Set chron to run that shell script. ... Debug the GUI application with the REPL. ... You start up the Web browser, then browse the Web, visit a hundred ...
    (comp.lang.lisp)
  • Re: Converting large bash script to TCL
    ... I know that TCL and shell scripting share a lot of similarities. ... The shell script ... Determine what it (the script) is supposed to do ... echo "WOULD YOU LIKE TO INSTALL NAC DRIVER ...
    (comp.lang.tcl)