Hi, I'm working on a cross-build of GNU FreeDink to make it run on Sony PlayStation Portable. The build is based on a slightly modified gcc cross-compiler for mipsel, and a minimal libc on top off of newlib (ftp://sources.redhat.com/pub/newlib/) - check 'psptoolchain' and 'pspsdk' at http://svn.ps2dev.org/listing.php?repname=psp&path=%2Ftrunk%2F .
(My notes to reproduce the compilation environment can be found at: http://git.savannah.gnu.org/cgit/freedink.git/tree/doc/psp.txt ) The build now runs fine but I had to make a few slight changes in gnulib, some I think are bugs, some others may not :) Most of the time I don't use the modules directly, but they are pulled as dependencies by gnulib-tool. Can you tell me general guidelines to properly deal with these compilation errors? Or is pspdev out of the scope of gnulib? - using pathconf when HAVE_PATHCONF isn't defined: This simple patch avoids link-time error about missing pathconf. PATH_MAX falls back to MAXPATHLEN (below in the file), defined to 1024 in pspdev. diff --git a/lib/pathmax.h b/lib/pathmax.h index 6941e45..34ad3ab 100644 --- a/lib/pathmax.h +++ b/lib/pathmax.h @@ -27,9 +27,11 @@ # endif # if !defined PATH_MAX && defined _PC_PATH_MAX +# if defined HAVE_PATHCONF # define PATH_MAX (pathconf ("/", _PC_PATH_MAX) < 1 ? 1024 \ : pathconf ("/", _PC_PATH_MAX)) # endif +# endif /* Don't include sys/param.h if it already has been. */ # if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN - Including system's strings.h while it isn't available: This is by no mean a correct patch - this is just what I had to do to make things compile. I just happen to get this issue and I don't really understand why. My config.h reads: /* Define to 1 if you have the <strings.h> header file. */ /* #undef HAVE_STRINGS_H */ diff --git a/lib/strings.in.h b/lib/strings.in.h index 0c87af2..c8a5c86 100644 --- a/lib/strings.in.h +++ b/lib/strings.in.h @@ -23,7 +23,7 @@ #endif /* The include_next requires a split double-inclusion guard. */ -...@include_next@ @NEXT_STRINGS_H@ +//#...@include_next@ @NEXT_STRINGS_H@ #ifndef _GL_STRINGS_H #define _GL_STRINGS_H - missing libc functions: - fchdir.c references 'dup' and 'dup2' which are not present I just commented rpl_dup() and rpl_dup2(), as they weren't referenced themselves. - getcwd references 'rewinddir' which isn't present The code (getcwd.c:269) is apparently necessary for a corner case ("This is necessary in a chroot on at least one system (glibc-2.3.6 + linux 2.6.12"), I commented it as well. Here's the link command: psp-gcc -G0 -Wall -std=c99 -I/usr/local/pspdev/psp/include/SDL -Dmain=SDL_main -L/usr/local/pspdev/psp/sdk/lib -o freedink bgm.o dinkini.o dinkc.o dinkc_bindings.o dinkc_console.o dinkc_sp_custom.o dinkvar.o fastfile.o game_engine.o str_util.o io_util.o sfx.o gfx.o gfx_fade.o gfx_tiles.o gfx_utils.o gfx_fonts.o init.o rect.o input.o binreloc.o freedink_xpm.o paths.o log.o gfx_sprites.o vgasys_fon.o msgbox.o i18n.o freedink.o update_frame.o ../gnulib/lib/libgnu.a -lSDL_mixer -lSDL_image -lSDL_ttf -lSDL_gfx -L/usr/local/pspdev/psp/lib -lSDLmain -lSDL -lm -L/usr/local/pspdev/psp/sdk/lib -lpspdebug -lpspgu -lpspctrl -lpspge -lpspdisplay -lpsphprm -lpspsdk -lpsprtc -lpspaudio -lc -lpspuser -lpsputility -lpspkernel -lpspnet_inet -lvorbisidec -lfreetype -lpng -ljpeg -lz -lc -lpspuser -lm ../gnulib/lib/libgnu.a(getcwd.o): In function `rpl_getcwd': getcwd.c:(.text+0x2a0): undefined reference to `rewinddir' ../gnulib/lib/libgnu.a(fchdir.o): In function `rpl_dup': fchdir.c:(.text+0x410): undefined reference to `dup' ../gnulib/lib/libgnu.a(fchdir.o): In function `rpl_dup2': fchdir.c:(.text+0x5dc): undefined reference to `dup2' collect2: ld returned 1 exit status Thanks! -- Sylvain
