Discussion:
[Ikvm-developers] fatal error IKVMC5045: Link error
Jason Harrop
2017-01-22 07:45:27 UTC
Permalink
I'm trying to IKVM https://github.com/plutext/slf4j-net-commons-logging
using IKVMC 8.1.5717.0 to update
https://www.nuget.org/packages/slf4j-NetCommonLogging/

Before doing so, I thought I'd update Common.Logging to v3.3.1.0

I got this error:

[echo] Building slf4j-NetCommonLogging DLL..
[echo]
[exec] IKVM.NET <http://ikvm.net/> Compiler version 8.1.5717.0
[exec] Copyright (C) 2002-2015 Jeroen Frijters
[exec] http://www.ikvm.net/
[exec]
[exec] Error: unable to load assembly 'lib\dotNET\packages\Common.
Logging.3.3.1\lib\net40\Common.Logging.dll'
as it depends on a higher version of mscorlib than the one currently loaded

So I thought I'd try specifying .NET 4 in my ant build file:

<arg value="-nostdlib" />
<arg value="-lib:\windows\microsoft.net\framework\v4.0.30319" />
<arg value="-r:mscorlib.dll" />

(This is a Win 10 machine which has .NET 4.6)

Now I got the curious error:

[echo] Building slf4j-NetCommonLogging DLL..
[echo]
[exec] IKVM.NET <http://ikvm.net/> Compiler version 8.1.5717.0
[exec] Copyright (C) 2002-2015 Jeroen Frijters
[exec] http://www.ikvm.net/
[exec]
[exec] fatal error IKVMC5045: Link error: Method "cli.Common.Logging.
LogManager.GetLogger(Ljava.lang.String;)Lcli.Common.Logging.ILog;" has a
return type "cli.Common.Logging.ILog, Common.Logging.Core, Version=3.3.1.0,
Culture=neutral, PublicKeyToken=af08829b84f0328e"
instead of type "cli.Common.Logging.ILog, Common.Logging.Core,
Version=3.3.1.0, Culture=neutral, PublicKeyToken=af08829b84f0328e" as
expected by "com.plutext.slf4jNetCommonsLogging.NetCommonsLoggerFactory"

Notice the return types look identical.

I also get this same error if I use the net35 /Common.Logging packages
(from nuget) and let ikvmc use its default mscorlib:

<arg
value="-reference:lib/dotNET/packages/Common.Logging.3.3.1/lib/net35/Common.Logging.dll"
/>
<arg value="-reference:lib/dotNET/packages/Common.Logging.Core.
3.3.1/lib/net35/Common.Logging.Core.dll" />

Thoughts?

For now, I've reverted to compiling against Common.Logging 2.1.2 which is
what I had before and which works.

thanks .. Jason
Jeroen Frijters
2017-01-23 07:18:22 UTC
Permalink
Hi Jason,

This is an ikvmc bug. The Common.Logging.ILog interface is forwarded from the Common.Logging assembly to the Common.Logging.Core assembly and that to confuses ikvmc.

I managed to reproduce it and will fix it.

In my reproduction scenario I was able to workaround it by swapping the references to Common.Logging.dll and Common.Logging.Core.dll (so that ikvmc sees the real type before the type forwarder), so that might work for you too.

Thanks,
Jeroen

From: Jason Harrop [mailto:***@plutext.org]
Sent: Sunday, January 22, 2017 8:45
To: ikvm-***@lists.sourceforge.net
Subject: [Ikvm-developers] fatal error IKVMC5045: Link error

I'm trying to IKVM https://github.com/plutext/slf4j-net-commons-logging using IKVMC 8.1.5717.0 to update https://www.nuget.org/packages/slf4j-NetCommonLogging/

Before doing so, I thought I'd update Common.Logging to v3.3.1.0

I got this error:

[echo] Building slf4j-NetCommonLogging DLL..
[echo]
[exec] IKVM.NET<http://ikvm.net/> Compiler version 8.1.5717.0
[exec] Copyright (C) 2002-2015 Jeroen Frijters
[exec] http://www.ikvm.net/
[exec]
[exec] Error: unable to load assembly 'lib\dotNET\packages\Common.Logging.3.3.1\lib\net40\Common.Logging.dll'
as it depends on a higher version of mscorlib than the one currently loaded

So I thought I'd try specifying .NET 4 in my ant build file:

<arg value="-nostdlib" />
<arg value="-lib:\windows\microsoft.net<http://microsoft.net/>\framework\v4.0.30319" />
<arg value="-r:mscorlib.dll" />

(This is a Win 10 machine which has .NET 4.6)

Now I got the curious error:

[echo] Building slf4j-NetCommonLogging DLL..
[echo]
[exec] IKVM.NET<http://ikvm.net/> Compiler version 8.1.5717.0
[exec] Copyright (C) 2002-2015 Jeroen Frijters
[exec] http://www.ikvm.net/
[exec]
[exec] fatal error IKVMC5045: Link error: Method "cli.Common.Logging.LogManager.GetLogger(Ljava.lang.String;)Lcli.Common.Logging.ILog;" has a return type "cli.Common.Logging.ILog, Common.Logging.Core, Version=3.3.1.0, Culture=neutral, PublicKeyToken=af08829b84f0328e"
instead of type "cli.Common.Logging.ILog, Common.Logging.Core, Version=3.3.1.0, Culture=neutral, PublicKeyToken=af08829b84f0328e" as expected by "com.plutext.slf4jNetCommonsLogging.NetCommonsLoggerFactory"

Notice the return types look identical.

I also get this same error if I use the net35 /Common.Logging packages (from nuget) and let ikvmc use its default mscorlib:

<arg value="-reference:lib/dotNET/packages/Common.Logging.3.3.1/lib/net35/Common.Logging.dll" />
<arg value="-reference:lib/dotNET/packages/Common.Logging.Core.3.3.1/lib/net35/Common.Logging.Core.dll" />

Thoughts?

For now, I've reverted to compiling against Common.Logging 2.1.2 which is what I had before and which works.

thanks .. Jason

Loading...