ZCCCFG and/or Z80_OZFILES being ignored

Problems installing on other platforms
Post Reply
Bushman
New member
Posts: 2
Joined: Wed Aug 11, 2010 1:45 am

ZCCCFG and/or Z80_OZFILES being ignored

Post 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       
/usr/share/z88dk/lib/config/
bash$ echo $Z80_OZFILES  
/usr/share/z88dk/lib/
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

Try running ./config.sh in the z88dk folder, first
Bushman
New member
Posts: 2
Joined: Wed Aug 11, 2010 1:45 am

Post by Bushman »

I didn't find a "config.sh" 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.
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Post 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 ??)
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Post 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:

1. Use $ZCCFILE
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!)
Post Reply