Bug 692443

Summary: compilation error: gs/base/time_.h:49:8: error: redefinition of ‘struct timeval’
Product: Ghostscript Reporter: Matteo Gamboz <gamboz>
Component: Build ProcessAssignee: Chris Liddell (chrisl) <chris.liddell>
Status: RESOLVED DUPLICATE QA Contact: Bug traffic <tech>
Severity: minor    
Priority: P4 CC: jackie.rosen
Version: master   
Hardware: PC   
OS: Linux   
Customer: Word Size: ---
Attachments: diff between the original time_.h file and one that compiles
configure log file

Description Matteo Gamboz 2011-08-18 15:54:42 UTC
Created attachment 7800 [details]
diff between the original time_.h file and one that compiles

Hi I could not compile gs 9.04 (either from the git repository or from the sourceforge tar.gz)
I think that the error I get might depend on the presence of sys/time.h on my system.
Surrounding the struct definition with an "#ifndef _BITS_TIME_H" I was able to compile, but not being an expert I am not sure it is the most correct thing to do.
I am attaching a diff file and the config.log.

The detailed error was:
make[2]: Entering directory `/usr/local/src/ghostpdl/main'
gcc  -O2 -Wall -Wundef -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -Wpointer-arith -Wwrite-strings -Wno-strict-aliasing -fno-builtin -fno-common -DHAVE_MKSTEMP -DHAVE_SSE2 -DHAVE_BSWAP32 -DHAVE_BYTESWAP_H -DHAVE_STDINT_H -DGX_COLOR_INDEX_TYPE="unsigned long"  -DPCL_INCLUDED   -I./obj -I../gs/base  -DWHICH_CMS="lcms"  -o ./obj/gp_unix.o -c ../gs/base/gp_unix.c
In file included from ../gs/base/gp_unix.c:17:0:
../gs/base/pipe_.h:39:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
In file included from ../gs/base/gp_unix.c:19:0:
../gs/base/time_.h:49:8: error: redefinition of ‘struct timeval’
/usr/include/x86_64-linux-gnu/bits/time.h:75:8: note: originally defined here
../gs/base/gp_unix.c: In function ‘gp_get_realtime’:
../gs/base/gp_unix.c:148:9: warning: implicit declaration of function ‘gettimeofday’ [-Wimplicit-function-declaration]
Comment 1 Matteo Gamboz 2011-08-18 15:55:38 UTC
Created attachment 7801 [details]
configure log file
Comment 2 Chris Liddell (chrisl) 2011-08-18 17:27:24 UTC
It seems some distributions have moved time.h, which confuses the build.

For now you can compile successfully by doing:

And we'll track the problem under the existing bug report.

*** This bug has been marked as a duplicate of bug 692426 ***