Bug 692443 - compilation error: gs/base/time_.h:49:8: error: redefinition of ‘struct timeval’
Summary: compilation error: gs/base/time_.h:49:8: error: redefinition of ‘struct timeval’
Status: RESOLVED DUPLICATE of bug 692426
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Build Process (show other bugs)
Version: master
Hardware: PC Linux
: P4 minor
Assignee: Chris Liddell (chrisl)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-18 15:54 UTC by Matteo Gamboz
Modified: 2014-02-17 04:46 UTC (History)
1 user (show)

See Also:
Customer:
Word Size: ---


Attachments
diff between the original time_.h file and one that compiles (44 bytes, patch)
2011-08-18 15:54 UTC, Matteo Gamboz
Details | Diff
configure log file (68.91 KB, text/x-log)
2011-08-18 15:55 UTC, Matteo Gamboz
Details

Note You need to log in before you can comment on or make changes to this bug.
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:
./configure
make XCFLAGS=-DHAVE_SYS_TIME_H=1

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

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