After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 604858 - Fails to build on non-linux systems that have strptime()
Fails to build on non-linux systems that have strptime()
Status: RESOLVED FIXED
Product: evolution-data-server
Classification: Platform
Component: general
2.30.x (obsolete)
Other GNU Hurd
: Normal normal
: ---
Assigned To: Evolution Shell Maintainers Team
Evolution QA team
Depends on:
Blocks:
 
 
Reported: 2009-12-17 21:04 UTC by Emilio Pozuelo Monfort
Modified: 2013-09-14 16:53 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix build on GNU/Hurd (1.83 KB, patch)
2009-12-17 21:05 UTC, Emilio Pozuelo Monfort
needs-work Details | Review
Fix build on GNU/Hurd, take 2 (1.86 KB, patch)
2009-12-18 11:09 UTC, Emilio Pozuelo Monfort
accepted-commit_now Details | Review

Description Emilio Pozuelo Monfort 2009-12-17 21:04:41 UTC
Hi,

e-d-s has this in libedataserver/e-time-utils.c:

#ifdef __linux__
/* We need this to get a prototype for strptime. */
#define _GNU_SOURCE
#endif /* __linux__ */

And then if HAVE_STRPTIME is not defined, its implemented locally.

The problem is when you build e-d-s on a non-linux platform (such as GNU/Hurd) that has strptime. Since it doesn't define __linux__, _GNU_SOURCE isn't defined and you don't get a prototype for strptime(), but since HAVE_STRPTIME is defined, the function is not implemented and thus you get an implicit declaration error.

The attached patch makes use of _XOPEN_SOURCE instead of _GNU_SOURCE since both strptime and nl_langinfo are now POSIX, and do the right checks with HAVE_FOO rather than __linux__.
Comment 1 Emilio Pozuelo Monfort 2009-12-17 21:05:56 UTC
Created attachment 149939 [details] [review]
Fix build on GNU/Hurd
Comment 2 Matthew Barnes 2009-12-18 00:09:40 UTC
Evolution works on GNU/Hurd!?  I had no idea.

Can't verify this for myself but the patch and explanation seem reasonable.
Comment 3 Matthew Barnes 2009-12-18 00:11:51 UTC
GLib really ought to wrap this time stuff and deal with the portability issues so we don't have to.  Might be worth filing an enhancement request for that.
Comment 4 Emilio Pozuelo Monfort 2009-12-18 00:47:28 UTC
I haven't tried to run evo on Hurd yet, but who knows, maybe it works... past versions were building fine, maybe somebody has already used it ;)

Thanks, patch pushed:

http://git.gnome.org/cgit/evolution-data-server/commit/?id=47cf221ae610bbf64bc1e328960e5812c20df41f
Comment 5 Akhil Laddha 2009-12-18 06:02:37 UTC
Now eds is failing to build in my system 

/opt/gnome2/lib/glib-2.0/include -I/usr/include/libsoup-2.4 -I/usr/include/gconf/2 -I/usr/include/orbit-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/nspr4 -pthread -I/home/akhil/opt/gnome2/include/libxml2 -I/home/akhil/opt/gnome2/include/glib-2.0 -I/home/akhil/opt/gnome2/lib/glib-2.0/include -I/usr/include/libsoup-2.4 -g -O0 -Wl,--allow-shlib-undefined -fgnu89-inline -MT libedataserver_1_2_la-eds-version.lo -MD -MP -MF .deps/libedataserver_1_2_la-eds-version.Tpo -c eds-version.c  -fPIC -DPIC -o .libs/libedataserver_1_2_la-eds-version.o
mv -f .deps/libedataserver_1_2_la-e-proxy.Tpo .deps/libedataserver_1_2_la-e-proxy.Plo
cp libedataserver.pc libedataserver-1.2.pc
mv -f .deps/libedataserver_1_2_la-e-sexp.Tpo .deps/libedataserver_1_2_la-e-sexp.Plo
mv -f .deps/libedataserver_1_2_la-e-source-group.Tpo .deps/libedataserver_1_2_la-e-source-group.Plo
e-time-utils.c: In function ‘e_mktime_utc’:
e-time-utils.c:1965: error: ‘struct tm’ has no member named ‘tm_gmtoff’
e-time-utils.c: In function ‘e_localtime_with_offset’:
e-time-utils.c:1996: error: ‘struct tm’ has no member named ‘tm_gmtoff’
make[2]: *** [libedataserver_1_2_la-e-time-utils.lo] Error 1
make[2]: *** Waiting for unfinished jobs....
mv -f .deps/libedataserver_1_2_la-e-source-list.Tpo .deps/libedataserver_1_2_la-e-source-list.Plo
mv -f .deps/libedataserver_1_2_la-e-source.Tpo .deps/libedataserver_1_2_la-e-source.Plo
mv -f .deps/libedataserver_1_2_la-e-url.Tpo .deps/libedataserver_1_2_la-e-url.Plo
mv -f .deps/libedataserver_1_2_la-e-data-server-util.Tpo .deps/libedataserver_1_2_la-e-data-server-util.Plo
mv -f .deps/test_source_list-test-source-list.Tpo .deps/test_source_list-test-source-list.Po
mv -f .deps/libedataserver_1_2_la-e-trie.Tpo .deps/libedataserver_1_2_la-e-trie.Plo
mv -f .deps/libedataserver_1_2_la-eds-version.Tpo .deps/libedataserver_1_2_la-eds-version.Plo
mv -f .deps/libedataserver_1_2_la-e-xml-utils.Tpo .deps/libedataserver_1_2_la-e-xml-utils.Plo
mv -f .deps/libedataserver_1_2_la-e-xml-hash-utils.Tpo .deps/libedataserver_1_2_la-e-xml-hash-utils.Plo
make[2]: Leaving directory `/home/akhil/src/git/evolution-data-server/libedataserver'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/akhil/src/git/evolution-data-server'
make: *** [all] Error 2
Comment 6 H.Habighorst 2009-12-18 06:55:27 UTC
Guess this should be reverted first.

There are a lot of definitions following - and I'm not sure if the removal of __linux is a good idea.

http://www.opengroup.org/onlinepubs/009695399/basedefs/time.h.html
http://www.opengroup.org/onlinepubs/009695399/functions/mktime.html

I guess gmtoff isn't supported - however I had no coffee till now and I don't want to guarantee that this guess is correct.
Comment 7 Milan Crha 2009-12-18 10:58:10 UTC
Reverted in commit 7519d65 due to build break.
Comment 8 Emilio Pozuelo Monfort 2009-12-18 11:09:32 UTC
Created attachment 149980 [details] [review]
Fix build on GNU/Hurd, take 2

tm_gmtoff is a BSD extension, as you can see on <time.h> or on localtime(3):

       The glibc version of struct tm has additional fields

              long tm_gmtoff;           /* Seconds east of UTC */
              const char *tm_zone;      /* Timezone abbreviation */

       defined  when _BSD_SOURCE was set before including <time.h>.  This is a BSD extension,
       present in 4.3BSD-Reno.

It was defined before because _GNU_SOURCE also defines _BSD_SOURCE.

The fix is to define _BSD_SOURCE to get tm_gmtoff back. The attached patch builds fine.

Sorry for breaking the build on master.
Comment 9 Milan Crha 2009-12-18 12:34:17 UTC
Thanks for the update. It seems to wirk, at least with respect of buildability. I didn't check the functionality itself, but the change seems to be fine. Thus please commit to master and close this bug. Thanks.
Comment 10 Emilio Pozuelo Monfort 2009-12-18 12:58:09 UTC
Thanks, committed.