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

mono{48,50,54}: Fix libgdiplus path in dll config map #34050

Merged
merged 1 commit into from Jan 19, 2018

Conversation

jammerful
Copy link
Contributor

@jammerful jammerful commented Jan 19, 2018

Motivation for this change

mono/xbuild can't find libgdiplus library in versions 4.8 and greater. Below is difference between versions 4.6 and above:

${mono46}/etc/mono/config:

<dllmap dll="gdiplus" target="/nix/store/plmc9bs7k4r6szf1sd1ivf30h2mfb44g-libgdiplus-2.10.9/lib/libgdiplus.so" os="!windows"/>
<dllmap dll="gdiplus.dll" target="/nix/store/plmc9bs7k4r6szf1sd1ivf30h2mfb44g-libgdiplus-2.10.9/lib/libgdiplus.so"  os="!windows"/>
<dllmap dll="gdi32" target="/nix/store/plmc9bs7k4r6szf1sd1ivf30h2mfb44g-libgdiplus-2.10.9/lib/libgdiplus.so" os="!windows"/>
<dllmap dll="gdi32.dll" target="/nix/store/plmc9bs7k4r6szf1sd1ivf30h2mfb44g-libgdiplus-2.10.9/lib/libgdiplus.so" os="!windows"/>

${mono{48,50,54}}/etc/mono/config:

<dllmap dll="gdiplus" target="libgdiplus.so.0" os="!windows"/>
<dllmap dll="gdiplus.dll" target="libgdiplus.so.0"  os="!windows"/>
<dllmap dll="gdi32" target="libgdiplus.so.0" os="!windows"/>
<dllmap dll="gdi32.dll" target="libgdiplus.so.0" os="!windows"/>

This causes the following error to be thrown:

Unhandled Exception:
System.TypeInitializationException: The type initializer for 'System.Drawing.GDIPlus' threw an exception. ---> System.DllNotFoundException: libgdiplus.dylib
  at (wrapper managed-to-native) System.Drawing.GDIPlus:GdiplusStartup (ulong&,System.Drawing.GdiplusStartupInput&,System.Drawing.GdiplusStartupOutput&)
  at System.Drawing.GDIPlus..cctor () [0x000b0] in <5279de5321b24f0b8e1f255c47ecc93c>:0 
   --- End of inner exception stack trace ---
  at System.Drawing.Icon.Dispose () [0x00011] in <5279de5321b24f0b8e1f255c47ecc93c>:0 
  at (wrapper remoting-invoke-with-check) System.Drawing.Icon:Dispose ()
  at System.Drawing.Icon.Finalize () [0x00000] in <5279de5321b24f0b8e1f255c47ecc93c>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for 'System.Drawing.GDIPlus' threw an exception. ---> System.DllNotFoundException: libgdiplus.dylib
  at (wrapper managed-to-native) System.Drawing.GDIPlus:GdiplusStartup (ulong&,System.Drawing.GdiplusStartupInput&,System.Drawing.GdiplusStartupOutput&)
  at System.Drawing.GDIPlus..cctor () [0x000b0] in <5279de5321b24f0b8e1f255c47ecc93c>:0 
   --- End of inner exception stack trace ---
  at System.Drawing.Icon.Dispose () [0x00011] in <5279de5321b24f0b8e1f255c47ecc93c>:0 
  at (wrapper remoting-invoke-with-check) System.Drawing.Icon:Dispose ()
  at System.Drawing.Icon.Finalize () [0x00000] in <5279de5321b24f0b8e1f255c47ecc93c>:0

As you can see the sed doesn't work, as it is targeting the wrong string. So simply fix that. Also note I tested that xbuild can now find the libgdiplus library.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@jammerful
Copy link
Contributor Author

@kuznero @orivej As people who have been contributing to mono in nixpkgs.

@orivej
Copy link
Contributor

orivej commented Jan 19, 2018

Thank you for fixing this! I would prefer if you generalized the former sed expression rather than introduce conditionals, maybe like this: sed -e 's#[^"]*libgdiplus[^"]*"#${libgdiplus}/lib/libgdiplus.so#'.

@jammerful
Copy link
Contributor Author

jammerful commented Jan 19, 2018

Sounds good, just retesting. Agreed the regex is much cleaner.

@jammerful
Copy link
Contributor Author

Re-tested.

@orivej orivej merged commit 836951f into NixOS:master Jan 19, 2018
@orivej
Copy link
Contributor

orivej commented Jan 19, 2018

Thank you!

@jammerful jammerful deleted the mono branch January 19, 2018 23:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants