Author Topic: Question About Compiling Sz81  (Read 7778 times)

ckblackm

  • Jr. Member
  • **
  • Posts: 54
    • View Profile
Question About Compiling Sz81
« on: February 16, 2011, 02:39:49 pm »
I'm trying to compile SZ81 on beta 3.  First off, just doing a simple make works and it compiles, but if I try to use the
Makefile.zaurus, I get an error.   The Makefile.zaurus was originally used for the standard sharp rom, but I tried to change
it so that it would match the directory structure for pdaXrom.

Here is the modified Makefile.zaurus I used:
Code: [Select]
# You won't need to alter these
TARGET=$(shell cat TARGET)
SOURCES=sdl_main.c common.c sound.c z80.c sdl_engine.c sdl_hotspots.c \
    sdl_input.c sdl_loadsave.c sdl_resources.c sdl_sound.c sdl_video.c
OBJECTS=$(patsubst %.c, %.o, $(SOURCES))
VERSION=$(shell cat VERSION)
#export PREFIX=/opt/QtPalmtop
export PREFIX=/mnt/ide2/usr/local
PACKAGE_DATA_DIR=$(PREFIX)/share/$(TARGET)

# This uses the default cross compiler directory of /opt/Embedix and
# the default QPE directory of /opt/Qtopia
#
#DEVPREFIX=/opt/Qtopia/sharp
#CC=/opt/Embedix/tools/bin/arm-linux-gcc
DEVPREFIX=/opt/native/arm/3.4.6-xscale-softvfp
CC=/opt/native/arm/3.4.6-xscale-softvfp/bin/gcc
CFLAGS=-O3 -Wall -I$(DEVPREFIX)/include \
    `$(DEVPREFIX)/bin/sdl-config --prefix=$(DEVPREFIX) --cflags` \
    -DNO_DEBUG -DQWS -DPLATFORM_ZAURUS -DVERSION=\"$(VERSION)\" \
    -DPACKAGE_DATA_DIR=\"$(PACKAGE_DATA_DIR)\" -DOSS_SOUND_SUPPORT -DSZ81
LINK=$(CC)
LDFLAGS=-L$(DEVPREFIX)/lib
LIBS=`$(DEVPREFIX)/bin/sdl-config --prefix=$(DEVPREFIX) --libs`

# You won't need to alter anything below
all: $(SOURCES) $(TARGET)

$(TARGET): $(OBJECTS)
    $(LINK) $(LDFLAGS) $(OBJECTS) $(LIBS) -o $@
    zaurus/build-$(TARGET)

%.o: %.c
    $(CC) $(CFLAGS) -c $< -o $@

.PHONY: all clean

clean:
    rm -f *.o

Here's the output I get:
Code: [Select]
# make -f Makefile.zaurus
/opt/native/arm/3.4.6-xscale-softvfp/bin/gcc -O3 -Wall -I/opt/native/arm/3.4.6-xscale-softvfp/include `/opt/native/arm/3.4.6-xscale-softvfp/bin/sdl-config --prefix=/opt/native/arm/3.4.6-xscale-softvfp --cflags` -DNO_DEBUG -DQWS -DPLATFORM_ZAURUS -DVERSION=\"2.1.7\" -DPACKAGE_DATA_DIR=\"/mnt/ide2/usr/local/share/sz81\" -DOSS_SOUND_SUPPORT -DSZ81  -c sdl_main.c -o sdl_main.o
/opt/native/arm/3.4.6-xscale-softvfp/bin/gcc -O3 -Wall -I/opt/native/arm/3.4.6-xscale-softvfp/include `/opt/native/arm/3.4.6-xscale-softvfp/bin/sdl-config --prefix=/opt/native/arm/3.4.6-xscale-softvfp --cflags` -DNO_DEBUG -DQWS -DPLATFORM_ZAURUS -DVERSION=\"2.1.7\" -DPACKAGE_DATA_DIR=\"/mnt/ide2/usr/local/share/sz81\" -DOSS_SOUND_SUPPORT -DSZ81  -c common.c -o common.o
/opt/native/arm/3.4.6-xscale-softvfp/bin/gcc -O3 -Wall -I/opt/native/arm/3.4.6-xscale-softvfp/include `/opt/native/arm/3.4.6-xscale-softvfp/bin/sdl-config --prefix=/opt/native/arm/3.4.6-xscale-softvfp --cflags` -DNO_DEBUG -DQWS -DPLATFORM_ZAURUS -DVERSION=\"2.1.7\" -DPACKAGE_DATA_DIR=\"/mnt/ide2/usr/local/share/sz81\" -DOSS_SOUND_SUPPORT -DSZ81  -c sound.c -o sound.o
/opt/native/arm/3.4.6-xscale-softvfp/bin/gcc -O3 -Wall -I/opt/native/arm/3.4.6-xscale-softvfp/include `/opt/native/arm/3.4.6-xscale-softvfp/bin/sdl-config --prefix=/opt/native/arm/3.4.6-xscale-softvfp --cflags` -DNO_DEBUG -DQWS -DPLATFORM_ZAURUS -DVERSION=\"2.1.7\" -DPACKAGE_DATA_DIR=\"/mnt/ide2/usr/local/share/sz81\" -DOSS_SOUND_SUPPORT -DSZ81  -c z80.c -o z80.o
/opt/native/arm/3.4.6-xscale-softvfp/bin/gcc -O3 -Wall -I/opt/native/arm/3.4.6-xscale-softvfp/include `/opt/native/arm/3.4.6-xscale-softvfp/bin/sdl-config --prefix=/opt/native/arm/3.4.6-xscale-softvfp --cflags` -DNO_DEBUG -DQWS -DPLATFORM_ZAURUS -DVERSION=\"2.1.7\" -DPACKAGE_DATA_DIR=\"/mnt/ide2/usr/local/share/sz81\" -DOSS_SOUND_SUPPORT -DSZ81  -c sdl_engine.c -o sdl_engine.o
/opt/native/arm/3.4.6-xscale-softvfp/bin/gcc -O3 -Wall -I/opt/native/arm/3.4.6-xscale-softvfp/include `/opt/native/arm/3.4.6-xscale-softvfp/bin/sdl-config --prefix=/opt/native/arm/3.4.6-xscale-softvfp --cflags` -DNO_DEBUG -DQWS -DPLATFORM_ZAURUS -DVERSION=\"2.1.7\" -DPACKAGE_DATA_DIR=\"/mnt/ide2/usr/local/share/sz81\" -DOSS_SOUND_SUPPORT -DSZ81  -c sdl_hotspots.c -o sdl_hotspots.o
/opt/native/arm/3.4.6-xscale-softvfp/bin/gcc -O3 -Wall -I/opt/native/arm/3.4.6-xscale-softvfp/include `/opt/native/arm/3.4.6-xscale-softvfp/bin/sdl-config --prefix=/opt/native/arm/3.4.6-xscale-softvfp --cflags` -DNO_DEBUG -DQWS -DPLATFORM_ZAURUS -DVERSION=\"2.1.7\" -DPACKAGE_DATA_DIR=\"/mnt/ide2/usr/local/share/sz81\" -DOSS_SOUND_SUPPORT -DSZ81  -c sdl_input.c -o sdl_input.o
/opt/native/arm/3.4.6-xscale-softvfp/bin/gcc -O3 -Wall -I/opt/native/arm/3.4.6-xscale-softvfp/include `/opt/native/arm/3.4.6-xscale-softvfp/bin/sdl-config --prefix=/opt/native/arm/3.4.6-xscale-softvfp --cflags` -DNO_DEBUG -DQWS -DPLATFORM_ZAURUS -DVERSION=\"2.1.7\" -DPACKAGE_DATA_DIR=\"/mnt/ide2/usr/local/share/sz81\" -DOSS_SOUND_SUPPORT -DSZ81  -c sdl_loadsave.c -o sdl_loadsave.o
/opt/native/arm/3.4.6-xscale-softvfp/bin/gcc -O3 -Wall -I/opt/native/arm/3.4.6-xscale-softvfp/include `/opt/native/arm/3.4.6-xscale-softvfp/bin/sdl-config --prefix=/opt/native/arm/3.4.6-xscale-softvfp --cflags` -DNO_DEBUG -DQWS -DPLATFORM_ZAURUS -DVERSION=\"2.1.7\" -DPACKAGE_DATA_DIR=\"/mnt/ide2/usr/local/share/sz81\" -DOSS_SOUND_SUPPORT -DSZ81  -c sdl_resources.c -o sdl_resources.o
/opt/native/arm/3.4.6-xscale-softvfp/bin/gcc -O3 -Wall -I/opt/native/arm/3.4.6-xscale-softvfp/include `/opt/native/arm/3.4.6-xscale-softvfp/bin/sdl-config --prefix=/opt/native/arm/3.4.6-xscale-softvfp --cflags` -DNO_DEBUG -DQWS -DPLATFORM_ZAURUS -DVERSION=\"2.1.7\" -DPACKAGE_DATA_DIR=\"/mnt/ide2/usr/local/share/sz81\" -DOSS_SOUND_SUPPORT -DSZ81  -c sdl_sound.c -o sdl_sound.o
/opt/native/arm/3.4.6-xscale-softvfp/bin/gcc -O3 -Wall -I/opt/native/arm/3.4.6-xscale-softvfp/include `/opt/native/arm/3.4.6-xscale-softvfp/bin/sdl-config --prefix=/opt/native/arm/3.4.6-xscale-softvfp --cflags` -DNO_DEBUG -DQWS -DPLATFORM_ZAURUS -DVERSION=\"2.1.7\" -DPACKAGE_DATA_DIR=\"/mnt/ide2/usr/local/share/sz81\" -DOSS_SOUND_SUPPORT -DSZ81  -c sdl_video.c -o sdl_video.o
/opt/native/arm/3.4.6-xscale-softvfp/bin/gcc -L/opt/native/arm/3.4.6-xscale-softvfp/lib  sdl_main.o  common.o  sound.o  z80.o  sdl_engine.o  sdl_hotspots.o  sdl_input.o  sdl_loadsave.o  sdl_resources.o  sdl_sound.o  sdl_video.o `/opt/native/arm/3.4.6-xscale-softvfp/bin/sdl-config --prefix=/opt/native/arm/3.4.6-xscale-softvfp --libs` -o sz81
/opt/native/arm/3.4.6-xscale-softvfp/lib/gcc/armv5tel-cacko-linux/3.4.6/../../../../armv5tel-cacko-linux/lib/crt1.o: In function `_start':
init.c:(.text+0x2c): undefined reference to `main'
collect2: ld returned 1 exit status
make: *** [sz81] Error 1

Any suggestions?
If you want to play with it yourself.. you can get it from
SZ81 website

thanks,
Christopher.

koan

  • Sr. Member
  • ****
  • Posts: 370
    • View Profile
    • http://www.lyndonhill.com
Question About Compiling Sz81
« Reply #1 on: February 16, 2011, 03:56:02 pm »
It looks to me like you don't have a main function. All C programs must have one function called main(). I vaguely recall that SDL does something weird with main, perhaps using #defines ? I don't know but I would check your SDL set up and then take a look at sdl_main.c

HTH
Zocalo Feed Reader : Thai on Zaurus : Dictionaries for zbedic : Sharp ROM package feed
HELUX Handheld Embedded Linux Blog
SL-C3200 Multiboot : SL-C750  Sharp ROM

ckblackm

  • Jr. Member
  • **
  • Posts: 54
    • View Profile
Question About Compiling Sz81
« Reply #2 on: February 16, 2011, 04:38:22 pm »
It's gotta be something with the make file.... the regular makefile will compile without modification.  Here's the regular makefile for comparison:

Code: [Select]
# Comment/uncomment these to choose an installation destination
# System wide installation
#PREFIX?=/usr/local
#BINDIR?=$(PREFIX)/bin
#DOCDIR?=$(PREFIX)/share/doc/$(TARGET)
#PACKAGE_DATA_DIR?=$(PREFIX)/share/$(TARGET)

# Local installation within your home folder
#PREFIX?=$(HOME)/Games/$(TARGET)
#BINDIR?=$(PREFIX)
#DOCDIR?=$(PREFIX)/doc
#PACKAGE_DATA_DIR?=$(PREFIX)/data

# Run from current folder i.e. no installation
PREFIX?=.
BINDIR?=$(PREFIX)
DOCDIR?=$(PREFIX)
PACKAGE_DATA_DIR?=$(PREFIX)/data

# For sz81 OSS_SOUND_SUPPORT is now synonymous with SDL_SOUND_SUPPORT.
# Comment this out if you don't want sound support.
SOUNDDEF=-DOSS_SOUND_SUPPORT

# You won't need to alter these
TARGET=$(shell cat TARGET)
SOURCES=sdl_main.c common.c sound.c z80.c sdl_engine.c sdl_hotspots.c \
    sdl_input.c sdl_loadsave.c sdl_resources.c sdl_sound.c sdl_video.c
OBJECTS=$(patsubst %.c, %.o, $(SOURCES))
VERSION=$(shell cat VERSION)

# These should be ok for most.
# For debugging/profiling uncomment the following two lines:
#CFLAGS=-O0 -g -pg
#LDFLAGS=-pg
SDL_CONFIG?=sdl-config
CFLAGS?=-O3
CFLAGS+=-Wall `$(SDL_CONFIG) --cflags` -DVERSION=\"$(VERSION)\" \
    -DPACKAGE_DATA_DIR=\"$(PACKAGE_DATA_DIR)\" $(SOUNDDEF) -DSZ81
LINK=$(CC)
LDFLAGS=
LIBS=`$(SDL_CONFIG) --libs`

# You won't need to alter anything below
all: $(SOURCES) $(TARGET)

$(TARGET): $(OBJECTS)
    $(LINK) $(LDFLAGS) $(OBJECTS) $(LIBS) -o $@

%.o: %.c
    $(CC) $(CFLAGS) -c $< -o $@

.PHONY: all clean install

open%:
    -@if [ -n "`which pasmo 2> /dev/null`" ]; then \
        pasmo -v open8x/$@.asm open8x/$@.rom; \
        if [ -f open8x/$@.rom -a ! -e data/zx$*.rom ]; then \
            cp open8x/$@.rom data/zx$*.rom; \
        fi \
    else \
        echo "The Pasmo cross-assembler was not found: skipping $@"; \
    fi

clean:
    rm -f *.o

install:
    @if [ "$(PREFIX)" = . ]; then \
        echo "Installing into the current folder is not allowed."; \
        exit 2; \
    fi
    mkdir -p $(BINDIR)
    mkdir -p $(DOCDIR)
    mkdir -p $(PACKAGE_DATA_DIR)
    cp $(TARGET) $(BINDIR)
    cp AUTHORS COPYING ChangeLog NEWS README $(DOCDIR)
    cp data/*.bmp $(PACKAGE_DATA_DIR)
    @if [ -f data/zx80.rom ]; then cp data/zx80.rom $(PACKAGE_DATA_DIR); fi
    @if [ -f data/zx81.rom ]; then cp data/zx81.rom $(PACKAGE_DATA_DIR); fi
    
uninstall:
    @echo "Uninstalling is not currently implemented."

koan

  • Sr. Member
  • ****
  • Posts: 370
    • View Profile
    • http://www.lyndonhill.com
Question About Compiling Sz81
« Reply #3 on: February 16, 2011, 04:45:57 pm »
Edit: Scratch what I said.

Wait, why are you trying to compile with the Zaurus makefile if you can compile with the standard makefile ?
« Last Edit: February 16, 2011, 04:51:18 pm by koan »
Zocalo Feed Reader : Thai on Zaurus : Dictionaries for zbedic : Sharp ROM package feed
HELUX Handheld Embedded Linux Blog
SL-C3200 Multiboot : SL-C750  Sharp ROM

koan

  • Sr. Member
  • ****
  • Posts: 370
    • View Profile
    • http://www.lyndonhill.com
Question About Compiling Sz81
« Reply #4 on: February 19, 2011, 04:24:29 pm »
I would have thought that you should be able to use the regular makefile if you are compiling on pdaXrom just make sure that make can find gcc etc.

If you want to use the Zaurus makefile then you probably want to remove the -DPLATFORM_ZAURUS from CFLAGS as well as the changes you made. It would be worth grepping the code to find what is changed when PLATFORM_ZAURUS is defined.
Zocalo Feed Reader : Thai on Zaurus : Dictionaries for zbedic : Sharp ROM package feed
HELUX Handheld Embedded Linux Blog
SL-C3200 Multiboot : SL-C750  Sharp ROM