gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > compiling zlib with devkitARM

#170375 - headspin - Sun Sep 20, 2009 6:08 am

Mod note: split from http://forum.gbadev.org/viewtopic.php?t=16862

wintermute wrote:
Not really sure how compression relates to malloc logging and memory fragmentation tbh. I'm also confused by the existence of something called ndszlib when zlib compiles OOB with devkitARM


The OP stated he's "extremely tight on memory" so I mearly suggested a way of conserving space that he may not have thought of. Just because it doesn't directly relate to the question doesn't make it a moot point.

About ndszlib: Perhaps it's just a modification of the makefile but the official zlib does not compile under devkitARM "out of the box".[/b]
_________________
Warhawk DS | Manic Miner: The Lost Levels | The Detective Game

#170380 - wintermute - Sun Sep 20, 2009 3:36 pm

headspin wrote:


About ndszlib: Perhaps it's just a modification of the makefile but the official zlib does not compile under devkitARM "out of the box".


I beg to differ.

Code:

monalisa:zlib-1.2.3 davem$ PATH=$DEVKITARM/bin:$PATH
monalisa:zlib-1.2.3 davem$ AR="arm-eabi-ar rc" RANLIB=arm-eabi-ranlib CC=arm-eabi-gcc prefix=$DEVKITPRO/portlibs/arm ./configure
Building static library libz.a version 1.2.3 with arm-eabi-gcc.
Checking for unistd.h... Yes.
Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()
Checking for vsnprintf() in stdio.h... Yes.
Checking for return value of vsnprintf()... Yes.
Checking for errno.h... Yes.
Checking for mmap support... No.
monalisa:zlib-1.2.3 davem$ make
arm-eabi-gcc -O3   -c -o example.o example.c
arm-eabi-gcc -O3   -c -o adler32.o adler32.c
arm-eabi-gcc -O3   -c -o compress.o compress.c
arm-eabi-gcc -O3   -c -o crc32.o crc32.c
arm-eabi-gcc -O3   -c -o gzio.o gzio.c
arm-eabi-gcc -O3   -c -o uncompr.o uncompr.c
arm-eabi-gcc -O3   -c -o deflate.o deflate.c
arm-eabi-gcc -O3   -c -o trees.o trees.c
arm-eabi-gcc -O3   -c -o zutil.o zutil.c
arm-eabi-gcc -O3   -c -o inflate.o inflate.c
arm-eabi-gcc -O3   -c -o infback.o infback.c
arm-eabi-gcc -O3   -c -o inftrees.o inftrees.c
arm-eabi-gcc -O3   -c -o inffast.o inffast.c
arm-eabi-ar rc libz.a adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o zutil.o inflate.o infback.o inftrees.o inffast.o
arm-eabi-gcc -O3 -o example example.o -L. libz.a
arm-eabi-gcc -O3   -c -o minigzip.o minigzip.c
arm-eabi-gcc -O3 -o minigzip minigzip.o -L. libz.a
monalisa:zlib-1.2.3 davem$ make install
cp zlib.h zconf.h /opt/devkitpro/portlibs/arm/include
chmod 644 /opt/devkitpro/portlibs/arm/include/zlib.h /opt/devkitpro/portlibs/arm/include/zconf.h
cp libz.a /opt/devkitpro/portlibs/arm/lib
cd /opt/devkitpro/portlibs/arm/lib; chmod 755 libz.a
cd /opt/devkitpro/portlibs/arm/lib; if test -f libz.1.2.3.dylib; then \
     rm -f libz.dylib libz.1.dylib; \
     ln -s libz.1.2.3.dylib libz.dylib; \
     ln -s libz.1.2.3.dylib libz.1.dylib; \
     (ldconfig || true)  >/dev/null 2>&1; \
   fi
cp zlib.3 /opt/devkitpro/portlibs/arm/share/man/man3
chmod 644 /opt/devkitpro/portlibs/arm/share/man/man3/zlib.3

_________________
devkitPro - professional toolchains at amateur prices
devkitPro IRC support
Personal Blog

#170383 - headspin - Sun Sep 20, 2009 7:13 pm

wintermute wrote:
I beg to differ.


Both from MSYS and command prompt I get

Code:
cc -O   -c -o example.o example.c
make: cc: Command not found
make: *** [example.o] Error 127


I did also try setting those environment variables but still get the same error. So I hardly call that "out of the box". But even if I could get it to compile with some esoteric compiler settings like in your example. I don't know much at all about your toolchain and as you've pretty much demonstrated to me I wouldn't have thought what seems so obvious to you and that is to type in "AR="arm-eabi-ar rc" RANLIB=arm-eabi-ranlib CC=arm-eabi-gcc" at the prompt. How silly of me not to know that but thanks for pointing it out.

Personally I prefer to spend my time writing software rather than messing about with toolchains so IMHO downloading a project with a makefile customised for devkitARM is a mindless preference for me. The ndszlib project can be compiled from command line with "make"; too easy!
_________________
Warhawk DS | Manic Miner: The Lost Levels | The Detective Game

#170397 - Sektor - Mon Sep 21, 2009 10:27 am

Well almost out of the box, just makefile changes.

It appears some other changes are needed to fix bugs.
_________________
GTAMP.com/DS

#170417 - wintermute - Tue Sep 22, 2009 10:09 am

Sektor wrote:
Well almost out of the box, just makefile changes.


That was the point of the procedure I outlined above, you don't need to edit anything

Quote:

It appears some other changes are needed to fix bugs.


Try building it properly, see if the bug still occurs
_________________
devkitPro - professional toolchains at amateur prices
devkitPro IRC support
Personal Blog

#170424 - headspin - Tue Sep 22, 2009 1:04 pm

Okay I'm definately going blind in my old age I just noticed your second argument goes onto the next line and totally missed it. Okay ran it again on MSYS and this time it compiles okay. But unfortunately it has the same issue as that compiled by Sektor's modified makefile. "uncompress" fails without making sverx's following change in inflate.c.

Code:
if ((state->wrap & 2) && hold == 0x8b1f) {  /* gzip header */


to

Code:
if (hold == 0x8b1f) {  /* gzip header */


We have no idea why but at least we know now it's not some mistake in Sektor's makefile.
_________________
Warhawk DS | Manic Miner: The Lost Levels | The Detective Game