Page 1 of 1

ZCCCFG and/or Z80_OZFILES being ignored

Posted: Wed Aug 11, 2010 1:54 am
by Bushman
I just recently installed z88dk from the CVS package in the Arch Linux user repository. However, whenever I try to compile this:

Code: Select all

bash$ cat ./hello.c
#include <stdio.h>

int main(){
  printf("Hello, world! I am C!\n");
  return 0;
I get this:

Code: Select all

bash$ zcc +ti8x hello.c -o hello.bin -lndos -create-app
Can't open config file /usr/local/lib/z88dk/lib/config/ti8x.cfg
, even though:

Code: Select all

bash$ echo $ZCCCFG       
bash$ echo $Z80_OZFILES  

Posted: Wed Aug 11, 2010 7:41 pm
by stefano
Try running ./ in the z88dk folder, first

Posted: Thu Aug 12, 2010 2:26 am
by Bushman
I didn't find a "" in the install directory "/usr/share/z88dk" so I rebuilt the package, injecting an interrupt just before "make || return 1" in the package-build script so as to be able to go into the source directory and execute the script before the compilation started.

However, I still got the same error: "Can't open config file /usr/local/lib/z88dk/lib/config/ti8x.cfg", even though I manually reset the environmental variables yet again -- the FIRST time I ran it.

The second time, I bothered to stat the "./zcc_opt.def" file which had been giving me problems when I tried to use zcc without sudo (claiming that it couldn't access the file), and it turned out to be owned by root! After chown-ing it and running zcc without sudo, it worked (or seemed to work) just perfectly! My apologies for the denseness on my part, though it might help in the future to include slightly more verbose errors regarding I/O problems with the zcc_opt.def file.

Posted: Fri Aug 13, 2010 8:11 pm
by stefano
Hey, thank you very much for the details, I'm sure even this same post stuck in the forum can be useful.
it is very strange you had those weird permissions on that file, which is supposed to be created on the fly.
Then, if the error message related to the cfg stuff was due to zcc.opt it is time for an improvement (did it really happen ??)

Posted: Sun Aug 15, 2010 7:30 pm
by dom
There's an order to searching for config files (mostly for backwards compatibility), so if a + option is supplied the following logic is used.

1. Look for a local file (eg +platform will search for ./platform.cfg)
2. Use $ZCCCFG (eg +platform will look for $(ZCCCFG)/platform.cfg)
3. If $ZCCCFG is not defined then fall back onto PREFIX (which is usually /usr/local/lib/z88dk)

If no + option is supplied the order is:

2. Use $ZCCCFG/zcc.cfg
3. If $ZCCCFG is not defined use /usr/local/lib/z88dk/lib/config/zcc.cfg (i.e. PREFIX/config/zcc.cfg)

So if it's falling back to /usr/local then it suggests $ZCCCFG isn't defined and exported in the environment (watch the number of 'C's!)