Compilation error with Lst files

ZX80, ZX 81, ZX Spectrum, TS2068 and other clones
Post Reply
fraespre
Member
Posts: 42
Joined: Mon Aug 19, 2019 8:08 pm

Compilation error with Lst files

Post by fraespre »

hi,
I've found something strange, that could be a bug ... but, I'm really don't know.

I've several z88dk versions installed in my windows. So, I've a batch file to prepare the environment vars.

Code: Select all

rem set Z88DK_DIR=C:\mio\soft\dev\z80\z88dk\z88dk-20220317
rem set Z88DK_DIR=C:\mio\soft\dev\z80\z88dk\z88dk-20220906
set Z88DK_DIR=C:\mio\soft\dev\z80\z88dk\z88dk-20220918

...
When I use the oldest version (20220317) the compilation process of my project works fine.

But, When I use some of the newest, I find a compilation error like this:
Unable to open list file "./sys/sys.lst"
Tap Error !!!
It's because I have hierarchical Lst files chained.
This is the main:

Code: Select all

@./sys/sys.lst
@./cmp/cmp.lst
@./man/man.lst
@../res/res.lst
main.c
heap.asm 
And this is the compilation command:

Code: Select all

zcc +zx -v -Cl-v -m -startup=31 -compiler=sdcc -create-app 		^
	-clib=sdcc_iy -SO3 --opt-code-size 	 			^
	--c-code-in-asm --list -DDEBUG=1				^
	@../src/src.lst -pragma-include:../src/zpragma.inc 		^
	-o %APPNAME%
do you know if this has stopped working in the latest z88dk versions?
or maybe there has been some related change in the compiler?

Thanks in advance,
User avatar
jorgegv
Member
Posts: 136
Joined: Wed Nov 18, 2020 5:08 pm

Re: Compilation error with Lst files

Post by jorgegv »

What is your directory layout? And from what directory are you running the build command?

Since there are relative paths both in your command and in the LST files, it might be some error with that...
fraespre
Member
Posts: 42
Joined: Mon Aug 19, 2019 8:08 pm

Re: Compilation error with Lst files

Post by fraespre »

OK Jorge,

This is my directory layout:

Code: Select all

myproject
  full_build.bat
  |- build
  |- config
  |- res
  |- src
     src.lst
     |- cmp
        cmp.lst
     |- man
        man.lst
     |- res
        res.lst
     |- sys
        sys.lst
And this is full_build.bat

Code: Select all

cd build
del *.* /F /Q
zcc +zx -v -Cl-v -m -startup=31 -compiler=sdcc -create-app 		^
	-clib=sdcc_iy -SO3 --opt-code-size 	 			^
	--c-code-in-asm --list -DDEBUG=1				^
	@../src/src.lst -pragma-include:../src/zpragma.inc 		^
	-o myproject
cd ..
Of course, I can understand you want to check the structure.
Anyway, you have to keep in mind that something that has worked for a long time (many versions ago), suddenly doesn't work with the last versions.
That's the fact/evidence for me that something has changed.
User avatar
jorgegv
Member
Posts: 136
Joined: Wed Nov 18, 2020 5:08 pm

Re: Compilation error with Lst files

Post by jorgegv »

Well, since your sys, cmp, man and res directories are all at the same level, and you are launching everything from directory build, It seems that all of them should start with the same "./" Or "../" sequence....?
User avatar
jorgegv
Member
Posts: 136
Joined: Wed Nov 18, 2020 5:08 pm

Re: Compilation error with Lst files

Post by jorgegv »

I mean: I think your src.lst file should read like this:

Code: Select all

@../sys/sys.lst
@../cmp/cmp.lst
@../man/man.lst
@../res/res.lst
main.c
heap.asm 
Also, I think I can remember some issue not so long ago about the base directory used by ZCC to open the command line listing files...? I have searched the github issues and I did not find it, but it rings so many bells for me... Maybe Dom or some of the other wizards have fresher memories about this?
User avatar
dom
Well known member
Posts: 1692
Joined: Sun Jul 15, 2007 10:01 pm

Re: Compilation error with Lst files

Post by dom »

If the error is coming from the assembler stage then I have feeling that this issue might be relevant: https://github.com/z88dk/z88dk/issues/2068 - as in there was a directory traversal bug which affected the level.

If it's from zcc then it might be caused by a change to allow arguments to be embedded within .lst files which made a few changes to the list file handling.
User avatar
jorgegv
Member
Posts: 136
Joined: Wed Nov 18, 2020 5:08 pm

Re: Compilation error with Lst files

Post by jorgegv »

Thanks Dom, that was the issue that I had read some time ago. I believe the last comment is probably the explanation for fraespre's issue.
fraespre
Member
Posts: 42
Joined: Mon Aug 19, 2019 8:08 pm

Re: Compilation error with Lst files

Post by fraespre »

jorgegv wrote: Tue Sep 20, 2022 5:26 pm Well, since your sys, cmp, man and res directories are all at the same level, and you are launching everything from directory build, It seems that all of them should start with the same "./" Or "../" sequence....?
ei Jorge, theoretically all references I have into the "src.lst" have this file as a reference (all paths are relative to this lst "father" file). I guess it's weird for you that I have an exception (@../res/res.lst), due because I have 2 "res" folders, one it's at the project's level to contain the graphical resources, and another at the source's level, were there is the code to manage those resources.

Anyway, I've tested with this other "src.lst" (where the reference would be the compilation dir, I mean "build")

Code: Select all

@../src/sys/sys.lst
@../src/cmp/cmp.lst
@../src/man/man.lst

;@./sys/sys.lst
;@./cmp/cmp.lst
;@./man/man.lst
;@../res/res.lst

;This is the main game & the heap
main.c
heap.asm 
Curiously, in this case, the previous error vanishes (Unable to open list file "./sys/sys.lst"), but another much more strange one appears.
C:\mio\soft\dev\z80\wrks\zxspectrum\zx_games\robbnn2>full_build.bat

C:\mio\soft\dev\z80\wrks\zxspectrum\zx_games\robbnn2>cd C:\mio\soft\dev\z80\wrks\zxspectrum\zx_games\robbnn2\build

C:\mio\soft\dev\z80\wrks\zxspectrum\zx_games\robbnn2\build>del *.* /F /Q

C:\mio\soft\dev\z80\wrks\zxspectrum\zx_games\robbnn2\build>zcc +zx -v -startup=31 -compiler=sdcc -create-app @../src/src.lst -o robbnn

PROCESSING The.asm.m4
m4 -I "C:\mio\soft\dev\z80\z88dk\z88dk-20220918\lib\config\..\..\\lib\target\zx\classic" -I "C:\Users\e104119\AppData\Local\Temp\zcc00004940926F42" -I "C:\mio\soft\dev\z80\z88dk\z88dk-20220918\lib\config\..\..\/src/m4" --define=__STARTUP=31 < "The.asm.m4" > "C:\Users\e104119\AppData\Local\Temp\zcc00004940926F2.asm"
The system cannot find the file specified.

C:\mio\soft\dev\z80\wrks\zxspectrum\zx_games\robbnn2\build>cd ..
After reading the Dom comments, I've to say that initially, I had the feeling the problem/change was in the zcc. But, when I've seen this second error it sounds to me like the assembler stage.

Again, I want to highlight that if I use the z88dk versions from before the summer, all works perfectly using my initial setup.
User avatar
jorgegv
Member
Posts: 136
Joined: Wed Nov 18, 2020 5:08 pm

Re: Compilation error with Lst files

Post by jorgegv »

Is It possible that you share the full code so that I can test in my machine?
fraespre
Member
Posts: 42
Joined: Mon Aug 19, 2019 8:08 pm

Re: Compilation error with Lst files

Post by fraespre »

hi Jorge,

I've created a skeleton to reproduce the problem.
here: https://ufile.io/j6idbpms

Remember: you should define the paths to z88dk versions in the file "_console.bat". Then you can execute it and a console will appear. Inside that console, you execute "full_build.bat" to reproduce the compilation process.
Currently is defined the "z88dk-20220317" version, if you download it ... you'll check all work OK.
User avatar
jorgegv
Member
Posts: 136
Joined: Wed Nov 18, 2020 5:08 pm

Re: Compilation error with Lst files

Post by jorgegv »

Mmm I have downloaded your skeleton and I manually did the steps that the BAT does until compiling (I'm on Linux): I move to the build dir and then launch the ZCC command. It compiles without problems and generates these files:

Code: Select all

$ ls -l
total 272
-rw-r--r-- 1 jorgegv jorgegv   2129 sep 23 10:20 robbnn_CODE.bin
-rw-r--r-- 1 jorgegv jorgegv   5000 sep 23 10:20 robbnn_LOWMEM.bin
-rw-r--r-- 1 jorgegv jorgegv 258982 sep 23 10:20 robbnn.map
-rw-r--r-- 1 jorgegv jorgegv   2209 sep 23 10:20 robbnn.tap
I'll try later on my Windows VM...
fraespre
Member
Posts: 42
Joined: Mon Aug 19, 2019 8:08 pm

Re: Compilation error with Lst files

Post by fraespre »

oh wow! so quickly! thank you, Jorge!
I'm curious, what z88dk version are you using in the tests?
User avatar
jorgegv
Member
Posts: 136
Joined: Wed Nov 18, 2020 5:08 pm

Re: Compilation error with Lst files

Post by jorgegv »

I'm using a nightly from 20th May 2022. I believe it was just a bit before the latest official release came out, if I'm not wrong... I used to be switching Z88DK versions all the day back then...
fraespre
Member
Posts: 42
Joined: Mon Aug 19, 2019 8:08 pm

Re: Compilation error with Lst files

Post by fraespre »

Ok. Then, for now, the same thing is happening to me.
I suspect the problem started with the latest official release.

can you try some of these nightly?
z88dk-20220906
z88dk-20220918
User avatar
dom
Well known member
Posts: 1692
Joined: Sun Jul 15, 2007 10:01 pm

Re: Compilation error with Lst files

Post by dom »

I'm getting a breakage with the following change: https://github.com/z88dk/z88dk/commit/f ... f7a35597bd

Prior to this version, the path to the .lst file being parsed was added to a file with a non-absolute path - which seems like sensible behaviour so I'll endeavour to restore it.
Post Reply