Bug 689669

Summary: Ghostscript not compiling on AIX
Product: Ghostscript Reporter: Charles Duke <cduke>
Component: Config/InstallAssignee: Marcos H. Woehrmann <marcos.woehrmann>
Status: NOTIFIED FIXED    
Severity: critical CC: htl10
Priority: P4    
Version: 0.00   
Hardware: Other   
OS: AIX   
Customer: Word Size: ---
Attachments: Output of man mkstemp

Description Charles Duke 2008-01-25 06:26:17 UTC
We are using GNU gcc, GNU make and still ghostscript will not compile.
Here are the errors:
 /opt/ghostscript-8.61 # /usr/local/bin/make
gcc  -DHAVE_MKSTEMP  -DHAVE_FILE64 -DHAVE_MKSTEMP64  -O2 -Wall
-Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -Wwrite-strings
-Wno-strict-aliasing -fno-builtin -fno-common -DHAVE_STDINT_H
-DGX_COLOR_INDEX_TYPE="unsigned long long"   -I./obj -I./src  -o
./obj/gp_unifs.o -c ./src/gp_unifs.c
./src/gp_unifs.c: In function 'gp_open_scratch_file_generic':
./src/gp_unifs.c:92: error: 'mkstemp64' undeclared (first use in this function)
./src/gp_unifs.c:92: error: (Each undeclared identifier is reported only once
./src/gp_unifs.c:92: error: for each function it appears in.)
make: *** [obj/gp_unifs.o] Error 1

gcc version 4.0.0
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for powerpc-ibm-aix5.3.0.0
Your prompt attion to this will be appreciated.
Thank you
Charles Duke
Comment 1 Hin-Tak Leung 2008-02-16 19:12:44 UTC
does 'man mkstemp' show anything on your system?

I think it is just the configure logic getting a bit confused about mkstemp64
existing on 64-bit platform where mkstemp exists.
"-DHAVE_MKSTEMP  -DHAVE_FILE64 -DHAVE_MKSTEMP64"
is obviously not true!
Comment 2 Charles Duke 2008-02-18 08:26:33 UTC
Created attachment 3795 [details]
Output of man mkstemp

(pqtst) /root/charles/src/perl # man mkstemp

     Technical Reference: Base Operating System and Extensions, Volume 1

mktemp or mkstemp Subroutine

Purpose

       Constructs a unique file name.

Libraries

       Standard C Library (libc.a)

       Berkeley Compatibility Library (libbsd.a)

Syntax

       #include <stdlib.h>

       char *mktemp ( Template)

       char *Template;

       int mkstemp ( Template)

       char *Template;

Description

       The mktemp subroutine replaces the contents of the string pointed to by
       the Template parameter with a unique file name. Note: The mktemp
       subroutine creates a filename and checks to see if the file exist. It
       that file does not exist, the name is returned. If the user calls
       mktemp twice without creating a file using the name returned by the
       first call to mktemp, then the second mktemp call may return the same
       name as the first mktemp call since the name does not exist.

       To avoid this, either create the file after calling mktemp or use the
       mkstemp subroutine. The mkstemp subroutine creates the file for you.

       To get the BSD version of this subroutine, compile with Berkeley
       Compatibility Library (libbsd.a).

       The mkstemp subroutine performs the same substitution to the template
       name and also opens the file for reading and writing.

       In BSD systems, the mkstemp subroutine was intended to avoid a race
       condition between generating a temporary name and creating the file.
       Because the name generation in the operating system is more random,
       this race condition is less likely. BSD returns a file name of /
       (slash).

       Former implementations created a unique name by replacing X's with the
       process ID and a unique letter.

Parameters

       Template
	    Points to a string to be replaced with a unique file name. The
	    string in the Template parameter is a file name with up to six

	    trailing X's. Since the system randomly generates a six-character
	    string to replace the X's, it is recommended that six trailing X's
	    be used.

Return Values

       Upon successful completion, the mktemp subroutine returns the address
       of the string pointed to by the Template parameter.

       If the string pointed to by the Template parameter contains no X's, and
       if it is an existing file name, the Template parameter is set to a null
       character, and a null pointer is returned; if the string does not match
       any existing file name, the exact string is returned.

       Upon successful completion, the mkstemp subroutine returns an open file
       descriptor. If the mkstemp subroutine fails, it returns a value of -1.

Related Information

       The getpid (getpid, getpgrp, or getppid Subroutine) subroutine, tmpfile
       subroutine, tmpnam or tempnam subroutine.

       Files, Directories, and File Systems for Programmers in AIX 5L Version
       5.3 General Programming Concepts: Writing and Debugging Programs.
Comment 3 Hin-Tak Leung 2008-02-18 09:58:06 UTC
Hmm, can you post the result of
1) man mkstemp64
2) ./configure >& config.output  
 the file config.output, and config.log
Comment 4 Marcos H. Woehrmann 2008-09-15 17:14:18 UTC
Since it's been six months with no reply to comment #3 I'm closing this.  If this is still an active issue 
please reopen.
Comment 5 Hin-Tak Leung 2010-05-12 15:15:10 UTC
The fix was likely r8923 - AIX has a strange system whereby mkstemp64 is in libc but not in the includes, so ./configure (trying linking with libc) indicates the presence of mkstemp64 but src/gp_unifs.c failed due to missing prototype.