 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
paulotex
Joined: 20 Jan 2008 Posts: 19
|
Posted: Sun Sep 21, 2008 6:41 pm Post subject: canonical libtiff problems |
|
|
I've been struggling to compile libtiff with no success for the last 24h. Perhaps someone can help me with it. I think it involves some autoconf magic. Here it goes:
* First I got the source from libtiff.org: 3.8.2
* Then I did the usuall config/config.sub patch to add the psp allegrex. Ran autoconf.
* | Code: | | LDFLAGS="-L`psp-config -p`/lib -lc -lpspuser" ./configure --host=psp --prefix=`psp-config -P` --disable-shared |
This _seems_ to work fine.
* make failes with:
| Code: | libtool: link: CURRENT `' must be a nonnegative integer
libtool: link: `3:8:2' is not valid version information |
* So I patched config/ltmain.sh:
| Code: |
--- config/ltmain.sh 2006-01-23 18:22:32.000000000 +0000
+++ ../tiff-3.8.2-psp2/config/ltmain.sh 2008-09-21 07:41:34.000000000 +0100
@@ -4711,7 +4711,7 @@
# which has an extra 1 added just for fun
#
case $version_type in
- darwin|linux|osf|windows)
+ darwin|linux|osf|windows|none)
current=`expr $number_major + $number_minor`
age="$number_minor"
revision="$number_revision"
|
Ran configure again (to recreate libtool) and make.
* This times it fails with:
| Code: |
/Volumes/Extra/Users/paulo/pspdev/bin/../lib/gcc/psp/4.3.1/../../../../psp/lib/libc.a(lib_a-getopt.o):(.bss+0x4): multiple definition of `optind'
../port/.libs/libport.a(getopt.o):/Users/paulo/Documents/PSP/Apps/Bookr/Arrr/tiff-3.8.2-psp/port/getopt.c:56: first defined here
|
After lots of research, I found out that it is getting duplicate symbols because during "configure" it could _not_ detect "getopt", so it compiled its own version. But because getopt exists, they are now conflicting.
* The reason configure failed detecting getopt is here, in config.log:
| Code: | psp-gcc -o conftest -g -O2 -Wall -W -I/Users/paulo/include -L/Users/paulo/pspdev/psp/sdk/lib -lc -lpspuser conftest.c -lm -lc >&5
/Volumes/Extra/Users/paulo/pspdev/bin/../lib/gcc/psp/4.3.1/../../../../psp/lib/libc.a(_write.o): In function `_write':
libcglue.c:(.text+0x84): undefined reference to `sceIoWrite' |
If I remove the last -lc and put -lm _before_ conftest.c, the getopt test compiles fine.
So this is where I'm stuck. How can I tell autoconf to place the libs _before_ the source file? Why is it adding -lc when it is already there? Even if I solve this issue, -lc at the end will bite me again later for sure.
I'm sure this problem has occurred before with other libs based on autotools. How did other developers solve it?
Thanks |
|
| Back to top |
|
 |
paulotex
Joined: 20 Jan 2008 Posts: 19
|
Posted: Sun Sep 21, 2008 9:00 pm Post subject: Solved! |
|
|
Sorry to answer my own post, but I solved the problem. In configure.ac, after checking for the fundamental libs (in libtiff, it's just libc and libm), just add:
| Code: |
dnl For PSPSDK, Make sure we add "-lc -lpspuser" at the end
case "$target" in
*-psp-*)
LIBS="$LIBS -lc -lpspuser"
;;
*)
;;
esac
|
"make" still breaks in the "tools" folder, but that is fine by me, "make install" installs the libs and the headers just fine. |
|
| Back to top |
|
 |
paulotex
Joined: 20 Jan 2008 Posts: 19
|
Posted: Sun Sep 21, 2008 9:27 pm Post subject: Summary |
|
|
Here's the summary, in case any one is interested. This can also be helpfull for other autotools projects:
* Edit config.sub and add the mipsallegrex-psp target.
* Edit ltmain.sh and fix version_type. This fix might break the configure on other systems.
* Edit configure.ac and make sure LIBS has "-lc -lpspuser" at the end.
* Run autoconfig.
* Configure should be run as:
| Code: | | LDFLAGS="-L`psp-config -p`/lib -lc -lpspuser" ./configure --host=psp --prefix=`psp-config -P` --disable-shared |
Here is the complete patch against the tiff-3.8.2. sources:
| Code: | --- tiff-3.8.2/config/config.sub 2006-03-21 16:42:49.000000000 +0000
+++ tiff-3.8.2-psp/config/config.sub 2008-09-21 09:24:11.000000000 +0100
@@ -3,7 +3,7 @@
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-timestamp='2006-02-23'
+timestamp='2008-09-21'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@@ -265,6 +265,7 @@
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
| mipstx39 | mipstx39el \
+ | mipsallegrex | mipsallegrexel \
| mn10200 | mn10300 \
| mt \
| msp430 \
@@ -348,6 +349,7 @@
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipstx39-* | mipstx39el-* \
+ | mipsallegrex | mipsallegrexel \
| mmix-* \
| mt-* \
| msp430-* \
@@ -878,6 +880,10 @@
ps2)
basic_machine=i386-ibm
;;
+ psp)
+ basic_machine=mipsallegrexel-psp
+ os=-elf
+ ;;
pw32)
basic_machine=i586-unknown
os=-pw32
diff -rwBux configure tiff-3.8.2/config/ltmain.sh tiff-3.8.2-psp/config/ltmain.sh
--- tiff-3.8.2/config/ltmain.sh 2006-01-23 18:22:32.000000000 +0000
+++ tiff-3.8.2-psp/config/ltmain.sh 2008-09-21 09:29:24.000000000 +0100
@@ -4711,7 +4711,7 @@
# which has an extra 1 added just for fun
#
case $version_type in
- darwin|linux|osf|windows)
+ darwin|linux|osf|windows|none)
current=`expr $number_major + $number_minor`
age="$number_minor"
revision="$number_revision"
diff -rwBux configure tiff-3.8.2/configure.ac tiff-3.8.2-psp/configure.ac
--- tiff-3.8.2/configure.ac 2006-03-23 14:36:40.000000000 +0000
+++ tiff-3.8.2-psp/configure.ac 2008-09-21 11:49:28.000000000 +0100
@@ -92,6 +93,15 @@
;;
esac
+dnl For PSPSDK, Make sure we add -lpspuser at the end
+case "$target" in
+ *-psp-*)
+ LIBS="$LIBS -lc -lpspuser"
+ ;;
+ *)
+ ;;
+esac
+
dnl Checks for header files.
AC_CHECK_HEADERS([assert.h fcntl.h limits.h malloc.h search.h sys/time.h unistd.h])
|
And here is my compile&install session:
| Code: |
$ tar xzf tiff-3.8.2.tar.gz
$ cd tiff-3.8.2
$ patch -p1 <../libtiff.diff
patching file config/config.sub
patching file config/ltmain.sh
patching file configure.ac
$ autoconf
$ LDFLAGS="-L`psp-config -p`/lib -lc -lpspuser" ./configure --host=psp --prefix=`psp-config -P` --disable-shared
...
$ make
...
bmp2tiff.o: In function `main':
/Users/paulo/Documents/PSP/Apps/Bookr/Arrr/tiff-3.8.2/tools/bmp2tiff.c:781: relocation truncated to fit: R_MIPS_GPREL16 against `__ctype_ptr'
collect2: ld returned 1 exit status
make[1]: *** [bmp2tiff] Error 1
make: *** [all-recursive] Error 1
$ make install
...
bmp2tiff.o: In function `main':
/Users/paulo/Documents/PSP/Apps/Bookr/Arrr/tiff-3.8.2/tools/bmp2tiff.c:781: relocation truncated to fit: R_MIPS_GPREL16 against `__ctype_ptr'
collect2: ld returned 1 exit status
make[1]: *** [bmp2tiff] Error 1
make: *** [install-recursive] Error 1
|
The errors during make and install are on the tools. The lib is fine. |
|
| Back to top |
|
 |
Insert_witty_name
Joined: 10 May 2006 Posts: 376
|
Posted: Sun Sep 21, 2008 10:34 pm Post subject: |
|
|
| Adding -G0 to the CFLAGS should remove the __ctype_ptr warnings. |
|
| Back to top |
|
 |
paulotex
Joined: 20 Jan 2008 Posts: 19
|
Posted: Sun Sep 21, 2008 11:14 pm Post subject: |
|
|
| Insert_witty_name wrote: | | Adding -G0 to the CFLAGS should remove the __ctype_ptr warnings. |
duh! Thanks! This is everywhere to be found, I was so obsessed with other errors that I overlooked this. With this flag the compilation of the tools advance quite well until:
| Code: | Making all in iptcutil
if psp-gcc -DHAVE_CONFIG_H -I. -I. -I../../libtiff -I../../libtiff -I../../libtiff -I/Users/paulo/include -G0 -Wall -W -MT iptcutil.o -MD -MP -MF ".deps/iptcutil.Tpo" -c -o iptcutil.o iptcutil.c; \
then mv -f ".deps/iptcutil.Tpo" ".deps/iptcutil.Po"; else rm -f ".deps/iptcutil.Tpo"; exit 1; fi
iptcutil.c:8:20: error: memory.h: No such file or directory
make[2]: *** [iptcutil.o] Error 1
|
But as I told before, having the lib is all I needed.
Thanks for the info! |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|