libXml2 for psp

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
gsus
Posts: 5
Joined: Thu May 11, 2006 11:08 pm

libXml2 for psp

Post by gsus »

Hi,

im tring to compile libxml2 for psp. I need it for an collada importer.
Right now im at a point where im out of idears.. so i need help!
Im relativly new to makefile and configure sutff.

Heres what i did
downloaded libxml2-2.6.24
as another post suggested
edited config.sub and added

Code: Select all

	psp)
		basic_machine=mipsallegrexel-psp
		os=-elf
		;;
now im running configure.. note that it cant find the printf/vsnprintf functions.

Code: Select all

gsus@bytesucker ~/libxml/libxml2-2.6.24
$ CFLAGS="-O2 -G0 -DLITTLE_ENDIAN=1 -DBYTE_ORDER=LITTLE_ENDIAN -D_LOW_ACCURACY_
" LDFLAGS="-L$(psp-config --pspsdk-path)/lib -lc -lpspuser -lz -lpspnet -lpspne
t_inet -lpspnet_resolver -lpspsdk -lpspdebug -lpspkernel -lpspdisplay -lpspctrl
 -lpsputility -lpspdisplay_driver" ./configure --host=psp --prefix=$(psp-config
 --psp-prefix) --disable-shared --without-ftp --without-schemas --without-html

configure: WARNING: If you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used.
checking build system type... i686-pc-cygwin
checking host system type... mipsallegrexel-psp-elf
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for psp-strip... psp-strip
checking for psp-gcc... psp-gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... yes
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether psp-gcc accepts -g... yes
checking for psp-gcc option to accept ANSI C... none needed
checking for style of include used by make... GNU
checking dependency style of psp-gcc... gcc3
checking for a BSD-compatible install... /usr/bin/install -c
checking how to run the C preprocessor... psp-gcc -E
checking for rm... /usr/bin/rm
checking for mv... /usr/bin/mv
checking for tar... /usr/bin/tar
checking for perl... /usr/bin/perl
checking for xmllint... /usr/local/bin/xmllint
checking for xsltproc... /usr/bin/xsltproc
checking for function prototypes... yes
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... no
checking for strings.h... no
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for string.h... (cached) yes
checking for a sed that does not truncate output... /usr/bin/sed
checking for ld used by psp-gcc... /usr/local/pspdev/psp/bin/ld.exe
checking if the linker (/usr/local/pspdev/psp/bin/ld.exe) is GNU ld... yes
checking for /usr/local/pspdev/psp/bin/ld.exe option to reload object files...
r
checking for BSD-compatible nm... /usr/local/pspdev/bin/psp-nm -B
checking whether ln -s works... yes
checking how to recognise dependent libraries... unknown
checking dlfcn.h usability... no
checking dlfcn.h presence... no
checking for dlfcn.h... no
checking for psp-g++... psp-g++
checking whether we are using the GNU C++ compiler... yes
checking whether psp-g++ accepts -g... yes
checking dependency style of psp-g++... gcc3
checking how to run the C++ preprocessor... psp-g++ -E
checking for psp-g77... no
checking for psp-f77... no
checking for psp-xlf... no
checking for psp-frt... no
checking for psp-pgf77... no
checking for psp-fort77... no
checking for psp-fl32... no
checking for psp-af77... no
checking for psp-f90... no
checking for psp-xlf90... no
checking for psp-pgf90... no
checking for psp-epcf90... no
checking for psp-f95... no
checking for psp-fort... no
checking for psp-xlf95... no
checking for psp-ifc... no
checking for psp-efc... no
checking for psp-pgf95... no
checking for psp-lf95... no
checking for psp-gfortran... no
checking for g77... g77
checking whether we are using the GNU Fortran 77 compiler... yes
checking whether g77 accepts -g... yes
checking the maximum length of command line arguments... 8192
checking command to parse /usr/local/pspdev/bin/psp-nm -B output from psp-gcc o
ject... ok
checking for objdir... .libs
checking for psp-ar... psp-ar
checking for psp-ranlib... psp-ranlib
checking for psp-strip... (cached) psp-strip
checking if psp-gcc supports -fno-rtti -fno-exceptions... no
checking for psp-gcc option to produce PIC... -fPIC
checking if psp-gcc PIC flag -fPIC works... yes
checking if psp-gcc static flag -static works... yes
checking if psp-gcc supports -c -o file.o... yes
checking whether the psp-gcc linker (/usr/local/pspdev/psp/bin/ld.exe) supports
shared libraries... yes
checking dynamic linker characteristics... no
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... no
checking whether to build shared libraries... no
checking whether to build static libraries... yes
configure: creating libtool
appending configuration tag "CXX" to libtool
checking for ld used by psp-g++... /usr/local/pspdev/psp/bin/ld.exe
checking if the linker (/usr/local/pspdev/psp/bin/ld.exe) is GNU ld... yes
checking whether the psp-g++ linker (/usr/local/pspdev/psp/bin/ld.exe) supports
shared libraries... no
checking for psp-g++ option to produce PIC... -fPIC
checking if psp-g++ PIC flag -fPIC works... yes
checking if psp-g++ static flag -static works... no
checking if psp-g++ supports -c -o file.o... yes
checking whether the psp-g++ linker (/usr/local/pspdev/psp/bin/ld.exe) supports
shared libraries... no
checking dynamic linker characteristics... no
checking how to hardcode library paths into programs... immediate
appending configuration tag "F77" to libtool
checking if libtool supports shared libraries... no
checking whether to build shared libraries... no
checking whether to build static libraries... yes
checking for g77 option to produce PIC... -fPIC
checking if g77 PIC flag -fPIC works... no
checking if g77 static flag -static works... no
checking if g77 supports -c -o file.o... yes
checking whether the g77 linker (/usr/local/pspdev/psp/bin/ld.exe) supports sha
ed libraries... yes
checking dynamic linker characteristics... no
checking how to hardcode library paths into programs... immediate
Checking zlib
checking zlib.h usability... yes
checking zlib.h presence... yes
checking for zlib.h... yes
checking for gzread in -lz... no
Checking headers
checking for dirent.h that defines DIR... no
checking for sys/ndir.h that defines DIR... no
checking for sys/dir.h that defines DIR... no
checking for ndir.h that defines DIR... no
checking for library containing opendir... no
checking for ANSI C header files... (cached) yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking for unistd.h... (cached) yes
checking ctype.h usability... yes
checking ctype.h presence... yes
checking for ctype.h... yes
checking dirent.h usability... no
checking dirent.h presence... no
checking for dirent.h... no
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking malloc.h usability... yes
checking malloc.h presence... yes
checking for malloc.h... yes
checking stdarg.h usability... yes
checking stdarg.h presence... yes
checking for stdarg.h... yes
checking for sys/stat.h... (cached) yes
checking for sys/types.h... (cached) yes
checking time.h usability... yes
checking time.h presence... yes
checking for time.h... yes
checking ansidecl.h usability... no
checking ansidecl.h presence... no
checking for ansidecl.h... no
checking ieeefp.h usability... yes
checking ieeefp.h presence... yes
checking for ieeefp.h... yes
checking nan.h usability... no
checking nan.h presence... no
checking for nan.h... no
checking math.h usability... yes
checking math.h presence... yes
checking for math.h... yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking fp_class.h usability... no
checking fp_class.h presence... no
checking for fp_class.h... no
checking float.h usability... yes
checking float.h presence... yes
checking for float.h... yes
checking for stdlib.h... (cached) yes
checking for sys/socket.h... yes
checking for netinet/in.h... yes
checking for arpa/inet.h... yes
checking netdb.h usability... yes
checking netdb.h presence... yes
checking for netdb.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking sys/mman.h usability... no
checking sys/mman.h presence... no
checking for sys/mman.h... no
checking sys/timeb.h usability... yes
checking sys/timeb.h presence... yes
checking for sys/timeb.h... yes
checking signal.h usability... yes
checking signal.h presence... yes
checking for signal.h... yes
checking for arpa/nameser.h... no
checking for resolv.h... no
checking dl.h usability... no
checking dl.h presence... no
checking for dl.h... no
checking for dlfcn.h... (cached) no
Checking libraries
checking for strftime... no
checking for strftime in -lintl... no
checking for strdup... yes
checking for strndup... no
checking for strerror... no
checking for finite... no
checking for isnand... no
checking for fp_class... no
checking for class... no
checking for fpclass... no
checking for strftime... (cached) no
checking for localtime... no
checking for gettimeofday... no
checking for ftime... no
checking for stat... no
checking for _stat... no
checking for signal... no
checking for printf... no
checking for sprintf... no
checking for fprintf... no
checking for snprintf... no
checking for vfprintf... no
checking for vsprintf... no
checking for vsnprintf... no
checking for sscanf... no
checking for va_copy... yes
checking for library containing gethostent... no
checking for library containing setsockopt... no
checking for library containing connect... no
checking for type of socket length (socklen_t)... socklen_t *
checking whether to enable IPv6... no
checking for isnan... no
checking for isnan in -lm... yes
checking for isinf... no
checking for isinf in -lm... yes
Found python in /bin/python
Found Python version 2.4
checking for shl_load... no
checking for shl_load in -ldld... no
checking for dlopen... no
checking for dlopen in -ldl... no
Adding trio library for string functions
Checking configuration requirements
Enabling multithreaded support
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
checking for pthread_join in -lpthread... no
Disabling FTP support
Disabling HTML support
checking iconv.h usability... yes
checking iconv.h presence... yes
checking for iconv.h... yes
checking for iconv... no
checking for iconv in -liconv... no
Enabled Schematron support
Disabling Schemas/Relax-NG support
configure: creating ./config.status
config.status: creating libxml2.spec
config.status: creating Makefile
config.status: creating include/Makefile
config.status: creating include/libxml/Makefile
config.status: creating doc/Makefile
config.status: creating doc/examples/Makefile
config.status: creating doc/devhelp/Makefile
config.status: creating example/Makefile
config.status: creating python/Makefile
config.status: creating python/tests/Makefile
config.status: creating xstc/Makefile
config.status: creating include/libxml/xmlversion.h
config.status: creating xml2-config
config.status: creating libxml-2.0.pc
config.status: creating libxml-2.0-uninstalled.pc
config.status: creating python/setup.py
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
Done configuring

make stops at with some linker errors

Code: Select all

... .... ... 
/bin/sh ./libtool --tag=CC --mode=link psp-gcc  -O2 -G0 -DLITTLE_ENDIAN=1 -DBYTE
_ORDER=LITTLE_ENDIAN -D_LOW_ACCURACY_ -pedantic -W -Wformat -Wunused -Wimplicit
-Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninit
ialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wag
gregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winlin
e -Wredundant-decls  -L/usr/local/pspdev/psp/sdk/lib -lc -lpspuser -lz -lpspnet
-lpspnet_inet -lpspnet_resolver -lpspsdk -lpspdebug -lpspkernel -lpspdisplay -lp
spctrl -lpsputility -lpspdisplay_driver -o xmllint  xmllint.o ./libxml2.la    -l
m
psp-gcc -O2 -G0 -DLITTLE_ENDIAN=1 -DBYTE_ORDER=LITTLE_ENDIAN -D_LOW_ACCURACY_ -p
edantic -W -Wformat -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigr
aphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer
-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmis
sing-prototypes -Wnested-externs -Winline -Wredundant-decls -o xmllint xmllint.o
  -L/usr/local/pspdev/psp/sdk/lib ./.libs/libxml2.a -lc -lpspuser -lz -lpspnet -
lpspnet_inet -lpspnet_resolver -lpspsdk -lpspdebug -lpspkernel -lpspdisplay -lps
pctrl -lpsputility -lpspdisplay_driver -lm
./.libs/libxml2.a(xmlIO.o): In function `xmlGzfileOpen_real':
xmlIO.c:(.text+0xea4): undefined reference to `dup'
./.libs/libxml2.a(xmlIO.o): In function `xmlGzfileOpenW':
xmlIO.c:(.text+0x1010): undefined reference to `dup'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libz.a(gzio.o): In funct
ion `gz_open':
gzio.c:(.text+0x6f8): undefined reference to `fdopen'
gzio.c:(.text+0x7b0): undefined reference to `fprintf'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libz.a(gzio.o): In funct
ion `gzprintf':
gzio.c:(.text+0xedc): undefined reference to `vsnprintf'
collect2: ld returned 1 exit status
make[2]: *** [xmllint] Error 1
make[2]: Leaving directory `/home/gsus/libxml/libxml2-2.6.24'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/gsus/libxml/libxml2-2.6.24'
make: *** [all] Error 2
so i dont know where this "dup" funtion comes from or wher to find it.
also the printfs arent found.
i did a objdump -t libc.a | grep vsnprintf returns

Code: Select all

vsnprintf.o:     file format elf32-little
00000000 g     F .text  0000003c vsnprintf
hope someone can help me.. having a collada importer would be really nice!
regards, gsus
Gary13579
Posts: 93
Joined: Mon Aug 15, 2005 7:43 am

Post by Gary13579 »

When I compiled libxml2, I didn't need to edit any extra files. I just had to pass a few options to the configure script.. Let me try to find it.
danzel wrote:Another lib you may want (although it may be a bit big) is libxml2 http://xmlsoft.org

You can build it (atleast version 2.6.22) with the following lines:

Code: Select all

CC=psp-gcc CXX=psp-g++ LIBS="-lpspdebug -lpspdisplay -lpspge -lc -lpspuser -lpspkernel" LDFLAGS="-L/usr/local/pspdev/psp/sdk/lib" ./configure --host=mips --with-minimum --without-threads --without-writer --without-modules
make
It errors out partway through when building the tests, however this is after it successfully builds the library in the .libs dir.
IIRC, this is what I used to compile it. If it doesn't work I'll try to contact danzel on IRC and see what he says.
User avatar
dot_blank
Posts: 498
Joined: Wed Sep 28, 2005 8:47 am
Location: Brasil

Post by dot_blank »

i highly recommend tinyxml over that fat library
10011011 00101010 11010111 10001001 10111010
zdziisek
Posts: 3
Joined: Tue Dec 26, 2006 7:05 pm

Post by zdziisek »

I compiled libxml2 and copied *.h files to /usr/local/pspdev/psp/sdk/include and libxml2.a (and .la) /usr/local/pspdev/psp/sdk/lib

But I have serious problems with compiling even simpliest code:
$ make
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -g -c -o main.o
main.c
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -g -L. -L/usr/loc
al/pspdev/psp/sdk/lib main.o ../common/callbacks.o ../common/utils.o -lxml2 -l
m -lpspdebug -lpspdisplay -lpspge -lc -lpspuser -lpspkernel -lpspdebug -lpspdisp
lay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspne
t_resolver -lpsputility -lpspuser -lpspkernel -o template.elf
main.o: In function `main':
/home/zdziisek/psp/xml/main.c:45: undefined reference to `xmlParseFile'
collect2: ld returned 1 exit status
make: *** [template.elf] Blad 1
Makefile:

Code: Select all

TARGET = template
OBJS = main.o \
../common/callbacks.o \
../common/utils.o 

INCDIR = 
CFLAGS = -O0 -G0 -Wall -g
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

LIBDIR =
LDFLAGS =
LIBS = -lxml2 -lm -lpspdebug -lpspdisplay -lpspge -lc -lpspuser -lpspkernel

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = XML Test

PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
Other libraries works fine (i.e. curl from svn.p2dev.org)

What I am doing wrong? :(

Regards, Z.
be2003
Posts: 144
Joined: Thu Apr 20, 2006 2:46 pm

Post by be2003 »

lol

did you include the appropriate headers into your main.c file?

i.e. #include <libxml2.h>

i dont know if that is an actual header but you get the point...
- be2003
blog
Post Reply