2004.03.18 08:04 "[Tiff] 64-bit libtiff build - help?", by James Noyes

2004.03.19 02:54 "[Tiff] 64-bit libtiff build - fixes enclosed", by James Noyes

On Fri, 19 Mar 2004 00:40:41 +0300 Andrey Kiselev <dron@ak4719.spb.edu> wrote:
> James,
>
> Ok. It will be nice to see fixes from you to incorporate them into
> libtiff source tree.
>

Turns out to be a piece of cake, actually. It seems each compiler has its own way of letting you know it's building 64-bit code. In the case of Sun's Forte, it defines '_LP64'. I started with a freshly undone tiff-v3.6.1.tar.gz, changed line 82 of tiff.h to read:

#if defined(_LP64) || defined(__alpha) || (defined(_MIPS_SZLONG) && _MIPS_SZLONG == 64) || defined(__LP64__) || defined(__arch64__)

Put my 64-bit "site.config" (see attached) in place, and got a clean, WORKING build. I did have to re-build gtk/gdk_pixbuf to get the tiff loaders to work correctly, but they're working 100% now, too.

Side note - it seems that for every 64-bit platform and for every compiler on those platforms, there's a different, vendor-specific set of defines that happen when using the compiler in 64-bit mode. Since the 64/32 bit issue in this case (libtiff) comes down to a single type - uint32 - would it be possible, rather than using the messy sequence of if defined()'s above, that a known 32-bit on all platform type be used to typedef uint32? This has to be possible, somehow, right?

I've been building code like a madman, both 32 and 64 bit for every package, for the past couple of weeks getting my package arsenal up to date, and so far at least 80% of them haven't required any code changes to build cleanly, only configure options.

Just looking for a possibly more elegant solution than my stuck-on fix above.

> > tiff2pdf is generating a Bus Error,
>
> I know... that problem was reported already. The fellow, who wrote that
> utility works on PowerPC and Intel boxes, so unaligned access is
> possible here. It will be cool and very helpful if you can get the gdb
> backtrace for that crash.
>

Ok, I'll work on this one tonight if possible.

> > and thumbnail generates an output file consisting of only an 8-byte
> > tiff header.
>
> This is something new. I shall take a look, probably there is something
> on the top.
>

I'll try to get to this after I grab a backtrace on tiff2pdf.

Cheers,
James Noyes
(jnoyes-tiff@retrogeeks.com)

# $Header: /cvsroot/osrs/libtiff/config.site,v 1.8 2002/10/11 14:33:49 dron Exp $
#
# TIFF Software
#
# Copyright (c) 1990-1997 Sam Leffler
# Copyright (c) 1991-1997 Silicon Graphics, Inc.
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
#

#
# This file holds site-specific configuration parameters.
#
# Nothing is defined in here by default, the definitions
# commented out below serve as documentation for what you
# can set in this file or a config.local file.
#
# Note that you do not need to set anything here unless you
# want to override the auto-configuration behaviour and/or
# interactive prompting done by the configure script.
#

#
# Package controls.
#
DSO="auto"                   # auto|IRIX|IRIX52 enable DSO support for system
JPEG="yes"                      # yes|no configure JPEG support (see below)
ZIP="yes"                    # yes|no configure Deflate support (see below)
LIBGL="auto"                      # yes|no|auto configure IRIS GL-based tools
LIBIMAGE="auto"                      # yes|no|auto configure SGI RGB image tools
HTML="yes"                   # yes|no install HTML documentation

NONINTERACTIVE=yes           # yes|no Don't ask for confirmation on console

#
# Directory parameters.
#
DIR_BIN="/usr/bin/sparcv9"               # directory for tools
DIR_LIB="/usr/lib/sparcv9"         # directory for libraries
DIR_INC="/usr/include"                 # directory for include files
DIR_MAN="/usr/man"                 # directory for manual pages
DIR_HTML="/usr/share/tiff/html"             # directory for HTML documentation

#
# Configuring supporting libraries.
#
# The TIFF software makes use of two ancillary packages: the IJG
# distribution to support the JPEG codec and the zlib distribution
# to support the Deflate codec.  To setup use of these packages you
# need to specify where each package's include files are located and
# where the pre-built library (static archive or DSO) is located.
# These may be different or the same (as when the package is compiled
# and referenced directly from the place where the software was
# loaded and compiled).
#
# DIRS_LIBINC is a space-separated list of directories to use for
# locating include files in these packages.  Note that it should not
# include -I options as might be passed to the C preprocessor; these
# are automatically added by the configure script when the Makefiles
# are generated.
#
# DIR_<package>LIB is the pathname of the directory where <package>'s
# pre-built library may be found; this is used when building a TIFF
# DSO (on systems where support is present) and when building the
# programs in the tools directory.  By default the configure script
# will load the associated library using
#
#     -L${DIR_<package>LIB} -l<package>
#
# e.g. -L${DIR_JPEGLIB} -ljpeg.  If this is wrong for your system
# (e.g. your compiler/loader does not support the -L option), then
# the LIB<package> parameter can be set explicitly to specify the
# library to use.
#

#
# JPEG-specific parameters; used when JPEG support is enabled (see above).
#
# JPEG support requires release 5 or later of the IJG code,
# which you can find on the Internet at ftp.uu.net:/graphics/jpeg/.
#
DIRS_LIBINC="$DIRS_LIBINC /usr/include" # directory for jpeg include files
DIR_JPEGLIB="/usr/lib/sparcv9"               # directory for libjpeg

# The following will enable OJPEG support.  Note that a patch libjpeg is
# required before this can be enabled.  It is also only supported if JPEG is
# enabled.

#OJPEG="yes"                               # yes|no configure OJPEG support

#
# Deflate-specific parameters; used when Deflate support is enabled (see above).
#
# NB: Deflate support requires version 0.92 or later of the zlib
#     library written by Jean-loup Gailly and Mark Adler.  Starting
#     with about 0.95 the library is called libz.a (previously it was
#     libgz.a).  The library was last found at
#
#        ftp://ftp.uu.net/graphics/png/code/zlib-0.93.tar.gz
#
#     Look for it also at ftp://ftp.uu.net/pub/archiving/zip/zlib.
#
#DIRS_LIBINC="$DIRS_LIBINC ../zlib"    # directory for zlib include files
DIR_GZLIB="/usr/lib/sparcv9"                  # directory for libz

#
# Miscellaneous parameters.
#
FILLORDER="MSB2LSB"                    # bit order of cpu (MSB2LSB/LSB2MSB)
MANSCHEME="sysv-source-cat-strip"   # manual page installation scheme
LARGEFILE="yes"                        # support for large (>2GiB) files

#
# Parameters used when building the software.
#
# Note that configure has several ENVOPTS built into it that are
# set according to the target.  This is done to help naive folks.
#
# Beware of changing the INSTALL definition; you *must* have an
# install script that emulates the Silicon Graphics install program!
#
#AR="/bin/ar"                             # pathname of suitable ar program
#AROPTS="rc"                           # options to ar for creating archive
CC="cc"                                     # name/pathname of C compiler
CCOMPILER=/opt/SUNWspro/bin/$CC            # path to compiler if not in PATH.
#ENVOPTS="-Aa"                                # options for getting ANSI C
GCOPTS="-g -xarch=v9a"                      # options to pass C compiler
OPTIMIZER="-xO3"                    # Optimization options for compiler
LDFLAGS="-xarch=v9a"                    # Special linker flags.
#LIBPORT='${PORT}/libport.a'          # library with emulation code
MACHDEPLIBS="-lm"                  # extra libraries for linking
#PORTFUNCS=""                              # non-standard functions to emulate
#RANLIB=":"                          # pathname of suitable ranlib program
DSOSUF="so"                                # DSO filename suffix
LIBCOPTS="-K PIC"                  # compiler options for building library
#TARGET=hppa1.1-hp-hpux11.11            # Force TARGET platform setting.
#PATH="$PATH:/usr/ccs/bin"               # Modify path for finding compilers,etc

#
# Makefile construction parameters.
#
# These should not normally be set; configure will
# deduce the appropriate syntax to use for includes.
#
#SETMAKE='MAKE       = ${MAKE}'              # define if make does not setup $MAKE

#
# General system stuff used by the distribution.
#
#CHMOD="/etc/chmod"                      # pathname of suitable chmod program
#INSTALL='${SHELL} ${PORT}/install.sh'      # SGI install program/emulator
#LN="/bin/ln"                             # pathname of suitable ln program
#LN_S="-s"                             # option to ${LN} to create symlink
#MV_F="-f"                           # option to ${MV} to force operation
#SED="/bin/sed"                             # pathname of suitable sed program
#SCRIPT_SH="/bin/sh"                  # pathname of suitable shell
#STRIP="/bin/strip"                 # strip program used by install.sh