Error compiling nxl with MinGW

16 views
Skip to first unread message

Leledumbo

unread,
Jul 23, 2011, 8:13:41 AM7/23/11
to XL programming language and runtime
I've just cloned the git repo, and try bootstrapping with MinGW (very
latest version taken with latest mingw-get). However, upon compiling
nxl, the generated compiler.xl.C has this line:

[Compiler generated] Unable to load bytecode file "xl.bytecode"

which is of course rejected by g++ because it's not a valid C++ code.
I wonder why error messages are put in stdout instead of stderr.
Anyway, the bootstrapping fails. How can I fix it?

Christophe de Dinechin

unread,
Jul 23, 2011, 11:36:23 AM7/23/11
to xlr-...@googlegroups.com
Wow! First time I see an e-mail address from Indonesia, I had to lookup the country code...

> I wonder why error messages are put in stdout instead of stderr.

For the bootstrap compiler, it was not worth adding support for stderr. Also, the surrounding context is often the best clue as to what's going on.


On 23 juil. 2011, at 14:13, Leledumbo wrote:

> I've just cloned the git repo, and try bootstrapping with MinGW (very
> latest version taken with latest mingw-get). However, upon compiling
> nxl, the generated compiler.xl.C has this line:
>
> [Compiler generated] Unable to load bytecode file "xl.bytecode"

What is interesting is that this message can only come from nxl. AFAICT, it doesn't exist in xl or bxl. So you compiled the C++ compiler, that compiler created and ran bxl, bxl created and ran nxl, and nxl fails to find the bytecode so it can't compile itself.

The culprit is somewhere around line 159 of xl.codegenerator.xl. Could you try adding some instrumentation code in there, so that it looks like this:

S : SC.scanner
DirName : text
for DirName in MACRO.include_path loop

// ADDED
IO.WriteLn "// DIR=", DirName


NormalizedName : text := PT.XLNormalize(filename)
NameInDir : text
Directory : string of text := FL.Directory(DirName)
for NameInDir in Directory loop

// ADDED
IO.WriteLn "// IN ", DirName, " FILE=", NameInDir

if PT.XLNormalize(NameInDir) = NormalizedName then
FullName : text := DirName + "/" + NameInDir

// ADDED
IO.WriteLn "// FULLNAME=", FullName

S := SC.Open (FullName)
exit if S <> nil and IO.valid S.input
exit if S <> nil and IO.valid S.input

if S = nil or not IO.valid S.input then
ERR.Error "Unable to load bytecode file $1",
PT.NewText(filename, '"', -1)
return


This may tell us why we have a problem looking for the file.

Leledumbo

unread,
Jul 24, 2011, 6:21:33 AM7/24/11
to XL programming language and runtime
OK, here's the result:

// DIR=.
// IN . FILE=.
// IN . FILE=..
// IN . FILE=Makefile
// IN . FILE=TESTS
// IN . FILE=compiler.xl
// IN . FILE=library
// IN . FILE=make.msvc71.bat
// IN . FILE=xl.bytecode.xl
// IN . FILE=xl.bytecode.xs
// IN . FILE=xl.codegenerator.machine.xl
// IN . FILE=xl.codegenerator.machine.xs
// IN . FILE=xl.codegenerator.xl
// IN . FILE=xl.codegenerator.xs
// IN . FILE=xl.constants.xl
// IN . FILE=xl.constants.xs
// IN . FILE=xl.errors.xl
// IN . FILE=xl.errors.xs
// IN . FILE=xl.optimizer.xl
// IN . FILE=xl.optimizer.xs
// IN . FILE=xl.parser.tree.xl
// IN . FILE=xl.parser.tree.xs
// IN . FILE=xl.parser.xl
// IN . FILE=xl.parser.xs
// IN . FILE=xl.plugin.common.xl
// IN . FILE=xl.plugin.common.xs
// IN . FILE=xl.plugin.constantfold.xl
// IN . FILE=xl.plugin.define.xl
// IN . FILE=xl.plugin.differentiation.xl
// IN . FILE=xl.plugin.ifdefined.xl
// IN . FILE=xl.plugin.ifp.xl
// IN . FILE=xl.plugin.include.xl
// IN . FILE=xl.plugin.junk.xl
// IN . FILE=xl.plugin.listing.xl
// IN . FILE=xl.plugin.transforms.xl
// IN . FILE=xl.plugin.xl2c.xl
// IN . FILE=xl.renderer.xl
// IN . FILE=xl.renderer.xs
// IN . FILE=xl.scanner.position.xl
// IN . FILE=xl.scanner.position.xs
// IN . FILE=xl.scanner.xl
// IN . FILE=xl.scanner.xs
// IN . FILE=xl.semantics.declarations.xl
// IN . FILE=xl.semantics.declarations.xs
// IN . FILE=xl.semantics.functions.xl
// IN . FILE=xl.semantics.functions.xs
// IN . FILE=xl.semantics.generics.xl
// IN . FILE=xl.semantics.generics.xs
// IN . FILE=xl.semantics.instructions.xl
// IN . FILE=xl.semantics.instructions.xs
// IN . FILE=xl.semantics.iterators.xl
// IN . FILE=xl.semantics.iterators.xs
// IN . FILE=xl.semantics.macros.xl
// IN . FILE=xl.semantics.macros.xs
// IN . FILE=xl.semantics.modules.xl
// IN . FILE=xl.semantics.modules.xs
// IN . FILE=xl.semantics.overload.xl
// IN . FILE=xl.semantics.overload.xs
// IN . FILE=xl.semantics.pragmas.xl
// IN . FILE=xl.semantics.types.enumerations.xl
// IN . FILE=xl.semantics.types.enumerations.xs
// IN . FILE=xl.semantics.types.functions.xl
// IN . FILE=xl.semantics.types.functions.xs
// IN . FILE=xl.semantics.types.generics.xl
// IN . FILE=xl.semantics.types.generics.xs
// IN . FILE=xl.semantics.types.records.xl
// IN . FILE=xl.semantics.types.records.xs
// IN . FILE=xl.semantics.types.xl
// IN . FILE=xl.semantics.types.xs
// IN . FILE=xl.semantics.writtenforms.xl
// IN . FILE=xl.semantics.writtenforms.xs
// IN . FILE=xl.semantics.xl
// IN . FILE=xl.semantics.xs
// IN . FILE=xl.symbols.xl
// IN . FILE=xl.symbols.xs
// IN . FILE=xl.textio.encoding.ascii.xs
// IN . FILE=xl.textio.xl
// IN . FILE=xl.translator.xl
// IN . FILE=xl.translator.xs
// IN . FILE=xl.ui.console.xs
// IN . FILE=xl_lib.h
// IN . FILE=xl.syntax
// IN . FILE=nxl.exe
// DIR=library/runtime/default/.

Leledumbo

unread,
Jul 24, 2011, 7:21:06 AM7/24/11
to XL programming language and runtime
I tried printing PT.XLNormalize(NameInDir) and NormalizedName and now
I know where the problem is. NormalizedName contains no file extension
while the result of PT.XLNormalize does (and so does NameInDir
itself). It seems to be initialized in xl.translator.xs and indeed it
has no extension.

Btw, I'm new to this language. What's the difference between .xl
and .xs file conventionally? Both seems the same syntactically.

Christophe de Dinechin

unread,
Jul 24, 2011, 11:57:18 AM7/24/11
to xlr-...@googlegroups.com

On 24 juil. 2011, at 13:21, Leledumbo wrote:

> I tried printing PT.XLNormalize(NameInDir) and NormalizedName and now
> I know where the problem is. NormalizedName contains no file extension
> while the result of PT.XLNormalize does (and so does NameInDir
> itself). It seems to be initialized in xl.translator.xs and indeed it
> has no extension.

It's interesting, but I don't think that's the issue here. From your earlier message :

// DIR=.
// IN . FILE=.
// IN . FILE=..
// IN . FILE=Makefile
// IN . FILE=TESTS

...


// DIR=library/runtime/default/.
[Compiler generated] Unable to load bytecode file "xl.bytecode"


Normally, "default" is a symbolic link to the C directory. I guess MinGW doesn't know about symbolic links. Try copying the contents of library/runtime/C into library/runtime/default. That should do it.

>
> Btw, I'm new to this language. What's the difference between .xl
> and .xs file conventionally? Both seems the same syntactically.

xs is for specifications of modules, and xl for implementations.


Thanks
Christophe

Leledumbo

unread,
Jul 24, 2011, 1:52:03 PM7/24/11
to XL programming language and runtime
> Normally, "default" is a symbolic link to the C directory. I guess MinGW doesn't know about symbolic links. Try copying the contents of library/runtime/C into library/runtime/default. That should do it.

Ah... you're right. It compiles fine now. Now... how do I "install"
it? Assuming I don't want to add anymore features to the language and
just use it as a normal compiler.

Christophe de Dinechin

unread,
Jul 24, 2011, 3:54:46 PM7/24/11
to xlr-...@googlegroups.com
Right now, there's no real "install" step. The compiler is supposed to be tested / used from where it's being built. You can manually copy nxl and runtime to a more convenient place. I'm not sure it's fit to be used as a production compiler for the moment :-)


Christophe

> --
> You received this message because you are subscribed to the Google Groups "XL programming language and runtime" group.
> To post to this group, send email to xlr-...@googlegroups.com.
> To unsubscribe from this group, send email to xlr-talk+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/xlr-talk?hl=en.
>

Reply all
Reply to author
Forward
0 new messages