MPS issue job001352

TitleMPS build fails (Linux, Unix) with libcbt link error: multiple definitions of mps_lib_ fns; because mps.a includes plinth (it should not).
Assigned userRichard Kistruck
DescriptionMPS build fails (Linux, Unix) with libcbt link error: multiple definitions of mps_lib_ fns; because mps.a includes plinth (it should not).

RHSK 2006-03-10
When you try to build the MPS-kit (eg. 1.106.1) on linux
(eg. lii4gc), with:
    make -f lii4gc.gmk
it tries to link libcbt (a test executable). The link fails with,
multiply defined symbols:
        lii4gc: lii4gc/hi/libcbt
        lii4gc/hi/mpsliban.o: In function `mps_lib_get_EOF':
        /home/rhsk/mps/master/code/mpsliban.c:57: multiple definition of `mps_lib_get_EOF'
        lii4gc/hi/mpslibcb.o:/home/rhsk/mps/master/code/mpslibcb.c:243: first defined here

RHSK 2006-03-16

The simplest workaround is to remove the "libcbt" target from the
"all:" list in the "comm.gmk" file, line 271:

< eventcnv walkt0 libcbt \
> eventcnv walkt0 \

With this change the default "make -f lii4gc.gmk" now successfully
builds the MPS object files, and an "mps.a" library.

(You still won't be able to build the "libcbt" test executable,
but that doesn't affect operation of the MPS).
AnalysisRHSK 2006-03-10
The libcbt test executable was added under job001096 ("The MPS is
not a Windows DLL"), in order to test the new plinth-function
callback-registration mechanism.
for background info about this mechanism.

RHSK 2006-03-16 and 2006-03-30
Reason for Build Failure
The libcbt link line in comm.gmk (all Unixes) includes:
  - mpslibcb.o (mpslib.h functions);
  - mpsioan.o (mpsio.h functions);
(There is no libcbt target on Windows).

MPMOBJ includes MPMPF (per-platform) object files. On all Unix
platforms except XC (Mac OS X), MPMPF is defined to include
mpsliban.o and mpsioan.o.

The build failure is caused by the duplication of mpslib.h
functions (provided by both mpslibcb.o and mpsliban.o) in the
libcbt link line.

(Incidentally, because GNU Make automatically elides repeat
occurrences of the same dependency file from each dependency list,
and because the link-link is constructed from this dependency list,
the double mention of "mpsioan.o" does not cause any build
problems. But it is still wrong.)

On platform XC (Mac OS X), xcppgc.gmk was changed to remove plinth
files from MPMPF in #10, @144824.

The MPS build system is confused about whether the default "mps.a"
library should include a plinth or not. On Windows ("w3....") and
mac OS X ("xc....") platforms, the "MPMPF" (Memory Pool Manager
Platform Files) make-variable does not list plinth files, so
"mps.a" contains no implementations of plinth functions. On other
platforms, the "MPMPF" make-variable includes "mpsliban.c" and
"mpsioan.c", so "mps.a" contains a plinth.

The "mps.a" library should never include the plinth, in my view:
the plinth is not part of the MPS. (Note however that the choice
of what to put into "mps.a" is to some degree arbitrary, simply
because the MPS is so extensible. When in doubt, choose the
object files you need by hand.)

Other targets, such as test executables, must link with a plinth.
Some executables, including libcbt, provide their own plinth.
Most use the example plinth, defined by the "PLINTH" make-variable
(value: mpsliban, mpsioan).

Proposed Change, for 1.106.2:
Remove plinth files from MPMPF for other .gmk platforms too.

This means the "mps.a" on non-w3/xc platforms will no longer
include the example plinth, and this will require users of "mps.a"
on those platforms to change their build system to explicitly
include plinth files. This must be noted in release notes. See
also job000536 (release readme.txt doesn't have a "what's new"

Really, the aim is simple. On all platforms:
PLINTHOBJ -- mpsliban & mpsioan
MPMOBJ -- (neither)
mps.a -- (neither)
mpsw.a & SWOBJ -- mpsioan
mpsplan.a -- PLINTHOBJ
most test executables -- PLINTHOBJ
particular special cases -- as required

The only special case is the libcbt test executable: it uses
mpslibcb, and so cannot also be linked with mpsliban.
How foundcustomer
EvidenceRHSK 2006-03-10
Mail from Jorge Suit:
or <>
I also verified this on swan.
Observed in1.106.1
Introduced in1.105.0
Created byRichard Kistruck
Created on2006-03-10 13:38:54
Last modified byGareth Rees
Last modified on2014-03-07 10:10:04
History2006-03-10 RHSK Created.
2006-03-30 RHSK Edit title to start "mps.a includes plinth"; and tidy up analysis.
2006-04-04 RHSK Edit title to start "MPS build fails".


Change Effect Date User Description
157895 closed 2006-03-30 14:45:54 Richard Kistruck MPS: master: Remove plinth files from "mps.a" library (platforms
XC and W3 were like this already). Add "What's new" section to
"readme.txt". Add user-friendly help to "release/index.html".
157624 open 2006-03-10 22:08:07 Richard Kistruck MPS patch comm.gmk: drop "libcbt" target from "all:", as build is
broken on non-w3/xc platforms. This fixes the default (no target
specified) build.