Page 1 of 1
Request: Organising Standard Libraries
Posted: Thu Oct 08, 2009 12:00 am
by jonjump
Apologies if this is off-topic - I couldn't find anywhere more suitable ...
What is the recommended place to store standard libraries such as zlib, jpeg, etc (i.e. not specific nds ones)? It doesn't seem to make sense to put them in libnds.
I'd like to know the standard for:-
1. the library e.g. libz.a - maybe $(DEVKITPRO)/lib
2. the includes e.g. zlib.h - maybe $(DEVKITPRO)/include
3. the source - maybe $DEVKITPRO/libsrc
I am slowly working my way through compiling a set of standard libraries such as zlib - and I'm going to try and get the maintainers to put the appropriate Makefiles etc in their distribution packages, so that we don't have to keep reinventing the wheel.
Thanks for your help.
JJ
Re: Request: Organising Standard Libraries
Posted: Thu Oct 08, 2009 12:47 pm
by WinterMute
Appropriate Makefiles are already reinventing the wheel. Most portable libraries will essentially compile straight out of the box with the right configure options.
zlib isn't a standard configure script but performs in a similar way.
Code: Select all
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
For most other libraries using recent autotools then `<path/to/>configure --host=arm-eabi --prefix=$DEVKITPRO/portlibs/arm` will probably work.
This will make the standard install location for hardware independent arm libraries as $(DEVKITPRO)/portlibs/arm include & lib. There is not & should not be a standard place for sources, if the user requires source then they should obtain it themselves. Please note that .la files and config files will need to be edited prior to distribution since they will contain absolute paths rather than using the environment variable.
There are already some prebuilt libraries including source tarballs at
https://sourceforge.net/projects/devkit ... /portlibs/ . Eventually I hope to have these provided through the installer/updater for ease of deployment.
Also, thanks for stopping by and asking before releasing your ports, it's much appreciated. Usually people don't check that their process and/or install location will fit in with future toolchain developments which ends up causing all sorts of support issues.
Re: Request: Organising Standard Libraries
Posted: Thu Oct 08, 2009 7:38 pm
by jonjump
Thanks - that is EXACTLY what I needed to know. I just successfully compiled zlib in the MSYS that you provide as a download as per your examples. I'll go and explore the pre-built ones now.