Opened 20 years ago

Last modified 20 years ago

#497 closed defect (fixed)

GDAL 1.2.0a - build problems on Solaris 8

Reported by: Daniel Morissette Owned by: warmerdam
Priority: high Milestone:
Component: default Version: unspecified
Severity: normal Keywords:
Cc:

Description

Trying to build GDAL 1.2.0a on Solaris 8, using GCC 2.95.2, I get the following
errors:

---------------------
/bin/sh ../libtool --mode=compile g++ -Wall  -O2   -I../port  -c -o
cpl_vsisimple.o cpl_vsisimple.cpp
 g++ -Wall -O2 -I../port -c cpl_vsisimple.cpp  -fPIC -DPIC -o .libs/cpl_vsisimple.o
cpl_vsisimple.cpp: In function `struct tm * VSIGMTime(const time_t *, tm *)':
cpl_vsisimple.cpp:445: implicit declaration of function `int gmtime_r(...)'
cpl_vsisimple.cpp: In function `struct tm * VSILocalTime(const time_t *, tm *)':
cpl_vsisimple.cpp:463: implicit declaration of function `int localtime_r(...)'
make: *** [cpl_vsisimple.o] Error 1

---------------------


The function gmtime_r() is available in <time.h>, but for some reason the
prototype is not found (it is protected by a few #ifdefs in time.h).

The Solaris man pages talk about defining _POSIX_C_SOURCE to a value >= 199506L.
 I tried that but then started getting problems with strdup() in
cpl_vsisimple.cpp.  Looking in <string.h> it seems that this function isn't
available when _POSIX_C_SOURCE is defined.

OK. To make a long story short, I have removed HAVE_GMTIME_R and
HAVE_LOCALTIME_R in cpl_config.h and my compilation continues.

What should we do about this?  Should we put a test specific to Solaris in
configure?  Is this a problem that could apply to other platforms?  I have to
admit that I'm not familiar with this _POSIX_C_SOURCE define.

Change History (3)

comment:1 by warmerdam, 20 years ago

I have confirmed that this problem doesn't occur with all Solaris systems.
Solaris 2.9 with gcc 3.3 is fine.  I suspect the include file environment
on the solaris 8 system is "weak", but I would like to modify the configure
to deal with.  Daniel has provided me with an account to follow up.


comment:2 by Daniel Morissette, 20 years ago

Note that our machine's configuration is a bit messy, so it could be a compiler
configuration issue. (Note that we've been able to build GDAL and all of
MapServer and PHP's support libs without problems on it before).

And FYI, the build has completed and I was able to use ogrinfo to read a
shapefile, so other than this problem the rest looks fine.

comment:3 by warmerdam, 20 years ago

At a great cost in agony, I have implemented configure tests that verify 
the localtime_r and gmtime_r functions are usable from C++. 

Note: See TracTickets for help on using tickets.