Page 1 of 2

Mac OSX

Posted: Thu Jul 19, 2007 8:20 am
by Pengwin
Could anyone detail how to install z88dk on Mac OSX?

This could either be from source, or using the compiled binaries.

Posted: Thu Jul 19, 2007 10:34 am
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

Posted: Thu Jul 19, 2007 3:51 pm
by Pengwin
Thanks Dom, exactly what I was looking for.

Posted: Tue Sep 30, 2008 8:01 pm
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.

Posted: Wed Oct 01, 2008 3:07 pm
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

Posted: Sat Sep 24, 2011 11:38 am
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!

Posted: Sun Sep 25, 2011 8:45 am
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...

Posted: Sun Sep 25, 2011 9:54 am
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.

Posted: Sun Sep 25, 2011 5:04 pm
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...

Posted: Sun Sep 25, 2011 5:53 pm
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.

Posted: Mon Sep 26, 2011 6:58 am
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!

Posted: Tue Sep 27, 2011 6:07 pm
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?

Posted: Tue Sep 27, 2011 6:46 pm
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.

Posted: Tue Sep 27, 2011 9:54 pm
by wintermute
I've updated to latest CVS source tree and sp1.lib is now created. I'll try some examples now...

Thanks Dom!

Posted: Sun Oct 16, 2011 10:18 am
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?

Posted: Sun Sep 23, 2012 12:03 pm
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.

Posted: Thu Sep 27, 2012 2:46 pm
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?

Posted: Sun Sep 30, 2012 12:43 pm
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. ;)

Posted: Sun Oct 21, 2012 5:17 pm
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

Posted: Mon Oct 22, 2012 8:10 am
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.

Posted: Tue Oct 23, 2012 8:16 pm
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.

Posted: Wed Oct 24, 2012 8:00 am
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/'

Posted: Mon Oct 29, 2012 5:11 pm
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 ?

Posted: Wed Oct 31, 2012 4:55 pm
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

Posted: Thu Nov 01, 2012 2:49 pm
by stefano
Oliver, are you still facing the same problem with the latest daily snapshot ?