Clean2.2 on 64bit Xubuntu

From Clean
Revision as of 18:17, 14 January 2009 by Nick Rudnick (talk | contribs) (New page: Clean on Linux ---- == Sources == As source archive Clean2.2Sources.tgz; unpacked it contains a directory Sources/ with the following (incomplete) subdirectory structure: *'''CodeGener...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Clean on Linux


Sources

As source archive Clean2.2Sources.tgz; unpacked it contains a directory Sources/ with the following (incomplete) subdirectory structure:

  • CodeGenerator/
    • Makefile.linux64
  • RuntimeSystem/
    • macho/
    • Makefile.linux
  • compiler/
    • backend/
    • backendC/
    • coclmaindll/
    • frontend/
    • main/
    • portToNewSyntax/
    • unix/
      • make.linux64.hs
  • dynamic/
    • dynamics/
    • linkers/
  • libraries/
    • ArgEnvUnix/
    • ArgEnvWindows/
    • CarbonInterface/
    • Directory/
    • ExceptionsWindow/
    • ExtendedArith/
    • GEC/
    • Gast/
    • GenLib/
    • Hilde/
    • MersenneTwister/
    • ObjectIO/
    • Parsers/
    • StdEnv/
    • StdLib/
    • WrapDebug/
    • iolib/
  • tools/
    • Clean08IDE/
    • CleanIDE/
    • ShowHeapProfile08/
    • ShowTimeProfile08/
    • Sparkle/
    • clm/
      • Makefile.linux64
    • elf_linker/
    • htoclean/

Seemingly an overall Makefile is missed desperately.

compiler/unix/make.linux64.sh

It seems a good idea to begin with compiler/unix/make.linux64.sh:

#!/bin/sh
CLM=clm
(cd backendC/CleanCompilerSources; make -f Makefile.linux64)
(cd ../libraries/ArgEnvUnix; make ArgEnvC.o)
(cd main/Unix; make -f Makefile all);
$CLM -gcm -h 40M -nt -nw -ci -nr -I backend -I frontend -I main -I main/Unix \
	-I ../libraries/ArgEnvUnix \
	-l ../libraries/ArgEnvUnix/ArgEnvC.o \
	-l main/Unix/Clean\ System\ Files/cDirectory.o \
	-l main/Unix/Clean\ System\ Files/set_return_code_c.o \
	-l main/Unix/Clean\ System\ Files/ipc_c.o \
	-l backendC/CleanCompilerSources/backend.a \
	cocl -o cocl
#> chmod +x make.linux64.sh
#> ./make.linux64.sh
cd: 4: can't cd to backendC/CleanCompilerSources
make: Makefile.linux64: No such file or directory
make: *** No rule to make target `Makefile.linux64'.  Stop.
cd: 5: can't cd to ../libraries/ArgEnvUnix
make: *** No rule to make target `ArgEnvC.o'.  Stop.
cd: 6: can't cd to main/Unix
make: Makefile: No such file or directory
make: *** No rule to make target `Makefile'.  Stop.
./make.linux64.sh: 14: clm: not found

Obviously the paths are given relatively to compiler/:

#> cp make.linux64.sh .. ; cd ..
#> ./make.linux64.sh
... quite a lot of actions happening ...
./make.linux64.sh: 14: clm: not found

tools/clm/Makefile.linux64

clm isn't in the path, too, but in tools/clm/. There we try:

#> make -f Makefile.linux64

Afterwards, clm is built; we try to adapt compiler/make.linx64.sh:

CLEAN_HOME=/usr/local/src/Clean
PATH=$PATH:$CLEAN_HOME/tools/clm
...

(The meaning of clm seems to be `Clean make'.)

cocl

#> ./make.linux64.sh 
...
Compiling cocl
clm: can't start the clean compiler: No such file or directory
clm: fopen compiler commands pipe: No such file or directory
clm: error after stopping compiler

The -I's and -l's are all reachable... what and where is the `clean compiler'??

Seemingly cocl, but not in the same directory, but in subdirectory backendC/CleanCompilerSources/:

#> find . -name cocl.c
./compiler/backendC/CleanCompilerSources/cocl.c

I adapt the last part of make.linux64.sh:

...
cd backendC/CleanCompilerSources
$CLM -gcm -h 40M -nt -nw -ci -nr -I backend -I frontend -I main -I main/Unix \
	-I ../../../libraries/ArgEnvUnix \
	-l ../../../libraries/ArgEnvUnix/ArgEnvC.o \
	-l ../../main/Unix/Clean\ System\ Files/cDirectory.o \
	-l ../../main/Unix/Clean\ System\ Files/set_return_code_c.o \
	-l ../../main/Unix/Clean\ System\ Files/ipc_c.o \
	-l backend.a \
	cocl -o cocl

Then I receive:

#> ./make.linux64_clm.sh
Compiling cocl
Can't find cocl.icl
#> find . -name cocl.icl
./compiler/main/cocl.icl

Apparently another cocl is needed for bootstrapping - lets take that of the binary package... but where to put it??

Not before some fiddling with the C code itself I get the conclusion that `.' is an acceptable path, i.e. in my case compiler/backendC/CleanCompilerSources/, where cocl.c resides and where the adapted script has moved to.

Finally, progress again:

#> ./make.linux64_clm.sh
Compiling cocl
Compiling coclmain
Error [coclmain.icl,6]: StdEnv.dcl could not be imported
Error [coclmain.icl,7]: StdDebug.dcl could not be imported
Error [CoclSystemDependent.dcl,4]: StdFile.dcl could not be imported
Error [general.dcl,4]: StdInt.dcl could not be imported
Error [typeproperties.dcl,3]: StdClass.dcl could not be imported
Error [containers.dcl,4]: StdOverloaded.dcl could not be imported
Error [utilities.dcl,6]: StdMisc.dcl could not be imported
Error [_aconcat.dcl,3]: StdArray.dcl could not be imported
Error [_aconcat.dcl,3]: StdEnum.dcl could not be imported
Error [_aconcat.dcl,3]: StdList.dcl could not be imported

CAUTION: How about a conflict of the target cocl with the infiltrating binary cocl? Better rename the target to coclNew...

In regard of StdEnv.dcl, I add the following option line to the last part of make.linux64.sh:

...
	-I ../../../libraries/StdEnv \
...

Now again something happens until:

... quite a lot of actions ...
Warning [Version,]: not all derived strictness information is exported
Generating code for cocl
Can't execute the code generator
clm: unlink compiler commands pipe: No such file or directory
clm: unlink compiler results pipe: No such file or directory

I seem to be successful in compiling a cg binary in CodeGenerator/ with the enclosed Makefile.

code generator

Is this cg in CodeGenerator/ which is uncompiled, but with Makefile.linux64?? A trial:

#> make -f Makefile.linux64

Seems successful... copy to backendC/CleanCompilerSources/, then proceed with make.linux64.sh:

Generating code for cocl
Generating code for coclmain
Generating code for _aconcat
Generating code for utilities
Generating code for containers
Generating code for hashtable
Generating code for predef
Generating code for convertcases
Generating code for transform
Generating code for convertDynamics
Generating code for IndexType
Generating code for Heap
Generating code for typeproperties
Generating code for general
Generating code for scanner
Generating code for syntax
Generating code for checksupport
Generating code for compile
Generating code for CoclSystemDependent
Generating code for set_return_code
Generating code for ArgEnv
Generating code for StdDebug
Generating code for _SystemEnum
Generating code for StdEnum
Generating code for StdMisc
Generating code for StdFunc
Generating code for StdCharList
Generating code for StdTuple
Generating code for StdOrdList
Generating code for StdList
Generating code for StdClass
Generating code for StdFile
B, C, F, I, P or R expected at line 244

Repeating leads to the following results:

#> ./make.linux64_Nick.sh
...
Generating code for StdString
B, C, F, I, P or R expected at line 260
#> ./make.linux64_Nick.sh
...
Generating code for _SystemArray
Generating code for StdArray
Generating code for StdChar
Generating code for StdReal
B, C, F, I, P or R expected at line 792
#> ./make.linux64_Nick.sh
...
Generating code for StdInt
Generating code for StdOverloaded
Generating code for StdBool
Generating code for StdEnv
Generating code for filesystem
Generating code for ipc
Generating code for compilerSwitches
Generating code for backendinterface
Generating code for analunitypes
Generating code for unitype
Generating code for compare_constructor
Generating code for StdCompare
Generating code for typesupport
Generating code for check
Generating code for overloading
Generating code for frontend
Generating code for partition
Generating code for classify
Generating code for trans
Generating code for type_io
Generating code for type_io_common
Generating code for mergecases
Generating code for typereify
Generating code for genericsupport
Generating code for checkFunctionBodies
Generating code for comparedefimp
Generating code for explicitimports
Generating code for checktypes
Generating code for parse
Generating code for type
Generating code for analtypes
Generating code for refmark
Generating code for _SystemEnumStrict
Generating code for _SystemStrictLists
Generating code for StdStrictLists
Generating code for generics1
Generating code for convertimportedtypes
Generating code for postparse
Generating code for Version
Generating code for backendconvert
Generating code for backendsupport
Generating code for backendpreprocess
Generating code for backend
Linking cocl
Couldn't find _startup.o

_startup.o

Although

#> find .. -name _startup.o
../RuntimeSystem/macho/_startup.o

adding

...
	-l $CLEAN_HOME/RuntimeSystem/macho/_startup.o \
...

apparently does not change anything...

Can anybody give a hint what to do next?

modified make.linux64.sh

Here is my modified make.linux64.sh - to be executed from $CLEAN_HOME/compiler:

#!/bin/sh

BOOTSTRAP_COCL_ORIGIN=/tmp/clean/exe
CLEAN_HOME=/usr/local/src/Clean

CLM_DIR=$CLEAN_HOME/tools/clm
CG_DIR=$CLEAN_HOME/CodeGenerator
PATH=$PATH:$CLM_DIR:$CG_DIR

COMPILER_DIR=$CLEAN_HOME/compiler
LIB_DIR=$CLEAN_HOME/libraries
COMPILERSRC_DIR=$COMPILER_DIR/backendC/CleanCompilerSources

CLM=clm

(cd $COMPILERSRC_DIR; make -f Makefile.linux64)
(cd $LIB_DIR/ArgEnvUnix; make ArgEnvC.o)
(cd $COMPILER_DIR/main/Unix; make -f Makefile all);
(cd $CG_DIR; make -f Makefile.linux64);
(cd $CLM_DIR; make -f Makefile.linux64);

MAIN_DIR=$COMPILER_DIR/main/Unix

cp $BOOTSTRAP_COCL_ORIGIN/cocl $COMPILERSRC_DIR
cp $CLEAN_HOME/CodeGenerator/cg $COMPILERSRC_DIR 

cd $COMPILERSRC_DIR

$CLM -gcm -h 40M -nt -nw -ci -nr \
	-I $COMPILER_DIR/backend \
	-I $COMPILER_DIR/frontend \
	-I $COMPILER_DIR/main \
	-I $COMPILER_DIR/main/Unix \
	-I $LIB_DIR/StdEnv \
	-I $LIB_DIR/ArgEnvUnix \
	-l $LIB_DIR/ArgEnvUnix/ArgEnvC.o \
	-l $MAIN_DIR/Clean\ System\ Files/cDirectory.o \
	-l $MAIN_DIR/Clean\ System\ Files/set_return_code_c.o \
	-l $MAIN_DIR/Clean\ System\ Files/ipc_c.o \
	-l $CLEAN_HOME/RuntimeSystem/macho/_startup.o \
	-l $COMPILERSRC_DIR/backend.a \
cocl -o coclNew