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 112517 - Compile failure of gtksourceview-0.2.0
Compile failure of gtksourceview-0.2.0
Status: RESOLVED FIXED
Product: gtksourceview
Classification: Platform
Component: General
unspecified
Other Solaris
: Normal blocker
: ---
Assigned To: GTK Sourceview maintainers
GTK Sourceview maintainers
: 115491 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2003-05-07 19:44 UTC by Peter O'Shea
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: 2.3/2.4


Attachments
implementation using POSIX regexps (13.16 KB, patch)
2003-05-08 12:37 UTC, Gustavo Giráldez
none Details | Review
corrected patch (12.94 KB, patch)
2003-05-08 15:09 UTC, Gustavo Giráldez
none Details | Review
updated patch (71.39 KB, application/x-gzip)
2003-05-10 06:45 UTC, Gustavo Giráldez
  Details

Description Peter O'Shea 2003-05-07 19:44:20 UTC
Trying to compile gtksourceview-0.2.0 with gcc-3.2.2 on Sparc Solaris 8, I
run into the following problem:

 /home/poshea/usr/bin/gcc -DHAVE_CONFIG_H -I. -I. -I..
-DDATADIR=\"/home/poshea/usr/gnome2/share\"
-DG_LOG_DOMAIN=\"GtkSourceView\" -DG_DISABLE_DEPRECATED
-DGTK_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED
-DGDK_PIXBUF_DISABLE_DEPRECATED -DGNOME_DISABLE_DEPRECATED -I.. -I. -Wall
-Wunused -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes
-Wnested-externs -Wpointer-arith -Wsign-promo -Wno-sign-compare -Werror
-DORBIT2=1 -threads -I/home/poshea/usr/gnome2/include/gtk-2.0
-I/home/poshea/usr/gnome2/lib/gtk-2.0/include
-I/home/poshea/usr/gnome2/include/atk-1.0
-I/home/poshea/usr/gnome2/include/pango-1.0 -I/home/poshea/usr/include
-I/home/poshea/usr/include/freetype2 -I/usr/openwin/include
-I/home/poshea/usr/gnome2/include/glib-2.0
-I/home/poshea/usr/gnome2/lib/glib-2.0/include
-I/home/poshea/usr/gnome2/include/libgnome-2.0
-I/home/poshea/usr/gnome2/include/orbit-2.0
-I/home/poshea/usr/gnome2/include/libbonobo-2.0
-I/home/poshea/usr/gnome2/include/gconf/2
-I/home/poshea/usr/gnome2/include/gnome-vfs-2.0
-I/home/poshea/usr/gnome2/lib/gnome-vfs-2.0/include
-I/home/poshea/usr/gnome2/include/linc-1.0
-I/home/poshea/usr/gnome2/include/bonobo-activation-2.0
-I/home/poshea/usr/include/libxml2 -O3 -mcpu=ultrasparc
-I/home/poshea/usr/include -I/home/poshea/usr/gnome2/include -MT
gtksourcebuffer.lo -MD -MP -MF .deps/gtksourcebuffer.Tpo -c
gtksourcebuffer.c  -fPIC -DPIC -o .libs/gtksourcebuffer.o
In file included from gtksourcetag-private.h:29,
                 from gtksourcebuffer.c:37:
../gtksourceview/gtksourceregex.h:42: field `buf' has incomplete type
../gtksourceview/gtksourceregex.h:43: field `reg' has incomplete type
gmake[2]: *** [gtksourcebuffer.lo] Error 1
gmake[2]: Leaving directory
`/home/poshea/usr/source/gnome2.4/gtksourceview-0.2.0/gtksourceview'
gmake[1]: *** [install-recursive] Error 1
gmake[1]: Leaving directory
`/home/poshea/usr/source/gnome2.4/gtksourceview-0.2.0/gtksourceview'
gmake: *** [install-recursive] Error 1



The offending lines in gtksourceview/gtksourceregex.h are:
struct _GtkSourceRegex 
{
        struct re_pattern_buffer buf;
        struct re_registers      reg;
        gint                     len;
};

Nowhere in the package can I find a definition of struct re_pattern_buffer
or re_registers.  What gives?
Comment 1 Hidetoshi Tajima 2003-05-07 21:48:36 UTC
This is because gtksourceview requires GNU's
regex which are not on Solaris's:

  re_compile_pattern
  re_compile_fastmap
  re_search
  re_match

gtksourceview may have own src/regex.[ch] copy
from glibc-2.3, and compile it in for #ifndef __GNU__ cases.
Comment 2 Gustavo Giráldez 2003-05-08 04:48:33 UTC
Hidetoshi: I prefer an implementation using POSIX regular expressions.
 Can I assume they are present in Solaris' C library?

Another question: I think the definition of __GNU__ only says we are
compiling with GCC.  Do you know of any other safe way to know if we
are using the GNU libc headers?
Comment 3 Paolo Maggi 2003-05-08 08:17:13 UTC
We have 3 possible solutions :

- have a private copy of regex.[ch] as suggested by Hidetoshi
- using POSIX regex as suggested by Gustavo
- using PCRE (www.pcre.org)

Is PCRE already dstributed by Sun with Solaris?
Comment 4 Gustavo Giráldez 2003-05-08 12:37:57 UTC
Created attachment 16362 [details] [review]
implementation using POSIX regexps
Comment 5 Gustavo Giráldez 2003-05-08 12:43:22 UTC
The attached patch conditionally implements GtkSourceRegex with POSIX
regexps or GNU regexps.

Could you please test the patch in Solaris and see if it compiles and
works ok?

The POSIX implementation has a slight performance penalty due to two
missing features: a) length constraint in the regex searching; and b)
matching operation (as opossed to searching).  Nevertheless
GtkSourceView still feels fast enough, at least in my machine.
Comment 6 Peter O'Shea 2003-05-08 13:14:37 UTC
I applied the patch.  Now when I compile gtksourceregex.c, I get:

gtksourceregex.c: In function `gtk_source_regex_compile':
gtksourceregex.c:200: structure has no member named `translate'
gtksourceregex.c:201: structure has no member named `fastmap'
gtksourceregex.c:202: structure has no member named `allocated'
gtksourceregex.c:203: structure has no member named `buffer'
gtksourceregex.c:204: structure has no member named `can_be_null'
gtksourceregex.c:205: structure has no member named `no_sub'
gmake[4]: *** [gtksourceregex.lo] Error 1
Comment 7 Gustavo Giráldez 2003-05-08 15:09:23 UTC
Created attachment 16369 [details] [review]
corrected patch
Comment 8 Gustavo Giráldez 2003-05-08 15:11:03 UTC
Sorry about that.  Those lines were left from the GNU regexp
implementation.  Could you please try this new patch instead?  Thanks.

Comment 9 Peter O'Shea 2003-05-08 16:53:33 UTC
Ok, with the new patch it compiles ok.  I then compiled gedit-2.3.1
and gedit-plugins-2.3.1.  I can't tell if gtksourceview is
working...if I open a .c file in gedit, it doesn't color-tag anything.
 Is there something else I need to do to test it?
Comment 10 Paolo Maggi 2003-05-09 09:16:52 UTC
Try to run the test-widget program in the tests directory.
Comment 11 Paolo Maggi 2003-05-09 09:46:59 UTC
Which icon do gedit show you in the tab?

I'm wondering if gedit is getting the right mime type.
Comment 12 Peter O'Shea 2003-05-09 14:05:12 UTC
if I run the test-widget for gtksourceview, I get a window with a c
source file.  None of the syntax is color-highlighted, all of the text
is b/w.

In gedit, when I open a .c file, the tiny icon for the file is visibly
different from a random text file.
Comment 13 Paolo Maggi 2003-05-09 14:15:45 UTC
Does test-widget print some text on the console?
Comment 14 Peter O'Shea 2003-05-09 14:54:30 UTC
Here's the console output:

bugs{poshea}53: ./test-widget

(lt-test-widget:21172): GLib-GObject-CRITICAL **: file gobject.c: line
1337 (g_object_unref): assertion `G_IS_OBJECT (object)' failed

(lt-test-widget:21172): GLib-GObject-CRITICAL **: file gobject.c: line
1337 (g_object_unref): assertion `G_IS_OBJECT (object)' failed
Finalize lang: Ada
Finalize lang: C
Finalize lang: C++
Finalize lang: Diff
Finalize lang: .desktop
Finalize lang: HTML
Finalize lang: IDL
Finalize lang: Java
Finalize lang: Latex
Finalize lang: Perl
Finalize lang: gettext translation
Finalize lang: Python
Finalize lang: XML
bugs{poshea}54: 
Comment 15 Gustavo Giráldez 2003-05-09 23:07:24 UTC
Nothing is highlighted probably because the Solaris' regex
implementation doesn't understand our regular expressions.

We use a pair of GNU extensions, and some of them don't have a POSIX
counterpart (word boundary operator for example) as I've just come to
notice.

So, we have no other choice but to include GNU's regex library as
Hidetoshi first suggested.  The other alternative would be to use
PCRE, but that would add another dependency to the Gnome Desktop,
which is not something we can do now.

I'll work a patch to compile the GNU regex library on systems which
don't use the GNU implementation.
Comment 16 Paolo Maggi 2003-05-09 23:09:38 UTC
Gustavo: BTW, I think the still relevant part of your patch should go in.
Comment 17 Gustavo Giráldez 2003-05-09 23:16:13 UTC
Paolo: ok, agreed.

Peter: those warnings in the console output of test-widget don't seem
related to this bug.  Could you please run test-widget with
--g-fatal-warnings and attach the resulting backtrace?  Thanks.

Comment 18 Gustavo Giráldez 2003-05-10 06:45:49 UTC
Created attachment 16402 [details]
updated patch
Comment 19 Gustavo Giráldez 2003-05-10 06:55:05 UTC
The attached file is a gzipped patch.  The patch does the following:

a) includes a GNU regex implementation (copied verbatim from glibc
2.3.2) in a gnu-regex directory
b) detects at configure time if the C library has the GNU regex API
and otherwise sets a conditional to build and link to the private library
c) abstracts GtkSourceRegex by hiding its members, so we can later
change the regex implementation if we have to
d) changes the regular expression syntax used for POSIX extended + GNU
operators
e) changes the c.lang file to the chosen regex syntax

I only ported the c.lang to the POSIX extended syntax, so other
mimetypes will not be highlighted after this patch is applied.

I'm not sure if the conditional part is right.  It works in my
machine, but if somebody could double check configure.in and
Makefile.am files I would really appreciate it.

Could you please see if this compiles and works for you?  If this is
ok, I'll port the rest of the .lang files and commit.  Thanks.
Comment 20 Peter O'Shea 2003-05-12 17:51:16 UTC
I applied the new patch to the original source, and it fails during
compile with the below output:
Undefined                       first referenced
 symbol                             in file
re_match                           
../gtksourceview/.libs/libgtksourceview-1.0.so
re_syntax_options                  
../gtksourceview/.libs/libgtksourceview-1.0.so
re_compile_fastmap                 
../gtksourceview/.libs/libgtksourceview-1.0.so
re_compile_pattern                 
../gtksourceview/.libs/libgtksourceview-1.0.so
re_search                          
../gtksourceview/.libs/libgtksourceview-1.0.so
ld: fatal: Symbol referencing errors. No output written to
.libs/test-widget


If I go into the gtksourceview/gnu-regex subdir, I see that there's on
ly a Makefile.am, no Makefile, and none of the files have been
compiled.  Is there some additional configure bit needed?
Comment 21 Gustavo Giráldez 2003-05-12 20:18:29 UTC
Did the patch apply cleanly?  And did you re-run autogen.sh
afterwards?  It's weird because Makefile in gnu-regex directoy should
have been generated irregardless of whether it is used or not, and if
it's missing the build should have failed before trying to build the
tests.

If this is not the problem, could you please attach your config.log
file?  Could be that the test in configure.in for the GNU regex API is
wrong.
Comment 22 Peter O'Shea 2003-05-13 13:31:13 UTC
The patch applied cleanly, but I didn't know I needed to run
autogen.sh.  I don't have autogen.sh, and it isn't included in the
gtksourceview distribution.  Remember, this is a Solaris system that
doesn't have a complete set of Gnu build tools.  I rely on a working
configure program, not a configure.in.
Comment 23 Gustavo Giráldez 2003-05-15 07:03:59 UTC
I've just committed a patch which should fix this issue.  I already
checked with Peter and it seems to work for him.  Could somebody else
running Solaris (without GNU C library) please try latest CVS version
and tell me if it compiles and works fine?  Thanks.
Comment 24 Hidetoshi Tajima 2003-05-16 06:22:12 UTC
I confirmed the patch has fixed compilation error on
my Solris 9 x86 box. 

I also built and ran a gedit with patched gtksourceview. 
With C source code opened, hightlighting with colors
seems to work fine.

I'd agree to mark this fixed.
Comment 25 Gustavo Giráldez 2003-05-20 19:32:04 UTC
Marking fixed then.  Thanks.
Comment 26 Gustavo Giráldez 2003-06-19 14:42:00 UTC
*** Bug 115491 has been marked as a duplicate of this bug. ***