Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile errors on Arch #3361

Closed
neevparikh opened this issue May 9, 2021 · 60 comments
Closed

Compile errors on Arch #3361

neevparikh opened this issue May 9, 2021 · 60 comments
Assignees
Labels
In progress We're still working on this Invalid Not a issue of CKAN Linux Issues specific for Linux

Comments

@neevparikh
Copy link

neevparikh commented May 9, 2021

Background

  • Operating System: Arch Linux
  • CKAN Version: 1.30.0-1
  • KSP Version: N/A (Not installed yet)

Have you made any manual changes to your GameData folder (i.e., not via CKAN)?
No

Problem

Describe the bug
Cannot install Ckan via the AUR on Arch Linux. Run into this error when installing:

"/home/neev/.cache/yay/ckan/src/CKAN-1.30.0/Core/CKAN-core.csproj" (default target) (2) ->
(ResolveAssemblyReferences target) -> 
  /usr/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(2198,5): error MSB3248: Parameter "AssemblyFiles" has invalid value "/usr/lib/mono/4.5-api/mscorlib.dll". Could not load file or assembly 'System.Reflection.Metadata, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. [/home/neev/.cache/yay/ckan/src/CKAN-1.30.0/Core/CKAN-core.csproj]


"/home/neev/.cache/yay/ckan/src/CKAN-1.30.0/CKAN.sln" (Build target) (1) ->
"/home/neev/.cache/yay/ckan/src/CKAN-1.30.0/AutoUpdate/CKAN-autoupdate.csproj" (default target) (3) ->
  /usr/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(2198,5): error MSB3248: Parameter "AssemblyFiles" has invalid value "/usr/lib/mono/4.5-api/mscorlib.dll". Could not load file or assembly 'System.Reflection.Metadata, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. [/home/neev/.cache/yay/ckan/src/CKAN-1.30.0/AutoUpdate/CKAN-autoupdate.csproj]

Steps to reproduce
Install via aur.

Expected behavior
CKAN correctly installs

Screenshots (if applicable)

CKAN error code (if applicable):

@HebaruSan HebaruSan added Linux Issues specific for Linux Support Issues that are support requests labels May 9, 2021
@HebaruSan HebaruSan changed the title [Bug] Briefly summarize your issue here Compile errors on Arch May 9, 2021
@HebaruSan HebaruSan added the Invalid Not a issue of CKAN label May 9, 2021
@DasSkelett
Copy link
Member

This looks like a problem with the Mono/msbuild installation, not on our side.
I know there were problems with msbuild in the past. Some users on the AUR page reported having problems with msbuild-stable that switching to mono-msbuild fixed. Can you try that?

@neevparikh
Copy link
Author

neevparikh commented May 9, 2021 via email

@DasSkelett
Copy link
Member

Yes, see https://github.com/KSP-CKAN/CKAN/wiki/Installing-CKAN-on-Arch#manual-install
In short: simply install mono yourself, then run mono ckan.exe

@HebaruSan HebaruSan removed the Invalid Not a issue of CKAN label May 10, 2021
@DasSkelett
Copy link
Member

@neevparikh can confirm whether running the pre-built binary worked?

@neevparikh
Copy link
Author

neevparikh commented May 14, 2021 via email

@neevparikh
Copy link
Author

yeah that works! I wish I could install it via the AUR. Any tips on what to do to get that working?

@DasSkelett
Copy link
Member

I wish I could install it via the AUR. Any tips on what to do to get that working?

Unfortunately not, no. That error message looks like Arch's Mono or msbuild packages are installed incorrectly/incomplete/broken.
You can try bringing it to the attention of the package maintainers, or maybe ask the mono people for help (no guarantee they'll answer though).
Since compilation works fine on other Linux OSes (Ubuntu here) with Mono installed from Mono's own repositories, it's unlikely to be caused by on our side.

You could also write a comment on the AUR page and ask if someone else encountered this and was able to fix it.

@neevparikh
Copy link
Author

Yeah thanks I'll follow up on that! Thanks guys!

@HebaruSan
Copy link
Member

As a current user of Ubuntu and a former user of Debian, Red Hat, Gentoo, FreeBSD, and maybe some others that I've forgotten, I have decided to spin up an Arch Linux virtual machine and see if I can figure out what's going on with it. Secondary goal is to flesh out the "Installing CKAN on Arch" wiki page so that it actually explains how to install CKAN on Arch.

Re-opening and self-assigning this because it would be weird to post investigation notes in a closed issue, and because the error that I got matches this one and not the one from #3378. Strictly speaking, closing this issue was still the right decision because the available evidence strongly indicates this is a problem with Arch, not CKAN, but maybe some aggressive digging can pinpoint what the problem with Arch is and identify some solutions that we can send their way to help out our users. Maybe the "Invalid" tag is a good way to indicate that.

@HebaruSan HebaruSan reopened this May 23, 2021
@HebaruSan HebaruSan self-assigned this May 23, 2021
@HebaruSan HebaruSan added the Invalid Not a issue of CKAN label May 23, 2021
@HebaruSan
Copy link
Member

HebaruSan commented May 23, 2021

First, an attempt to understand the error message. It mentions three files, which I will reference by their names rather than full paths:

/usr/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(2198,5): error MSB3248: Parameter "AssemblyFiles" has invalid value "/usr/lib/mono/4.5-api/mscorlib.dll". Could not load file or assembly 'System.Reflection.Metadata, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. [/home/neev/.cache/yay/ckan/src/CKAN-1.30.0/Core/CKAN-core.csproj]

File Remarks
Microsoft.Common.CurrentVersion.targets A 338 KB pile of XML rules that msbuild uses to compile projects
mscorlib.dll Microsoft Common Object Runtime Library or Multilanguage Standard Common Object Runtime Library, contains much of the "core" libraries for .NET Framework, from namespaces such as System, System.IO, System.Reflection, System.Text, and System.Threading
System.Reflection.Metadata.dll Looks like a support library for parsing or representing code, perhaps used by msbuild to help with compilation (?)

All three of these files exist in the /usr/lib/mono directory hierarchy (i.e., none of them are missing), at the same place where they're found on my (working) Ubuntu install. None of them are explicitly referenced by CKAN's project files; they're infrastructure or implicit dependencies, pulled in because any .NET Framework project will need them.

Line 2198 of Microsoft.Common.CurrentVersion.targets looks like this:

    <ResolveAssemblyReference
        Assemblies="@(Reference)"
        AssemblyFiles="@(_ResolvedProjectReferencePaths);@(_ExplicitReference)"
        TargetFrameworkDirectories="@(_ReferenceInstalledAssemblyDirectory)"
        InstalledAssemblyTables="@(InstalledAssemblyTables);@(RedistList)"
        IgnoreDefaultInstalledAssemblyTables="$(IgnoreDefaultInstalledAssemblyTables)"
        IgnoreDefaultInstalledAssemblySubsetTables="$(IgnoreInstalledAssemblySubsetTables)"
        CandidateAssemblyFiles="@(Content);@(None)"
        SearchPaths="$(AssemblySearchPaths)"
        AllowedAssemblyExtensions="$(AllowedReferenceAssemblyFileExtensions)"
        AllowedRelatedFileExtensions="$(AllowedReferenceRelatedFileExtensions)"
        TargetProcessorArchitecture="$(ProcessorArchitecture)"
        AppConfigFile="@(_ResolveAssemblyReferencesApplicationConfigFileForExes)"
        AutoUnify="$(AutoUnifyAssemblyReferences)"
        SupportsBindingRedirectGeneration="$(GenerateBindingRedirectsOutputType)"
        IgnoreVersionForFrameworkReferences="$(IgnoreVersionForFrameworkReferences)"
        FindDependencies="$(_FindDependencies)"
        FindSatellites="$(ResolveAssemblyReferencesFindRelatedSatellites)"
        FindSerializationAssemblies="$(ResolveAssemblyReferencesFindSerializationAssemblies)"
        FindRelatedFiles="$(ResolveAssemblyReferencesFindRelatedFiles)"
        Silent="$(ResolveAssemblyReferencesSilent)"
        TargetFrameworkVersion="$(TargetFrameworkVersion)"
        TargetFrameworkMoniker="$(TargetFrameworkMoniker)"
        TargetFrameworkMonikerDisplayName="$(TargetFrameworkMonikerDisplayName)"
        TargetedRuntimeVersion="$(TargetedRuntimeVersion)"
        StateFile="$(ResolveAssemblyReferencesStateFile)"
        InstalledAssemblySubsetTables="@(InstalledAssemblySubsetTables)"
        TargetFrameworkSubsets="@(_ReferenceInstalledAssemblySubsets)"
        FullTargetFrameworkSubsetNames="$(FullReferenceAssemblyNames)"
        FullFrameworkFolders="$(_FullFrameworkReferenceAssemblyPaths)"
        FullFrameworkAssemblyTables="@(FullFrameworkAssemblyTables)"
        ProfileName="$(TargetFrameworkProfile)"
        LatestTargetFrameworkDirectories="@(LatestTargetFrameworkDirectories)"
        CopyLocalDependenciesWhenParentReferenceInGac="$(CopyLocalDependenciesWhenParentReferenceInGac)"
        DoNotCopyLocalIfInGac="$(DoNotCopyLocalIfInGac)"
        ResolvedSDKReferences="@(ResolvedSDKReference)"
        WarnOrErrorOnTargetArchitectureMismatch="$(ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch)"
        IgnoreTargetFrameworkAttributeVersionMismatch ="$(ResolveAssemblyReferenceIgnoreTargetFrameworkAttributeVersionMismatch)"
        FindDependenciesOfExternallyResolvedReferences="$(FindDependenciesOfExternallyResolvedReferences)"
        ContinueOnError="$(ContinueOnError)"
        OutputUnresolvedAssemblyConflicts="$(ResolveAssemblyReferenceOutputUnresolvedAssemblyConflicts)"
        Condition="'@(Reference)'!='' or '@(_ResolvedProjectReferencePaths)'!='' or '@(_ExplicitReference)' != ''"
        >

      <Output TaskParameter="ResolvedFiles" ItemName="ReferencePath"/>
      <Output TaskParameter="ResolvedFiles" ItemName="_ResolveAssemblyReferenceResolvedFiles"/>
      <Output TaskParameter="ResolvedDependencyFiles" ItemName="ReferenceDependencyPaths"/>
      <Output TaskParameter="RelatedFiles" ItemName="_ReferenceRelatedPaths"/>
      <Output TaskParameter="SatelliteFiles" ItemName="ReferenceSatellitePaths"/>
      <Output TaskParameter="SerializationAssemblyFiles" ItemName="_ReferenceSerializationAssemblyPaths"/>
      <Output TaskParameter="ScatterFiles" ItemName="_ReferenceScatterPaths"/>
      <Output TaskParameter="CopyLocalFiles" ItemName="ReferenceCopyLocalPaths"/>
      <Output TaskParameter="SuggestedRedirects" ItemName="SuggestedBindingRedirects"/>
      <Output TaskParameter="FilesWritten" ItemName="FileWrites"/>
      <Output TaskParameter="DependsOnSystemRuntime" PropertyName="DependsOnSystemRuntime"/>
      <Output TaskParameter="DependsOnNETStandard" PropertyName="_DependsOnNETStandard"/>
      <Output TaskParameter="UnresolvedAssemblyConflicts" ItemName="ResolveAssemblyReferenceUnresolvedAssemblyConflicts"/>
    </ResolveAssemblyReference>

That looks like a directive used to get the DLLs needed to satisfy a project's dependencies, so I think this error happens while msbuild is doing that, and it somehow gets confused by System.Reflection.Metadata. The AssemblyFiles input parameter of ResolveAssemblyReference is set to /usr/lib/mono/4.5-api/mscorlib.dll, and it doesn't like that, for reasons that are not specified.

The first weird difference between Ubuntu and Arch is that Arch has several extra files alongside the .dll files mentioned above:

-rwxr-xr-x 1    95760 Dec 22 20:51 csc.exe.so
-rwxr-xr-x 1  4580880 Dec 22 20:51 mcs.exe.so
-rwxr-xr-x 1 12535312 Dec 22 20:51 Microsoft.CodeAnalysis.CSharp.dll.so
-rwxr-xr-x 1  4965904 Dec 22 20:51 Microsoft.CodeAnalysis.dll.so
-rwxr-xr-x 1  9168400 Dec 22 20:51 mscorlib.dll.so
-rwxr-xr-x 1   595472 Dec 22 20:51 System.Collections.Immutable.dll.so
-rwxr-xr-x 1   902672 Dec 22 20:51 System.Reflection.Metadata.dll.so

These are not present in Ubuntu, and they raise questions about how Arch's Mono is being built. A .dll in this case is a .NET assembly, a Windows-esque library file that contains some extra info to allow it to be treated as a .NET library. A .so ("shared object") file is Linux's equivalent of a .dll, a dynamically loaded library that contains code that a Linux-based compiler could link into a binary. A .dll.so file doesn't make sense to me as a concept; these are two separate, incompatible formats, and trying to mix or combine them is crazy. Seeing these files makes me suspect that some build tool is going haywire and generating what are essentially extra garbage files and including them in the Arch package for Mono.

/usr/lib/mono contains many different versions of the .NET support libraries, and notably, only 4.5 has these .dll.so files, which again suggests to me that their inclusion was a mistake and related to the reason Arch can't compile CKAN:

drwxr-xr-x 1  5068 May 23 03:12 2.0-api
drwxr-xr-x 1   238 May 23 03:12 3.5-api
drwxr-xr-x 1    52 May 23 03:12 4.0
drwxr-xr-x 1  5816 May 23 03:12 4.0-api
drwxr-xr-x 1 10938 May 23 03:55 4.5
drwxr-xr-x 1  6252 May 23 03:12 4.5.1-api
drwxr-xr-x 1  6252 May 23 03:12 4.5.2-api
drwxr-xr-x 1  6252 May 23 03:12 4.5-api
drwxr-xr-x 1  6748 May 23 03:12 4.6.1-api
drwxr-xr-x 1  6748 May 23 03:12 4.6.2-api
drwxr-xr-x 1  6748 May 23 03:12 4.6-api
drwxr-xr-x 1  6582 May 23 03:12 4.7.1-api
drwxr-xr-x 1  6582 May 23 03:12 4.7.2-api
drwxr-xr-x 1  6748 May 23 03:12 4.7-api
drwxr-xr-x 1  6582 May 23 03:12 4.8-api

I tried moving these files to a scratch folder, but the compile still fails with the same error message. Either they're not the cause, or there's some dependency resolution cache file somewhere that still contains references to these files.

Investigation continues...

@HebaruSan
Copy link
Member

Microsoft.Common.CurrentVersion.targets is only 319 KB on Ubuntu (19 KB smaller), but the section quoted above looks identical to me, even down to the syntax-highlight-breaking extra space after IgnoreTargetFrameworkAttributeVersionMismatch.

@HebaruSan
Copy link
Member

HebaruSan commented May 23, 2021

The AssemblyFiles input parameter of ResolveAssemblyReference is set to /usr/lib/mono/4.5-api/mscorlib.dll, and it doesn't like that, for reasons that are not specified.

Since we can see that AssemblyFiles is set to @(_ResolvedProjectReferencePaths);@(_ExplicitReference), investigating the values of those variables (on both Arch and Ubuntu) may shed some light.

@HebaruSan HebaruSan added In progress We're still working on this and removed Support Issues that are support requests labels May 23, 2021
@HebaruSan
Copy link
Member

ResolveAssemblyReference seems to be defined in Microsoft.Build.Tasks.Core.dll, rather than some XML somewhere, so if the problem is inside it, that could be difficult to investigate.

@HebaruSan
Copy link
Member

HebaruSan commented May 23, 2021

Since we can see that AssemblyFiles is set to @(_ResolvedProjectReferencePaths);@(_ExplicitReference), investigating the values of those variables (on both Arch and Ubuntu) may shed some light.

Added this to my Microsoft.Common.CurrentVersion.targets on Ubuntu (working):

    <Message Importance="high" Text="_ResolvedProjectReferencePaths is @(_ResolvedProjectReferencePaths)" />
    <Message Importance="high" Text="_ExplicitReference is @(_ExplicitReference)" />

Core:

  _ResolvedProjectReferencePaths is 
  _ExplicitReference is /usr/lib/mono/4.5-api/mscorlib.dll

AutoUpdate:

  _ResolvedProjectReferencePaths is 
  _ExplicitReference is /usr/lib/mono/4.5-api/mscorlib.dll

ConsoleUI:

  _ResolvedProjectReferencePaths is /home/user/Downloads/KSP/CKAN/_build/out/CKAN/Debug/bin/net45/CKAN.dll
  _ExplicitReference is /usr/lib/mono/4.5-api/mscorlib.dll

GUI:

  _ResolvedProjectReferencePaths is /home/user/Downloads/KSP/CKAN/_build/out/CKAN/Debug/bin/net45/CKAN.dll
  _ExplicitReference is /usr/lib/mono/4.5-api/mscorlib.dll

Cmdline:

  _ResolvedProjectReferencePaths is /home/user/Downloads/KSP/CKAN/_build/out/CKAN-ConsoleUI/Debug/bin/CKAN-ConsoleUI.exe;/home/user/Downloads/KSP/CKAN/_build/out/CKAN/Debug/bin/net45/CKAN.dll;/home/user/Downloads/KSP/CKAN/_build/out/CKAN-GUI/Debug/bin/CKAN-GUI.exe
  _ExplicitReference is /usr/lib/mono/4.5-api/mscorlib.dll

Netkan:

  _ResolvedProjectReferencePaths is /home/user/Downloads/KSP/CKAN/_build/out/CKAN/Debug/bin/net45/CKAN.dll
  _ExplicitReference is /usr/lib/mono/4.5-api/mscorlib.dll

Tests:

  _ResolvedProjectReferencePaths is /home/user/Downloads/KSP/CKAN/_build/out/CKAN/Debug/bin/net45/CKAN.dll;/home/user/Downloads/KSP/CKAN/_build/out/CKAN-GUI/Debug/bin/CKAN-GUI.exe;/home/user/Downloads/KSP/CKAN/_build/out/NetKAN/Debug/bin/NetKAN.exe
  _ExplicitReference is /usr/lib/mono/4.5-api/mscorlib.dll

So the "invalid" value that Arch's msbuild complains about, /usr/lib/mono/4.5-api/mscorlib.dll, is in fact perfectly valid, expected, and common in a successful build on another OS.

@HebaruSan

This comment has been minimized.

@gyscos
Copy link

gyscos commented May 24, 2021

Note that downgrading mono-msbuild to mono-msbuild-16.8.xamarinxplat.2020.07.30.15.02-2 fixes the compilation on my side.

Not sure yet if that's an issue with the mono-msbuild 16.9 package, or if CKAN is actually incompatible with it.

@HebaruSan

This comment has been minimized.

@gyscos
Copy link

gyscos commented May 24, 2021

Oh I mostly meant that as further investigation, not as a final workaround. This hints that the mono package itself may be fine, and the issue would be either in mono-msbuild 16.9, or in the interaction between CKAN and msbuild 16.9.
I had a look at the PKGBUILD itself for this, and the only packaging changes between 16.8 and 16.9 is a patch to fix dead URLs in the resolver, and a resolver prefix (changed from /opt/dotnet to /usr/share/dotnet, neither of which exist on my system anyway).

I tried updating the 16.9 PKGBUILD to build without these changes, and it builds fine, but still gives the same error building CKAN. So from the surface it does not look like a packaging issue that got recently introduced.

On the other hand the bump from 16.8 to 16.9 is quite large, 16.8 was from last July, almost a year ago. There may be some "change waves" (their codename for a block of changes deployed at once) that aren't fully stable and may need to be disabled (this seems to be their standard policy). As a result there's a possibility CKAN is genuinely incompatible with the default msbuild 16.9, it'd be good to rule this out if possible.

@HebaruSan

This comment has been minimized.

@HebaruSan
Copy link
Member

HebaruSan commented May 24, 2021

I'm also wondering - is it possible the mono package on archlinux does not include System.Reflection.Metadata 5.0 just yet? Or is just otherwise too old? The current packaged version is 6.12.0.107.

Trying to find a way to check this, it might actually lead somewhere!

Ubuntu shows Version 5.0.0.0:

$ monodis --assembly /usr/lib/mono/4.5/System.Reflection.Metadata.dll 
Assembly Table
Name:          System.Reflection.Metadata
Hash Algoritm: 0x00008004
Version:       5.0.0.0
Flags:         0x00000001
PublicKey:     BlobPtr (0x00002b18)
	Dump:
0x00000000: 00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 
0x00000010: 00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00 
0x00000020: 07 D1 FA 57 C4 AE D9 F0 A3 2E 84 AA 0F AE FD 0D 
0x00000030: E9 E8 FD 6A EC 8F 87 FB 03 76 6C 83 4C 99 92 1E 
0x00000040: B2 3B E7 9A D9 D5 DC C1 DD 9A D2 36 13 21 02 90 
0x00000050: 0B 72 3C F9 80 95 7F C4 E1 77 10 8F C6 07 77 4F 
0x00000060: 29 E8 32 0E 92 EA 05 EC E4 E8 21 C0 A5 EF E8 F1 
0x00000070: 64 5C 4C 0C 93 C1 AB 99 28 5D 62 2C AA 65 2C 1D 
0x00000080: FA D6 3D 74 5D 6F 2D E5 F1 7E 5E AF 0F C4 96 3D 
0x00000090: 26 1C 8A 12 43 65 18 20 6D C0 93 34 4D 5A D2 93 
Culture:       

Arch shows Version 1.4.3.0:

$ monodis --assembly /usr/lib/mono/4.5/System.Reflection.Metadata.dll 
Assembly Table
Name:          System.Reflection.Metadata
Hash Algoritm: 0x00008004
Version:       1.4.3.0
Flags:         0x00000001
PublicKey:     BlobPtr (0x00002abb)
	Dump:
0x00000000: 00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 
0x00000010: 00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00 
0x00000020: 07 D1 FA 57 C4 AE D9 F0 A3 2E 84 AA 0F AE FD 0D 
0x00000030: E9 E8 FD 6A EC 8F 87 FB 03 76 6C 83 4C 99 92 1E 
0x00000040: B2 3B E7 9A D9 D5 DC C1 DD 9A D2 36 13 21 02 90 
0x00000050: 0B 72 3C F9 80 95 7F C4 E1 77 10 8F C6 07 77 4F 
0x00000060: 29 E8 32 0E 92 EA 05 EC E4 E8 21 C0 A5 EF E8 F1 
0x00000070: 64 5C 4C 0C 93 C1 AB 99 28 5D 62 2C AA 65 2C 1D 
0x00000080: FA D6 3D 74 5D 6F 2D E5 F1 7E 5E AF 0F C4 96 3D 
0x00000090: 26 1C 8A 12 43 65 18 20 6D C0 93 34 4D 5A D2 93 
Culture:       

And /usr/lib/mono/msbuild/Current/bin/MSBuild.dll.config says:

      <!-- Use consistent version of SRM to match mono's Roslyn -->
      <dependentAssembly>
        <assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
      </dependentAssembly>

https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/runtime/bindingredirect-element

So copying the DLL from Ubuntu to Arch is another thing to consider trying...

(mscorlib.dll is 4.0.0.0 on both, for those curious.)

@HebaruSan
Copy link
Member

HebaruSan commented May 24, 2021

The other copies of that DLL vary in version, but not by much.

Ubuntu:

$ for F in $(find /usr/lib/mono -name System.Reflection.Metadata.dll -type f) ; do echo $F ; monodis --assembly $F | grep Version ; done
/usr/lib/mono/4.5/System.Reflection.Metadata.dll
Version:       5.0.0.0
/usr/lib/mono/msbuild/Current/bin/Sdks/ILLink.Tasks/tools/net472/System.Reflection.Metadata.dll
Version:       1.4.2.0
/usr/lib/mono/msbuild/Current/bin/Sdks/Microsoft.NET.Sdk/tools/net472/System.Reflection.Metadata.dll
Version:       1.4.2.0
/usr/lib/mono/msbuild/Current/bin/Sdks/Microsoft.NET.Sdk.Razor/tasks/net46/System.Reflection.Metadata.dll
Version:       1.4.5.0
/usr/lib/mono/msbuild/15.0.old/bin/Sdks/Microsoft.NET.Sdk/tools/net46/System.Reflection.Metadata.dll
Version:       1.4.2.0

Arch:

$ for F in $(find /usr/lib/mono -name System.Reflection.Metadata.dll -type f) ; do echo $F ; monodis --assembly $F | grep Version ; done
/usr/lib/mono/4.5/System.Reflection.Metadata.dll
Version:       1.4.3.0
/usr/lib/mono/msbuild/Current/bin/Sdks/ILLink.Tasks/tools/net472/System.Reflection.Metadata.dll
Version:       1.4.2.0
/usr/lib/mono/msbuild/Current/bin/Sdks/Microsoft.NET.Sdk/tools/net472/System.Reflection.Metadata.dll
Version:       1.4.2.0
/usr/lib/mono/msbuild/Current/bin/Sdks/Microsoft.NET.Sdk.Razor/tasks/net46/System.Reflection.Metadata.dll
Version:       1.4.5.0

@HebaruSan
Copy link
Member

HebaruSan commented May 24, 2021

So copying the DLL from Ubuntu to Arch is another thing to consider trying...

That worked!!!!

image

image

So the concise statement of the root cause is that Arch's msbuild depends on a version of System.Reflection.Metadata.dll that is not provided by itself or by Arch's Mono.

@HebaruSan
Copy link
Member

Updated the wiki so even an Arch noob like me can follow the steps.

https://github.com/KSP-CKAN/CKAN/wiki/Installing-CKAN-on-Arch#arch-user-repository

Unfortunately I don't have a good idea of where a typical user can get an up to date copy of System.Reflection.Metadata.dll, since most probably won't have an Ubuntu hosting it (that's why the instructions try to quit early and get them to download the .exe). Any suggestions?

@gyscos
Copy link

gyscos commented May 24, 2021

As I mentioned, a newer build of the mono package seems to include the correct DLL with System.Reflection.Metadata.dll version 5.0.0.0.

To get this newer version, users can:

  • Install mono-git from the AUR, which points to a recent-enough version (I just confirmed it works).
  • Wait for the official mono package to be updated.

@HebaruSan
Copy link
Member

If I advised a general audience to install mono-git, would they then be left behind if the main mono package updated? Or would it refresh from the upstream git automatically every time they did a system update? I'm still very new to Arch, so I'd like to make sure whatever we choose doesn't have some unintended consequences down the line.

@gyscos
Copy link

gyscos commented May 25, 2021

It depends how they install mono-git; by hand (download the PKGBUILD & makepkg -si), it wouldn't get updated automatically, but most AUR-helpers (which is what most people use anyway) can and will automatically update it. Though it'll end up tracking the git main branch, which means frequent updates.

An other solution would be to have a "repository" (really just a HTTPS file server with some pre-built packages) with the correctly up-to-date mono version (and why not, CKAN as well), but adding a new repo is a bit more work for users than just installing a package from AUR.

@HebaruSan
Copy link
Member

mono-git is maybe a bit of a big package to download and compile to run a ~4 MB .exe file:

$ du -sh ~/builds/mono-git/
8.5G	/home/vagrant/builds/mono-git/

The main mono package is already marked out of date, but that indicator isn't clickable, and the Arch bug tracker says not to file bugs against packages that are already marked out of date. Is there some announcement about why it's out of date that we could check? Is there anyplace where the maintainers might be discussing possible upates? Can we somehow submit fixes or help with getting the update done?

@HebaruSan
Copy link
Member

Maybe I can have them download a package from mono-project.com and extract just the one DLL file. Note to self to investigate how viable that is...

@HebaruSan
Copy link
Member

HebaruSan commented May 29, 2021

This seems to be the package (4.1 MB) that gave me the copy of the DLL that I tested as working:

https://download.mono-project.com/repo/ubuntu/pool/main/m/mono/mono-roslyn_6.12.0.144-0xamarin11+ubuntu2004b1_all.deb

However, standard tools are giving conflicting results in the attempts to extract...

$ file mono-roslyn_6.12.0.144-0xamarin11+ubuntu2004b1_all.deb
mono-roslyn_6.12.0.144-0xamarin11+ubuntu2004b1_all.deb: Debian binary package (format 2.0), with control.tar.xz, data compression xz

$ tar OtJf mono-roslyn_6.12.0.144-0xamarin11+ubuntu2004b1_all.deb
xz: (stdin): File format not recognized
tar: Child returned status 1
tar: Error is not recoverable: exiting now

$ unxz mono-roslyn_6.12.0.144-0xamarin11+ubuntu2004b1_all.deb
unxz: mono-roslyn_6.12.0.144-0xamarin11+ubuntu2004b1_all.deb: File format not recognized

EDIT: Ahh, I skipped a step...

@HebaruSan
Copy link
Member

OK, this worked out of the box in my virtual machine to extract the DLL from the deb, thus fixing the compile:

mkdir -p /tmp/mono-deb
cd /tmp/mono-deb
curl https://download.mono-project.com/repo/ubuntu/pool/main/m/mono/mono-roslyn_6.12.0.144-0xamarin11+ubuntu2004b1_all.deb > mono.deb
ar p mono.deb data.tar.xz | tar xJf - ./usr/lib/mono/4.5/System.Reflection.Metadata.dll --strip-components 5
sudo mv /usr/lib/mono/4.5/System.Reflection.Metadata.dll /usr/lib/mono/4.5/System.Reflection.Metadata.dll_OLD
sudo cp System.Reflection.Metadata.dll /usr/lib/mono/4.5

Added to https://github.com/KSP-CKAN/CKAN/wiki/Installing-CKAN-on-Arch#arch-user-repository . That file should be available at that location forever or at least a good long time, and we can update the URL in the wiki if we need to. I think I'm comfortable with this as a stopping point until the upstream problems can be fixed.

@kellpossible
Copy link

I'm getting this same problem attempting to build Principia

@kellpossible
Copy link

also the url for grabbing the debian package in the wiki is outdated now I think?

@HebaruSan
Copy link
Member

also the url for grabbing the debian package in the wiki is outdated now I think?

Still working as far as I can tell. What do you mean?

@kellpossible
Copy link

I'm getting a 404 error for https://download.mono-project.com/repo/ubuntu/pool/main/m/mono/mono-roslyn_6.12.0.144-0xamarin11+ubuntu2004b1_all.deb

@HebaruSan
Copy link
Member

Hmm, that link works fine. Not sure what to tell you. Maybe some kind of firewall is blocking you?

@kellpossible
Copy link

@kellpossible
Copy link

kellpossible commented May 31, 2021

Hurray, that worked I think! I also skipped the sudo mv /usr/lib/mono/4.5/System.Reflection.Metadata.dll /usr/lib/mono/4.5/System.Reflection.Metadata.dll_OLD because that file does not exist on my system.

@HebaruSan thanks for the pointers 🙂

@HebaruSan
Copy link
Member

HebaruSan commented May 31, 2021

OK, I'm able to reproduce the 404 if I try the request from another system (SpaceDock's alpha and beta servers, if it turns out to matter). But it still works fine from my own system, both in browser and with wget. I wonder what weird stuff download.mono-project.com is doing to give different results for different client hosts...

Caching? Has my ISP kept a copy of this .deb file because I requested it?
Maybe @DasSkelett can figure out a URL that won't go away.

@DasSkelett
Copy link
Member

I wonder what weird stuff download.mono-project.com is doing to give different results for different client hosts...
Caching? Has my ISP kept a copy of this .deb file because I requested it?

That sounds like they got a CDN in front of it, and it takes some time until old packages are purged from every server.
(Probably not your ISP at cause here, I'm hoping they neither can nor want to intercept HTTPS traffic.)

Anyway, going to take a look later and see if I can figure out a permanent URL.

@HebaruSan
Copy link
Member

I guess I will update the wiki when aptitude installs an update for me. At least it will be better than an old URL.

@HebaruSan
Copy link
Member

Note to self for future updates...

apt-get download --print-uris mono-roslyn | awk "{gsub(/'/,\"\",\$1);print \$1}"

@DasSkelett
Copy link
Member

We can use the "Packages" file to get the path:

FILE=$(curl --silent https://download.mono-project.com/repo/ubuntu/dists/preview-focal/main/binary-amd64/Packages | grep -Po "(?<=Filename: ).+mono-roslyn.+\\.deb")
# pool/main/m/mono/mono-roslyn_6.12.0.145-0xamarin11+ubuntu2004b1_all.deb
curl https://download.mono-project.com/repo/ubuntu/${FILE} > mono.deb

Gonna put that in the wiki, if someone wants to improve the regex or replace it with a call to awk or whatever, feel free.

@hwthomas
Copy link

Hello KSP-CKAN team!

I am working on DotDevelop (http://github.com/dotdevelop/dotdevelop) and encountered the same problem on our Arch build after the mono-msbuild package was upgraded to version 16.10.1. I too spent some time trying to make sense of the compilation error messages, but never got as far as you did. Impressive work, and many thanks!

With your permission, I will include your final patch in our Arch build wiki.

BTW. Has the issue been reported to the Arch mono-msbuild package maintainer?

@HebaruSan
Copy link
Member

HebaruSan commented Aug 29, 2021

Hi @hwthomas!

Yes, we filed a bug report with Arch in May. On the plus side it's open and assigned and has a High severity, so it looks like something that would be worked on eventually, but on the negative side it has only received one question from the assignee (answered promptly) and then only comments from other users, so it's not clear whether any progress is being made so far: 🤞

As for your wiki, please feel free to use whatever knowledge or content you're able to glean from our discussions or documentation. Cheers!

(For other curious CKAN team members or my future self, this appears to be the wiki in question:

@hwthomas
Copy link

hwthomas commented Nov 5, 2021

Hello again KSP-CKAN team.

I've recently been getting odd errors from our Arch/Manjaro build, even with your patch. This now seems to have gone away by installing mono/mono-msbuild from the (Community) repo, then also installing mono-git from the AUR (https://aur.archlinux.org/packages/mono-git/). Although the mono-git package says it is mono-git-6.12.0.158 , mono --version shows 6.13.0 (!). Hopefully the (Community) package will get updated to a later version before too long!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
In progress We're still working on this Invalid Not a issue of CKAN Linux Issues specific for Linux
Projects
None yet
Development

No branches or pull requests

6 participants