Skip to content
This repository has been archived by the owner on Dec 18, 2024. It is now read-only.

Build fails on linux #643

Closed
Joefish opened this issue Jul 12, 2019 · 8 comments
Closed

Build fails on linux #643

Joefish opened this issue Jul 12, 2019 · 8 comments

Comments

@Joefish
Copy link

Joefish commented Jul 12, 2019

Linux Fedora 5.1.15-300.fc30.x86_64, mono 5.18.1.3, glibc 2.29

I try to compile Mesen from master[373c489] and it fails with

cd UpdateHelper && msbuild /property:Configuration="Release" /property:Platform="AnyCPU"
/bin/sh: msbuild: command not found
make: *** [makefile:91: ui] Error 127

Apparently msbuild doesn't ship as an indepenent binary anymore (at least for linux) and dotnet build should be used. After substituting the command in the makefile I get the following

cd UpdateHelper && dotnet build /property:Configuration="Release" /property:Platform="AnyCPU"
Microsoft (R) Build Engine version 15.9.20.63311 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Nothing to do. None of the projects specified contain packages to restore.
/usr/lib64/dotnet/sdk/2.2.108/Microsoft.Common.CurrentVersion.targets(1179,5): error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.5" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. [/home/quake/dev/repos/emulator/mesen/UpdateHelper/UpdateHelper.csproj]

Build FAILED.

/usr/lib64/dotnet/sdk/2.2.108/Microsoft.Common.CurrentVersion.targets(1179,5): error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.5" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. [/home/quake/dev/repos/emulator/mesen/UpdateHelper/UpdateHelper.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.48
make: *** [makefile:91: ui] Error 1
@ghost
Copy link

ghost commented Jul 12, 2019

download and install msbuild sepately, this is not part of mono package in recent releases....

@Joefish
Copy link
Author

Joefish commented Jul 12, 2019

Still the same error

cd UpdateHelper && msbuild /property:Configuration="Release" /property:Platform="AnyCPU"
$HOME/dev/repos/compiler/msbuild/.dotnet/sdk/3.0.100-preview6-012264/Microsoft.Common.CurrentVersion.targets(1175,5): error MSB3644: The reference assemblies for .NETFramework,Version=v4.5 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks [$HOME/dev/repos/emulator/mesen/UpdateHelper/UpdateHelper.csproj]

Build FAILED.

$HOME/dev/repos/compiler/msbuild/.dotnet/sdk/3.0.100-preview6-012264/Microsoft.Common.CurrentVersion.targets(1175,5): error MSB3644: The reference assemblies for .NETFramework,Version=v4.5 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks [$HOME/dev/repos/emulator/mesen/UpdateHelper/UpdateHelper.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.62
Build failed (exit code '1').
make: *** [makefile:91: ui] Error 1

Just wondering, is it actually supposed to look for .netv4.5 on linux?
Maybe the build is mixing up platforms?

@SourMesen
Copy link
Owner

SourMesen commented Jul 12, 2019

Unfortunately it looks like there are 2 different "msbuild" tools, and they are not equivalent.

Running msbuild /version (it needs to be a slash, not a dash) should give you something like this:

Microsoft (R) Build Engine version 15.6.0.0 ( Fri Apr  6 15:55:10 UTC 2018) for Mono
Copyright (C) Microsoft Corporation. All rights reserved.

Someone else had the same issue recently and the fix was to install the right "version" of msbuild.

(Edit: the important bit is for Mono vs for .NET Core in what you posted earlier)

@Joefish
Copy link
Author

Joefish commented Jul 12, 2019

After failing to compile msbuild for hours I just realized mono has packages for Fedora on their website..
You are right, that fixed it. Now I have a different error though, that it can't find libgdiplus.so.0 (I checked and it's there in /usr/lib64)

cd GUI.NET && msbuild /property:Configuration="Release" /property:Platform="x64" /property:PreBuildEvent="" '/property:DefineConstants="HIDETESTMENU;DISABLEAUTOUPDATE"' /property:CodeAnalysisRuleSet=""                                                                                                                                           Microsoft (R) Build Engine version 16.0.0.0 for Mono                                                                                                                      
Copyright (C) Microsoft Corporation. All rights reserved.                                                                                                                                                                                                                                                                                           
Build started 7/12/2019 6:34:14 PM.                                                                                                                                       Project "/home/quake/dev/repos/emulator/mesen/GUI.NET/GUI.NET.csproj" on node 1 (default targets).                                                                        
CoreResGen:                                             

(... lots of errors ...)

[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for 'System.Drawing.GDIPlus' threw an exception. ---> System.DllNotFoundExcep$ion: libgdiplus.so.0                                                                                                                                                      
  at (wrapper managed-to-native) System.Drawing.GDIPlus.GdiplusStartup(ulong&,System.Drawing.GdiplusStartupInput&,System.Drawing.GdiplusStartupOutput&)                   
  at System.Drawing.GDIPlus..cctor () [0x000b0] in <80cf4b9a8ac643b19a543479e627448c>:0                                                                                   
   --- End of inner exception stack trace ---                                                                                                                             
  at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_generic_class_init(intptr)                                                                            
  at System.Drawing.Image.Dispose (System.Boolean disposing) [0x00000] in <80cf4b9a8ac643b19a543479e627448c>:0                                                            
  at System.Drawing.Image.Finalize () [0x00000] in <80cf4b9a8ac643b19a543479e627448c>:0                                                                                   
make: *** [makefile:96: ui] Error 255                                                                  

@SourMesen
Copy link
Owner

Is that while compiling the code, or when trying to run the application?
If compiling, that would be pretty odd.
If at runtime, that message is usually a sign that something is broken in the Mono installation (e.g maybe the part of mono that implements WinForms is not installed properly, or not installed at all, etc)

Also, since you seem to have installed (at least parts of) .NET Core earlier, it's not impossible that the libgdiplus library you're seeing is .NET Core's rather than Mono's, etc.

@Joefish
Copy link
Author

Joefish commented Jul 14, 2019

So, I now deinstalled .net core, reinstalled everything mono to make sure that it downloads from the correct repo, and installed libgdiplus manually from the mono repo, still the same.
But it is a problem with my system, not with mesen install scripts as it even crashes for a simple hello world that uses Windows.Forms.
I got an interesting log from it though

Mono: DllImport attempting to load: 'libgdiplus.so.0'.
Mono: DllImport error loading library '/usr/lib/mono/gac/System.Drawing/4.0.0.0__b03f5f7f11d50a3a/libgdiplus.so.0': '/usr/lib/mono/gac/System.Drawing/4.0.0.0__b03f5f7f11d50a3a/libgdiplus.so.0: cannot open shared object file: No such file or directory'.
Mono: DllImport error loading library '/usr/lib/mono/gac/System.Drawing/4.0.0.0__b03f5f7f11d50a3a/libgdiplus.so.0.so': '/usr/lib/mono/gac/System.Drawing/4.0.0.0__b03f5f7f11d50a3a/libgdiplus.so.0.so: cannot open shared object file: No such file or directory'.
Mono: DllImport error loading library '/usr/lib/libgdiplus.so.0': '/usr/lib/libgdiplus.so.0: cannot open shared object file: No such file or directory'.
Mono: DllImport error loading library '/usr/lib/libgdiplus.so.0.so': '/usr/lib/libgdiplus.so.0.so: cannot open shared object file: No such file or directory'.
Mono: DllImport error loading library 'libgdiplus.so.0': '/usr/lib64/libgdiplus.so.0: undefined symbol: GifQuantizeBuffer'.
Mono: DllImport error loading library 'libgdiplus.so.0.so': 'libgdiplus.so.0.so: cannot open shared object file: No such file or directory'.
Mono: DllImport error loading library 'libgdiplus.so.0': '/usr/lib64/libgdiplus.so.0: undefined symbol: GifQuantizeBuffer'.
Mono: DllImport unable to load library '/usr/lib64/libgdiplus.so.0: undefined symbol: GifQuantizeBuffer'.
Mono: DllImport attempting to load: 'libgdiplus.so.0'.
Mono: DllImport error loading library '/usr/lib/mono/gac/System.Drawing/4.0.0.0__b03f5f7f11d50a3a/libgdiplus.so.0': '/usr/lib/mono/gac/System.Drawing/4.0.0.0__b03f5f7f11d50a3a/libgdiplus.so.0: cannot open shared object file: No such file or directory'.
Mono: DllImport error loading library '/usr/lib/mono/gac/System.Drawing/4.0.0.0__b03f5f7f11d50a3a/libgdiplus.so.0.so': '/usr/lib/mono/gac/System.Drawing/4.0.0.0__b03f5f7f11d50a3a/libgdiplus.so.0.so: cannot open shared object file: No such file or directory'.
Mono: DllImport error loading library '/usr/lib/libgdiplus.so.0': '/usr/lib/libgdiplus.so.0: cannot open shared object file: No such file or directory'.
Mono: DllImport error loading library '/usr/lib/libgdiplus.so.0.so': '/usr/lib/libgdiplus.so.0.so: cannot open shared object file: No such file or directory'.
Mono: DllImport error loading library 'libgdiplus.so.0': '/usr/lib64/libgdiplus.so.0: undefined symbol: GifQuantizeBuffer'.
Mono: DllImport error loading library 'libgdiplus.so.0.so': 'libgdiplus.so.0.so: cannot open shared object file: No such file or directory'.
Mono: DllImport error loading library 'libgdiplus.so.0': '/usr/lib64/libgdiplus.so.0: undefined symbol: GifQuantizeBuffer'.
Mono: DllImport unable to load library '/usr/lib64/libgdiplus.so.0: undefined symbol: GifQuantizeBuffer'.

Apparently it doesn't find the 'GifQuantizeBuffer' symbol.
Check linked libs of libgdiplus -- libgif.so available
Check symbol table of libgif -- no GifQuantizeBuffer ....
Yeah, so between 5.19 and 5.20 [befe18877] it was moved to a util lib that now explicitly needs to be linked if you want support for it. Of course Fedora doesn't do it so everything that depended on it and didn't roll libgif on it own and statically linked it is fucked now. Downgraded to 5.1.4, everything working smooth now. Took me only hours to figure this out..

I will try to talk to the fedora package people about it as I have seen a few posts describing similiar problems with mono and gdiplus.
Edit: Just found libgdiplus is also on github and it already has an issue for it.
Also on the gentoo bugtracker

@SourMesen
Copy link
Owner

Thanks for the investigation and reporting on it. Hopefully this helps out someone else with the same issue someday. Glad you got it working in the end!

@scottlinux
Copy link

@Joefish Thank you! I have had the same issue on Fedora 30. Rock on,

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants