Mac OSX

Problems installing on other platforms
Pengwin
New member
Posts: 2
Joined: Thu Jul 19, 2007 8:16 am

Mac OSX

Post by Pengwin »

Could anyone detail how to install z88dk on Mac OSX?

This could either be from source, or using the compiled binaries.
User avatar
dom
Well known member
Posts: 1194
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

Sure!

Since there's no binaries, I'll explain how to do it from source.

1. Make sure you've got the developer tools installed
2. Extract the release kit to your home directory
3. Set the following variables in your .bash_profile:

Code: Select all

export Z80_OZFILES=$HOME/z88dk/lib/
export ZCCCFG=$HOME/z88dk/lib/config/
export PATH=$HOME/z88dk/bin:$PATH
4. Enter $HOME/z88dk and type make

To recompile the libs do the following:

1. cd $HOME/z88dk/libsrc
2. make
3. cp *.lib ../lib/clibs
Pengwin
New member
Posts: 2
Joined: Thu Jul 19, 2007 8:16 am

Post by Pengwin »

Thanks Dom, exactly what I was looking for.
aowen
Member
Posts: 39
Joined: Mon Sep 29, 2008 7:52 am

Post by aowen »

dom wrote:3. Set the following variables in your .bash_profile:

Code: Select all

export Z80_OZFILES=$HOME/z88dk/lib/
export ZCCCFG=$HOME/z88dk/lib/config/
export PATH=$HOME/z88dk/bin:$PATH
Have I got to set up those variables every time (unless I add them to my profile) when I'm compiling. I keep getting: "Can't open config file /usr/local/lib/z88dk/lib/config/zcc.cfg". It has been a while since I've used z88dk but I am going to try. Assuming I can get past my own inadequacies I'm going to need to write a library for the project I'm working on.
User avatar
dom
Well known member
Posts: 1194
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

Correct, you've got to enter them each time unless you either add the commands to the profile or install z88dk to /usr/local
wintermute
Member
Posts: 16
Joined: Thu Feb 24, 2011 7:03 pm

Post by wintermute »

I'm having problems compiling current CVS version under OSX Lion.

OS: OSX Lion with XCode 4.1.1

Steps to get the current CVS revision:

# cd ~
# cvs -d:pserver:anonymous@z88dk.cvs.sourceforge.net:/cvsroot/z88dk login
# cvs -z3 -d:pserver:anonymous@z88dk.cvs.sourceforge.net:/cvsroot/z88dk co -P z88dk
# cd ~/z88dk/
# cvs update -d

Steps for preparing the environment:

# export Z80_OZFILES=$HOME/z88dk/lib/
# export ZCCCFG=$HOME/z88dk/lib/config/
# export PATH=$HOME/z88dk/bin:$PATH

Steps for compiling:

# cd ~/z88dk
# ./build.sh

and I get this error:

Code: Select all

echo '#define PREFIX "/usr/local/lib/z88dk"' > src/config.h
echo '#define UNIX 1' >> src/config.h
make -C src/appmake
cc   -c mtx.c
mtx.c:9:20: error: malloc.h: No such file or directory
make[1]: *** [mtx.o] Error 1
make: *** [appmake] Error 2
Any ideas? Thanks!
Last edited by wintermute on Sat Sep 24, 2011 11:44 am, edited 1 time in total.
wintermute
Member
Posts: 16
Joined: Thu Feb 24, 2011 7:03 pm

Post by wintermute »

Ok, as I can see if I start compilation using ./build.sh, I don't need to export variables PATH, Z80_OZFILES and ZCCCFG.

Seems like the $(INCLUDES) variable in the Makefiles is not set. I'm missing something, but I can't come across what...
User avatar
dom
Well known member
Posts: 1194
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

I've just removed the malloc.h include and it now compiles on Snow Leopard.

I'm not sure why it was added, but it's not needed.
wintermute
Member
Posts: 16
Joined: Thu Feb 24, 2011 7:03 pm

Post by wintermute »

Thanks for the heads up Dom! But there's something tricky going on there.

If I remove z88dk/include/malloc.h, compilation starts and passes beyond my previous error. But then it stops here:

Code: Select all

cd setjmp ; make ; cd ..
zcc +test -vn -make-lib -Wn43 longjmp.c
zcc +test -vn -make-lib -Wn43 setjmp.c
cd assert ; make ; cd ..
zcc +test -vn -make-lib -Wn43 assert.c
cpp: line 83, Fatal error: Cannot open include file "malloc.h"
#include <malloc.h>
from file assert.c, line 14:
#include <stdlib.h>
make[1]: *** [assert.o] Error 1
make        gamesdeps
rm -f -f games/*.o
cd games ; make lz88        ; cd ..
zcc +z88 -vn -make-lib -Wn43 -DZ88 bit_frequency.c
zcc +z88 -vn -make-lib -Wn43 -DZ88 bit_play.c
z80asm -d -ns -nm -Mo -DFORz88 -x./z88_clib @./z88.lst
Error: File 'assert/assert.o' open error
1 errors occurred during assembly
make: *** [z88_clib.lib] Error 1
cp ./*.lib ../lib/clibs
cp: ./*.lib: No such file or directory
make: *** [install] Error 1
But if now I restore z88dk/include/malloc.h and rerun ./build.sh, the compilation runs OK to the end. Weird...
User avatar
dom
Well known member
Posts: 1194
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

Ah, I see what you've done. I meant remove the include line from mtx.c not the include/malloc.h file!

I'll see if I can add an os x toolchain to the build server and try to get the max version building automatically - that should winkle out these problems sooner.
wintermute
Member
Posts: 16
Joined: Thu Feb 24, 2011 7:03 pm

Post by wintermute »

Yes, I suppossed you were talking about deleting the file itself, not deleting de #include line in mtx.c. :)

I see you have updated the CVS with this change and it compiles flawlessly now. Thanks!
wintermute
Member
Posts: 16
Joined: Thu Feb 24, 2011 7:03 pm

Post by wintermute »

Hi!

Ok, here we go again... now the issue is that I can't get to compile SP1 library correctly.

After building the CVS, I do these steps:

Code: Select all

# export Z80_OZFILES=$HOME/z88dk/lib/
# export ZCCCFG=$HOME/z88dk/lib/config/
# export PATH=$HOME/z88dk/bin:$PATH
# cd ~/z88dk/libsrc/
# make sp1-spectrum
and this output is generated:

Code: Select all

cd sprites/software/sp1        ; make sp1-spectrum;        cd ../../..

SP1 Software Sprite Engine
making sinclair spectrum version

z80asm -d -ns -nm -Mo -x../../.././sp1 @spectrum.lst
cp spectrum/spectrum-sp1.h ../../../../include/sprites/sp1.h

all done
But no sp1.lib is compiled anywhere... only sp1.h is copied correctly.

What could be wrong?
User avatar
dom
Well known member
Posts: 1194
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

It looks like the assembler/linker has got a bit of a bug in it.

Paulo has been doing some work in the assembler lately and this looks like one for him, I'll pass it on unless he's looking out for problems on the forum.

The issue is that we ask it to replace the extension on ./zx_clib with the intention of creating ./zx_clib.lib, but it ends up creating .lib instead.
wintermute
Member
Posts: 16
Joined: Thu Feb 24, 2011 7:03 pm

Post by wintermute »

I've updated to latest CVS source tree and sp1.lib is now created. I'll try some examples now...

Thanks Dom!
wintermute
Member
Posts: 16
Joined: Thu Feb 24, 2011 7:03 pm

Post by wintermute »

Just for the record: updated to Mac OSX 10.7.2 and xCode 4.2 and everything compiled succesfully against latest CVS tree.

BTW, any idea about an alpha/beta/... release anytime soon?
groox
New member
Posts: 5
Joined: Fri Apr 03, 2009 11:58 am

Post by groox »

Hi,
updated to 10.75, Xcode 4.3.3, latest from repo, and I get the following errors:
echo '#define PREFIX "/usr/local/lib/z88dk"' > src/config.h
echo '#define UNIX 1' >> src/config.h
make -C src/appmake
make[1]: Nothing to be done for `all'.
make -C src/appmake PREFIX=`pwd` install
install appmake /z88dk/bin
make -C src/copt
make[1]: Nothing to be done for `all'.
make -C src/copt PREFIX=`pwd` install
install copt /z88dk/bin
make -C src/cpp
make[1]: `zcpp' is up to date.
make -C src/cpp PREFIX=`pwd` install
install zcpp /z88dk/bin
make -C src/sccz80
make[1]: Nothing to be done for `all'.
make -C src/sccz80 PREFIX=`pwd` install
install -m 755 sccz80 /z88dk/bin/sccz80
echo 'Configure z80asm for ENDIAN status!!'
Configure z80asm for ENDIAN status!!
make -C src/z80asm
cc -c -o z80pass.o z80pass.c
In file included from z80pass.c:73:
./config.h:73:5: error: invalid token at start of a preprocessor expression
#if #cpu(m68k) || #cpu(sparc) || #cpu(hppa) || #cpu(powerpc)
^
z80pass.c:97:6: error: conflicting types for 'getline'
void getline (void);
^
/usr/include/stdio.h:449:9: note: previous declaration is here
ssize_t getline(char ** __restrict, size_t * __restrict, FILE * ...
^
z80pass.c:168:1: error: conflicting types for 'getline'
getline (void)
^
/usr/include/stdio.h:449:9: note: previous declaration is here
ssize_t getline(char ** __restrict, size_t * __restrict, FILE * ...
^
z80pass.c:201:11: error: too few arguments to function call, expected 3, have 0
getline (); /* get a copy of current source line */
~~~~~~~ ^
/usr/include/stdio.h:449:1: note: 'getline' declared here
ssize_t getline(char ** __restrict, size_t * __restrict, FILE * ...
^
z80pass.c:522:25: warning: equality comparison with extraneous parentheses
[-Wparentheses-equality]
if ((modulehdr->first == CURRENTMODULE))
~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
z80pass.c:522:25: note: remove extraneous parentheses around the comparison to
silence this warning
if ((modulehdr->first == CURRENTMODULE))
~ ^ ~
z80pass.c:522:25: note: use '=' to turn this equality comparison into an
assignment
if ((modulehdr->first == CURRENTMODULE))
^~
=
z80pass.c:856:25: warning: field width should have type 'int', but argument has
type 'unsigned long' [-Wformat]
fprintf (listfile, "%*.*s", (int) 122 - strlen (copyrightmsg), (int) ...
~~^~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
z80pass.c:858:34: warning: field width should have type 'int', but argument has
type 'unsigned long' [-Wformat]
...%03d%*s'%s'\n\n\n", ++PAGENR, (int) 122 - 9 - 2 - strlen (lstfilename), ...
~~^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 warnings and 4 errors generated.
wintermute
Member
Posts: 16
Joined: Thu Feb 24, 2011 7:03 pm

Post by wintermute »

Hi groox!

I have tested compiling it using OSX 10.7.5 and XCode 4.5 and everything compiles fine (with some, I hope, harmless warnings).

What command lines did you use for code retrieval and compilation?
wintermute
Member
Posts: 16
Joined: Thu Feb 24, 2011 7:03 pm

Post by wintermute »

Hi again groox!

I think I've figured out your compiling problem: you need to install the GCC compiler through xCode.

Start xCode and go to the menu option xCode->Preferences. Choose the Downloads icon and then the Components tab, and choose to install the Command Line tools.

Hope this solves the issue. ;)
groox
New member
Posts: 5
Joined: Fri Apr 03, 2009 11:58 am

Post by groox »

Hi wintermute,

I've been able to compile and install.

When I try to compile I always get the same error:

zcc +zx -vn prueba2.c -o prueba2.bin -lndos -lsp1 -lmalloc -lim2 -create-app -zorg=32768
sccz80:"prueba2.c" L:150 Warning:#36:In function: drawmap() line 1
sccz80:"prueba2.c" L:150 Warning:#13:Pointer/pointer type mismatch
sccz80:"prueba2.c" L:150 Warning:#34:Func expects: struct sp1_tp*
sccz80:"prueba2.c" L:150 Warning:#35:Func gets: unsigned char *
Error at module 'ZX82_CRT0': Cannot read from file
1 errors occurred during assembly
Key to filenames:
/tmp/tmpJ6il8x2w.o = prueba2.c
Error at module 'ZX82_CRT0': Cannot read from file
make: *** [prueba2.bin] Error 1

I really don't know what I'm doing wrong.

Thx
wintermute
Member
Posts: 16
Joined: Thu Feb 24, 2011 7:03 pm

Post by wintermute »

Hello!
groox wrote:I've been able to compile and install.
Great! :)
groox wrote:When I try to compile I always get the same error:
[...]
I really don't know what I'm doing wrong.
This escapes to my knowledge. :rolleyes:

But have you compiled the SP1 library for the ZX81 target? The SP1 library must be configured and compiled apart of the whole compiling process.
groox
New member
Posts: 5
Joined: Fri Apr 03, 2009 11:58 am

Post by groox »

Hi,
I compiled through ../libsrc make sp1-spectrum.
I've copied sp1.lib to lib/clibs, and executed make install-libs.
Everything went fine.

So I'm just stucked at this point.

Thx.
stefano
Well known member
Posts: 1534
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

Got the same problem on a 64bit linux box, try with the older z80asm version (src/z80asm.stable folder).
Build it then copy z80asm over the installed one, for me it was '/usr/local/bin/'
stefano
Well known member
Posts: 1534
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

The latest daily snapshot contains a fix from Paulo which probably solves the problem above.
Could you please try it and report the results ?
decfreak
New member
Posts: 3
Joined: Wed Sep 12, 2012 6:25 pm

Post by decfreak »

Hello,

I built and installed the development kit with the latest nightly snapshot, and had no problems so far.
- Except that I got the same Error at "Building Interface 1 RS232 library" which is in the nightly report, either.

(My system configuration is 10.7.5 with XCode 4.5.1 and latest command line tools installed.)

I encountered a problem with the global installation.

After buid.sh, make install and make install-libs I went to z88dk/examples/z88
and ran, as an the README

Code: Select all

 zcc -lgfx gfx.c
which brought the output

Code: Select all

 Can't open config file /usr/local/lib/z88dk/lib/config/zcc.cfg
In fact there was no config-directory in /usr/local/lib/z88dk/lib/.

I solved it by adding the following lines to make install-libs in my Makefile:

Code: Select all

mkdir -p $(prefix)/lib/z88dk/lib/config
        cp -R lib/config/* $(prefix)/lib/z88dk/lib/config/
        find $(prefix)/lib/z88dk/lib/config -type f | xargs chmod 644
And ran it again.

Running the same command for the example above I now got

Code: Select all

 cp /usr/local/share/z88dk/lib/z88_crt0.opt /tmp/tmpR46qXjpD.opt
cp /tmp/tmpR46qXjpD.opt /tmp/tmpR46qXjpD.asm
zcpp -I. -DZ80 -DSMALL_C -DZ88 -D__Z88__ -DSCCZ80 -I/usr/local/share/z88dk/include  gfx.c /tmp/tmpBKBZdfJX.i
sccz80     /tmp/tmpBKBZdfJX.i
copt /usr/local/share/z88dk/lib/z80rules.2 < /tmp/tmpBKBZdfJX.asm > /tmp/tmpBKBZdfJX.op1
copt /usr/local/share/z88dk/lib/z80rules.1 < /tmp/tmpBKBZdfJX.op1 > /tmp/tmpBKBZdfJX.opt
z80asm -eopt -ns -Mo -I/usr/local/share/z88dk/lib /tmp/tmpBKBZdfJX.opt
z80asm -a -m -Mo -L/usr/local/share/z88dk/lib/clibs -I/usr/local/share/z88dk/lib -oa.bas -igfx  -iz88_clib  -iz80_crt0  /tmp/tmpR46qXjpD.opt /tmp/tmpBKBZdfJX.o
As I'm not sure if it is a really "bug", a specific problem on OS X, or there is something wrong with the environment variables, I wanted to ask you here.

BTW, my environment variables have been set as follows at both tests:

Code: Select all

 ZCCCFG = /usr/local/share/z88dk/lib/config/
Z80_OZFILES = /usr/local/share/z88dk/lib/
Thanks for your help in advance.
Oliver
stefano
Well known member
Posts: 1534
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

Oliver, are you still facing the same problem with the latest daily snapshot ?
Post Reply