MantisBT - lxdream
View Issue Details
0000073lxdreamOtherpublic2012-05-14 10:242019-09-01 05:09
0000073: mercurial version fails to compile due to undefined G_DIR_SEPARATOR
This bug affects the current revision (1285) of the mercurial repo. It also happens for me with the 0.9.1 source avalable from [^]

When I run './configure' then 'make', the compilation aborts due to the following errors:

lxpaths.c: In function ‘get_absolute_path’:
lxpaths.c:116:47: error: ‘G_DIR_SEPARATOR’ undeclared (first use in this function)
lxpaths.c:116:47: note: each undeclared identifier is reported only once for each function it appears in
lxpaths.c: In function ‘get_filename_at’:
lxpaths.c:129:53: error: ‘G_DIR_SEPARATOR’ undeclared (first use in this function)

and after fixing that file, same thing happens elsewhere:

drivers/cdrom/cd_gdi.c: In function ‘gdi_image_read_toc’:
drivers/cdrom/cd_gdi.c:76:5: warning: implicit declaration of function ‘g_path_get_dirname’ [-Wimplicit-function-declaration]
drivers/cdrom/cd_gdi.c:76:13: warning: assignment makes pointer from integer without a cast [enabled by default]
drivers/cdrom/cd_gdi.c:126:67: error: ‘G_DIR_SEPARATOR’ undeclared (first use in this function)
drivers/cdrom/cd_gdi.c:126:67: note: each undeclared identifier is reported only once for each function it appears in

I am running Ubuntu 12.04 (64bit). For me G_DIR_SEPARATOR is defined in the file /usr/include/glib-2.0/glib/gfileutils.h

I am no coder, but my solution was to add the line
#include <glib/gfileutils.h>
at the beginning of the files lxpaths.c and drivers/cdrom/cd_gdi.c.

Also, glib.h seems to include all other glib/g*.h files, including glib/gfileutils.h. So an alternative solution is to replace the lines
#include <glib/gfileutils.h>
#include <glib/gstrfuncs.h>
at the beginning of the files lxpaths.c and drivers/cdrom/cd_gdi.c with simply:
#include <glib.h>

I don't know which is better. I tried both solutions and they both work. It's probably a question of style. As I said, I am no coder :-) I have attached a patch that implements the former solution (as it looked more minimalistic).


By the way, in this bug tracker one cannot select "0.9.1" nor "mercurial" as "Product Version" when reporting an issue. It stops at 0.9; it would be cool if this was fixed since most issues reported will probably affect one of these two versions.
No tags attached.
patch g_dir_separator.patch (708) 2012-05-14 10:24
Issue History
2012-05-14 10:24einheitlixNew Issue
2012-05-14 10:24einheitlixFile Added: g_dir_separator.patch
2012-05-14 10:33einheitlixNote Added: 0000089
2012-07-02 08:23einheitlixNote Added: 0000090
2019-09-01 05:09nkeynesNote Added: 0000091
2019-09-01 05:09nkeynesStatusnew => closed
2019-09-01 05:09nkeynesAssigned To => nkeynes
2019-09-01 05:09nkeynesResolutionopen => fixed

2012-05-14 10:33   
In the second solution described above, I of course meant to replace the lines:
#include <glib/gutils.h>
#include <glib/gstrfuncs.h>

and not
#include <glib/gfileutils.h>
#include <glib/gstrfuncs.h>

Sorry for the typo.
2012-07-02 08:23   
This bug has been fixed with commit 1286 and can be closed.
2019-09-01 05:09   
I believe this was fixed as part of the glib.h changes