Trouble building from Visual Studio (git repo)

Hello,

First let me apologise for the length of this mail - it’s not quite as
long
as it looks, a lot of the text is error messages :frowning:

Anyway, I can now build from rake compile, however I’m having trouble
building from Visual Studio 2008 SP1.

The first thing that it complains about is something to do with
SpecSharp.targets. I managed to work-around this by copying this file
from
\merlin\main\Languages\Ruby to \merlin\main.
After doing this, I got an error about Microsoft.Scripting.dll meta-data
file not being found (with FxCop in the path), but changing the build
config
file to FxCop and then back to Debug seemed to make this problem go
away.
Next, I got a complaint about MSSharedLibKey.snk - I worked around this
by
creating a key myself (sn -k MSSharedLibKey.snk) in the folder it was
looking for.
Then when compiling, I get build 3 errors in ReflectionCacheGenerator.cs
(ClassInitGenerator). These are as follows:

Error 1 ‘IronRuby.Compiler.Methods’ is inaccessible due to its
protection level
\merlin\main\Languages\Ruby\ClassInitGenerator\ReflectionCacheGenerator.cs
line 29
Error 2 ‘IronRuby.Runtime.Calls.BlockDispatcher’ does not contain
a
definition for ‘MaxBlockArity’
\merlin\main\Languages\Ruby\ClassInitGenerator\ReflectionCacheGenerator.cs
line 102
Error 3 ‘IronRuby.Runtime.Calls.BlockDispatcher’ does not contain
a
definition for ‘MaxBlockArity’
\merlin\main\Languages\Ruby\ClassInitGenerator\ReflectionCacheGenerator.cs
line 103

I also get two build errors in IronRuby.Tests:

Error 5 ‘IronRuby.Compiler.IParserLogger’ is inaccessible due to
its
protection level
\merlin\main\Languages\Ruby\IronRuby.Tests\Parser\DefaultParserLogger.cs
line 24
Error 6 ‘IronRuby.Compiler.IParserLogger’ is inaccessible due to
its
protection level
\merlin\main\Languages\Ruby\IronRuby.Tests\Parser\CoverageParserLogger.cs
line 33

Commenting out errors 2 and 3, and making IronRuby.Compiler.Methods and
IronRuby.Compiler.IParserLogger public allows everything to build except
IronRuby.Tests which then fails with 47 compile errors.

Trying to run Ruby.Console with the code in this condition leads to a
MessageBox with the following:
Error while trying to run project: Could not load file or assembly
‘ir,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=67ede3a51bb28398’ or
one of
its dependencies. Strong name validation failed. (Exception from
HRESULT:
0x8013141A).

Presumably this is because I can’t just generate a strong-name key
myself? I
then ran sn -Vr using my public key token, and changed two places in
Ruby.Console’s app.config file - Microsoft.Scripting and IronRuby to use
my
public key token. At this point, running the console doesn’t bring up a
message box, but the application does terminate immediately with the
following appearing in the output window:

WEAK_TABLE: IronRuby.Runtime.WeakTable`2[[System.Object, mscorlib,
Version=
2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089],[IronRuby.Runtime.RubyInstanceData,
IronRuby, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=67ede3a51bb28398]]
A first chance exception of type ‘System.IO.FileLoadException’ occurred
in
mscorlib.dll
A first chance exception of type ‘IronRuby.Builtins.LoadError’ occurred
in
IronRuby.dll
A first chance exception of type
‘System.Reflection.TargetInvocationException’ occurred in mscorlib.dll
A first chance exception of type
‘System.Reflection.TargetInvocationException’ occurred in mscorlib.dll
A first chance exception of type
‘Microsoft.Scripting.InvalidImplementationException’ occurred in
Microsoft.Scripting.dll

So, when this failed, I tried to copy the only .snk file I could find
from
the subversion repository
(trunk\src\microsoft.scripting.core\debugkey.snk)
over my manually generated key, but this didn’t yield the correct public
key
token either (it gives 51c7b9aefdaeb546).

So, now I’m totally stuck. Any help or suggestions will be appreciated.

Regards

Terence

PS, I’m trying to get the build to work out of visual studio so that I
can
step through some of the code in the debugger.

Terence,

Sorry for the issues you’re having, crazy build breaks and signing are
never fun. Microsoft requires us to sign any binaries we produce, so
providing access to our repository is a pain because we can’t distribute
the private key used in signing. Jim is going to fix this so builds by
default build do not sign.

In the meantime, you’ll need to remove the signing flags from all the
.csproj files (Ruby.csproj, IronRuby.Libraries.csproj, and
IronRuby.Libraries.Yaml.csproj). Open the .csproj files in a
text-editor, and remove the following lines anywhere you find them (they
might be in a file more than once):

<DelaySign>true</DelaySign>
<AssemblyOriginatorKeyFile>..\..\..\MSSharedLibKey.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>

Rebuilding should not care about signing at all now. Let me know if you
run into any other problems.

~Jimmy

Yeah, the git repo doesn’t seem as smooth as the svn head… yet. Out of
curiosity have you tried the SVN head yet?

Also, you can start visual studio and attach to a running ir console
session
to do debugging if necessary.

Presumably turning off strong name validation for the public key token
would
work as well… no?

On Mon, Dec 8, 2008 at 7:02 PM, Jimmy S. <

I had Pete try that, and it didn’t work, but he might be hitting a
different issue. So yes, Skip verification (via sn -Vr) should work as
well.

JD

From: [email protected]
[mailto:[email protected]] On Behalf Of Michael
Letterle
Sent: Monday, December 08, 2008 4:05 PM
To: [email protected]
Subject: Re: [Ironruby-core] Trouble building from Visual Studio (git
repo)

Presumably turning off strong name validation for the public key token
would work as well… no?
On Mon, Dec 8, 2008 at 7:02 PM, Jimmy S.
<[email protected]mailto:[email protected]>
wrote:
Terence,

Sorry for the issues you’re having, crazy build breaks and signing are
never fun. Microsoft requires us to sign any binaries we produce, so
providing access to our repository is a pain because we can’t distribute
the private key used in signing. Jim is going to fix this so builds by
default build do not sign.

In the meantime, you’ll need to remove the signing flags from all the
.csproj files (Ruby.csproj, IronRuby.Libraries.csproj, and
IronRuby.Libraries.Yaml.csproj). Open the .csproj files in a
text-editor, and remove the following lines anywhere you find them (they
might be in a file more than once):

true
…....\MSSharedLibKey.snk
true

Rebuilding should not care about signing at all now. Let me know if you
run into any other problems.

~Jimmy

I’ve actually just managed to get this to work. I had to remove the 3
signing xml tags from every project in the solution (not just the 3
Jimmy
mentioned). I also had to remove the definition of SIGNED from every
project
that had it (which wasn’t all of them). Once this was done, all projects
built through without errors. I also had to change App.Config in
Ruby.Console to set the public key token to null on Microsoft.Scripting
and
IronRuby, to get the exe to start-up, but now it does, and I’ve
successfully
resolved my underlying issue (which was a load failure while using
test/unit
in some ironruby code I’m writing).

Incidentally, it turns out the solution to that problem was to copy
everything out of my C:\ruby\lib folder into
merlin\languages\ruby\ruby-1.8.6\lib folder. Is this the recommended
approach for now for using standard ruby libraries? What is the plan for
this going forwards?

I tried to generate a diff to send through of all the things I’ve had to
change to get the code to build from a fresh git checkout (remove the
check
for tf.exe, remove signing attribs, etc.), but my text editor appears to
have put ^M’s all over the csproj files. Presumably there’s some
windows/cygwin line-ending conflict going on there. If this diff would
be
useful to anybody, I can re-edit those files from cygwin’s vim, which
should
fix the CRLF problem.

Thanks again for all the helpful advice

Terence

Hey Jim

Please find attached the diff. It’s not perfect (I’ve managed to lose
what I
think are unicode markers from some of the files, as well as some
end-of-file newlines), but it should give you a good idea.

To sum up, I think this is the entire set of things I had to do to be
able
to compile a fresh check-out under both VS and rake:

  1. Remove tf.exe from misc.rake
  2. Remove the SIGNED defined constant from all csproj files
  3. Remove SignAssembly, AssemblyOriginatorKeyFile and DelaySign tags
    from
    all csproj files.
  4. Set the PublicKeyToken to null on “Microsoft.Scripting” and
    “IronRuby” in /merlin/main/App.config

and also but not exactly related:
5) Copy /lib from my MRI into merlin\languages\ruby\ruby-1.8.6\lib

I’d be interested in the diff. You should be able to go into Vim, open
the file, and run :set fileformat=unix followed by a :wq to save it.
That should convert line endings for you. I can’t guarantee we’ll use
it, but I’d like to see what you had to do.

Ir.exe in a Merlin environment should use the app.config provided, which
is why you needed to put your files in ruby-1.8.6\lib. Those files are
mirrored in Merlin\External\Languages\Ruby\ruby-redist. I’ll look into
making app.config look there.

Before we close the SVN repository, and switch to Git as primary, we
will have a solution for the signing problem. I’ll bring it up on list
once I have a better plan for it.

From: [email protected]
[mailto:[email protected]] On Behalf Of Terence L.
Sent: Monday, December 08, 2008 10:05 PM
To: [email protected]
Subject: Re: [Ironruby-core] Trouble building from Visual Studio (git
repo)

I’ve actually just managed to get this to work. I had to remove the 3
signing xml tags from every project in the solution (not just the 3
Jimmy mentioned). I also had to remove the definition of SIGNED from
every project that had it (which wasn’t all of them). Once this was
done, all projects built through without errors. I also had to change
App.Config in Ruby.Console to set the public key token to null on
Microsoft.Scripting and IronRuby, to get the exe to start-up, but now it
does, and I’ve successfully resolved my underlying issue (which was a
load failure while using test/unit in some ironruby code I’m writing).

Incidentally, it turns out the solution to that problem was to copy
everything out of my C:\ruby\lib folder into
merlin\languages\ruby\ruby-1.8.6\lib folder. Is this the recommended
approach for now for using standard ruby libraries? What is the plan for
this going forwards?

I tried to generate a diff to send through of all the things I’ve had to
change to get the code to build from a fresh git checkout (remove the
check for tf.exe, remove signing attribs, etc.), but my text editor
appears to have put ^M’s all over the csproj files. Presumably there’s
some windows/cygwin line-ending conflict going on there. If this diff
would be useful to anybody, I can re-edit those files from cygwin’s vim,
which should fix the CRLF problem.

Thanks again for all the helpful advice

Terence
On Tue, Dec 9, 2008 at 7:39 AM, Jim D.
<[email protected]mailto:[email protected]> wrote:

I had Pete try that, and it didn’t work, but he might be hitting a
different issue. So yes, Skip verification (via sn -Vr) should work as
well.

JD

From:
[email protected]mailto:[email protected]
[mailto:[email protected]mailto:[email protected]]
On Behalf Of Michael L.
Sent: Monday, December 08, 2008 4:05 PM

To: [email protected]mailto:[email protected]
Subject: Re: [Ironruby-core] Trouble building from Visual Studio (git
repo)

Presumably turning off strong name validation for the public key token
would work as well… no?

On Mon, Dec 8, 2008 at 7:02 PM, Jimmy S.
<[email protected]mailto:[email protected]>
wrote:

Terence,

Sorry for the issues you’re having, crazy build breaks and signing are
never fun. Microsoft requires us to sign any binaries we produce, so
providing access to our repository is a pain because we can’t distribute
the private key used in signing. Jim is going to fix this so builds by
default build do not sign.

In the meantime, you’ll need to remove the signing flags from all the
.csproj files (Ruby.csproj, IronRuby.Libraries.csproj, and
IronRuby.Libraries.Yaml.csproj). Open the .csproj files in a
text-editor, and remove the following lines anywhere you find them (they
might be in a file more than once):

true
…....\MSSharedLibKey.snk
true

Rebuilding should not care about signing at all now. Let me know if you
run into any other problems.

~Jimmy

First let me apologise for the length of this mail - it’s not quite as
build config file to FxCop and then back to Debug seemed to make this
r
\merlin\main\Languages\Ruby\ClassInitGenerator\ReflectionCacheGenerato
s
line 24
Error 6 ‘IronRuby.Compiler.IParserLogger’ is inaccessible due to
its protection level
\merlin\main\Languages\Ruby\IronRuby.Tests\Parser\CoverageParserLogger.
c

s line 33

or one of its dependencies. Strong name validation failed. (Exception
Version=2.0.0.0http://2.0.0.0, Culture=neutral,
‘Microsoft.Scripting.InvalidImplementationException’ occurred in

Regards

Terence

PS, I’m trying to get the build to work out of visual studio so that I
can step through some of the code in the debugger.


Ironruby-core mailing list
[email protected]mailto:[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core


Michael L.
[Polymath Prokrammer]
http://blog.prokrams.com