[Mono-dev] gtksourceview: compilation error and strange runtime behaviour/errors

Quandary quandary82 at hailmail.net
Sun Apr 17 04:31:11 EDT 2011


Hi,

I'm now trying to get SQL Syntax highlighting to work with GTK.
And I already had 2  problems just getting the gtksourceview sample to
work...

Problem 1 (file: gtksourceview/generated/SourcePrintJob.cs):
[Obsolete]
protected SourcePrintJob(GLib.GType gtype) : base(gtype) {}

This gives a compilation error, because this constructor still is used
(in the sample, I guess)...
Now obsolete or not, as long as it still is used, this has to be:
public SourcePrintJob(GLib.GType gtype) : base(gtype) {}

or else:
---------------
/usr/local/bin/mcs -out:PrintSample.exe ./PrintSample.cs
-r:../gtksourceview/gtksourceview-sharp.dll -pkg:gtk-sharp-2.0
-pkg:gnome-sharp-2.0
./PrintSample.cs(47,38): error CS0122:
`GtkSourceView.SourcePrintJob.SourcePrintJob(GLib.GType)' is
inaccessible due to its protection level
/root/sources/mono/2.10/gtksourceview-sharp-2.0-0.12/gtksourceview/gtksourceview-sharp.dll
(Location of the symbol related to previous error)
./PrintSample.cs(65,23): error CS0234: The type or namespace name
`PrintJob' does not exist in the namespace `Gnome'. Are you missing an
assembly reference?
./PrintSample.cs(68,17): error CS0246: The type or namespace name
`PrintDialog' could not be found. Are you missing a using directive or
an assembly reference?
./PrintSample.cs(69,17): error CS0841: A local variable `dialog' cannot
be used before it is declared
./PrintSample.cs(70,17): error CS0841: A local variable `dialog' cannot
be used before it is declared
./PrintSample.cs(71,17): error CS0841: A local variable `dialog' cannot
be used before it is declared
./PrintSample.cs(72,32): error CS0841: A local variable `dialog' cannot
be used before it is declared
./PrintSample.cs(74,39): error CS0103: The name `PrintButtons' does not
exist in the current context
./PrintSample.cs(76,25): error CS0841: A local variable `dialog' cannot
be used before it is declared
./PrintSample.cs(77,25): error CS0841: A local variable `dialog' cannot
be used before it is declared
./PrintSample.cs(82,36): error CS0103: The name `PrintButtons' does not
exist in the current context
./PrintSample.cs(85,36): error CS0103: The name `PrintButtons' does not
exist in the current context
./PrintSample.cs(93,17): error CS0841: A local variable `dialog' cannot
be used before it is declared
./PrintSample.cs(94,17): error CS0841: A local variable `dialog' cannot
be used before it is declared
Compilation failed: 14 error(s), 0 warnings
make[1]: *** [PrintSample.exe] Error 1
make[1]: Leaving directory
`/root/sources/mono/2.10/gtksourceview-sharp-2.0-0.12/sample'
make: *** [all-recursive] Error 1
--------------------------


Problem 2:
Does the example use the 2.0 version of gtksourceview-sharp ?
Without looking into the makefile: it doesn't seem that way.

********
root at IS1300-1:/etc/ld.so.conf.d# cat gtksource*

# mono needs you
/usr/local/lib/mono/gtksourceview-sharp-2.0

# mono needs you
/usr/local/lib/mono/gac/gtksourceview-sharp

# mono needs you
/usr/local/lib/mono/gac/gtksourceview-sharp/1.0.0.2__35e10195dab3c99f

root at IS1300-1:/etc/ld.so.conf.d# /sbin/ldconfig
********

And it still doesn't find the dll.
Furthermore, if I copy
/usr/local/lib/mono/gac/gtksourceview-sharp/1.0.0.2__35e10195dab3c99f/1gtksourceview-sharp.dll
into the sample directory, it starts working.

This is strange, because this should have started working the moment the
directory was included in /etc/ld.so.conf.d/ and /sbin/ldconfig was run.
Besides, the dll always was in the gac...

It seems to require localcopy, even if the dll is in the gac and/or in
the ld-paths.


My interpretation is that:
A) The sample is compiled referencing an old version of gtksourceview

B) Mono seems to ignore ldconfig settings, at least for non-native dll's.

and since it looks like it doesn't consider
/usr/local/lib/mono/gac.
but only
/usr/lib/mono/gac

C) that either the install directory or the lookup of it is wrong.

and

D) that it (=mono/ld-linux) gladly ignores export
LD_PRELOAD="/usr/local/lib/mono/gac/gtksourceview-sharp/1.0.0.2__35e10195dab3c99f/1gtksourceview-sharp.dll"


Which results in this
--------------------
root at IS1300-1:~/sources/mono/2.10/gtksourceview-sharp-2.0-0.12/sample#
export
LD_PRELOAD="/usr/local/lib/mono/gac/gtksourceview-sharp/1.0.0.2__35e10195dab3c99f/1gtksourceview-sharp.dll"
root at IS1300-1:~/sources/mono/2.10/gtksourceview-sharp-2.0-0.12/sample#
./SourceViewTest.exe SourceViewTest.cs

ERROR: ld.so: object
'/usr/local/lib/mono/gac/gtksourceview-sharp/1.0.0.2__35e10195dab3c99f/1gtksourceview-sharp.dll'
from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object
'/usr/local/lib/mono/gac/gtksourceview-sharp/1.0.0.2__35e10195dab3c99f/1gtksourceview-sharp.dll'
from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object
'/usr/local/lib/mono/gac/gtksourceview-sharp/1.0.0.2__35e10195dab3c99f/1gtksourceview-sharp.dll'
from LD_PRELOAD cannot be preloaded: ignored.


** (SourceViewTest:4267): WARNING **: The following assembly referenced
from
/root/sources/mono/2.10/gtksourceview-sharp-2.0-0.12/sample/SourceViewTest.exe
could not be loaded:
     Assembly:   gtksourceview-sharp    (assemblyref_index=2)
     Version:    1.0.0.2
     Public Key: 35e10195dab3c99f
The assembly was not found in the Global Assembly Cache, a path listed
in the MONO_PATH environment variable, or in the location of the
executing assembly
(/root/sources/mono/2.10/gtksourceview-sharp-2.0-0.12/sample/).


** (SourceViewTest:4267): WARNING **: Could not load file or assembly
'gtksourceview-sharp, Version=1.0.0.2, Culture=neutral,
PublicKeyToken=35e10195dab3c99f' or one of its dependencies.

Unhandled Exception: System.IO.FileNotFoundException: Could not load
file or assembly 'gtksourceview-sharp, Version=1.0.0.2, Culture=neutral,
PublicKeyToken=35e10195dab3c99f' or one of its dependencies.
File name: 'gtksourceview-sharp, Version=1.0.0.2, Culture=neutral,
PublicKeyToken=35e10195dab3c99f'
  at SourceViewTest..ctor () [0x00000] in <filename unknown>:0
  at SourceViewTest.Main (System.String[] args) [0x00000] in <filename
unknown>:0
root at IS1300-1:~/sources/mono/2.10/gtksourceview-sharp-2.0-0.12/sample#
-----------------


More information about the Mono-devel-list mailing list