Pinta won't compile on latest version of mono

Bug #1523739 reported by hcorion
28
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Pinta
Fix Released
Undecided
Cameron White

Bug Description

I was trying to compile the pinta source code from the git repo and I failed to make pinta. I was unfamiliar with mono, but I know how to search the web. I was able to come to the conclusion that it had to do with Mono.Unix (for the scripts that included the using Mono.Unix; line) which is found in the Mono.Posix dll. I found out that if I change a line in all the .csproj files that include Mono.Posix, I was able to fix it.
Here's how:
1. Go to a .csproj file that uses Mono.Posix (for example Pinta.Core/Pinta.Core.csproj)
2. find the line that says something like this:
<Reference Include="Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL" />
    <Reference Include="System" />
3. And change Version=2.0.0.0 to Version=4.0.0.0
4. Save the file and move onto the next .csproj file.

Why is this like that?
If you look at the top of the .csproj file it mentions that it is using ToolsVersion="4.0", which I'm assuming is mono version 4.0, however the .csproj is trying to use the old 2.0 version of the Mono.Posix.dll, which doesn't exist in the 4.0 (or 4.5) directory of mono.

Unfortunately, I was still unable to install Pinta. during the sudo make install section I got more errors. It was complaining about how MakeDir was not a registered program, or something like that. I was able to fix that by changing ToolsVersion="3.5" to ToolsVersion="4.0" at the start of the Pinta.Install.Proj file.
System that produced the errors:
x86_64 Arch Linux Installation running KDE and the very latest updates.
mono 4.2.1.102-1 (https://www.archlinux.org/packages/extra/x86_64/mono/)
mono-addins 1.1-1 (https://www.archlinux.org/packages/extra/x86_64/mono-addins/)

I was also able to find two other people on Ubuntu with the same problem as mine:
https://groups.google.com/forum/#!searchin/pinta/compile/pinta/vDZQBRkn2SM/AznD17zOWmQJ
https://groups.google.com/forum/#!topic/pinta/JkYDwyZ0qZ8

hcorion (zionnimchuk)
description: updated
Revision history for this message
kolAflash (colaflash) wrote :

Bug seems to be still existing in commit ad23dab (2016-04-27).

With master commit ad23dab (2016-04-27) i'm getting errors like these:
DockLibrary/DockItem.cs(34,12): error CS0234: The type or namespace name `Unix' does not exist in the namespace `Mono'. Are you missing an assembly reference?
DockLibrary/DockItemContainer.cs(33,12): error CS0234: The type or namespace name `Unix' does not exist in the namespace `Mono'. Are you missing an assembly reference?
DockLibrary/DockItemTitleTab.cs(33,12): error CS0234: The type or namespace name `Unix' does not exist in the namespace `Mono'. Are you missing an assembly reference?

With Pinta-1.6 i'm getting errors like these:
Actions/WindowActions.cs(30,12): error CS0234: The type or namespace name `Unix' does not exist in the namespace `Mono'. Are you missing an assembly reference?
...
Actions/AddinActions.cs(28,12): error CS0234: The type or namespace name `Unix' does not exist in the namespace `Mono'. Are you missing an assembly reference?

The autogen.sh / configure script probably needs some code to adjust this to the Mono version installed on the build system!

Found an easy way to workaround this here:

http://mono.1490590.n4.nabble.com/Missing-quot-Unix-quot-inside-of-quot-Mono-quot-td4665988.html

Looks like the Fedora people just use two "find ... sed ..." to fix this in their build system.

http://pkgs.fedoraproject.org/cgit/rpms/pinta.git/
http://pkgs.fedoraproject.org/cgit/rpms/pinta.git/commit/?id=2cd055486555c83cbea92915f9183c039e7f9763http://pkgs.fedoraproject.org/cgit/rpms/pinta.git/commit/?id=62c7cfbc9f8df1fa634ecdaf5981e83be5d04628

I Put those "find ... sed ..." commands in a script for you. (see attached Pinta-1.6_mono4-patch-script.sh)
It should work for Pinta-1.6 and master commit ad23dab (2016-04-27).

Be careful when running the script! It will change files without backup and without further notice!

Revision history for this message
kolAflash (colaflash) wrote :

Fix for Pinta-1.6 as patch (instead of a script).
Tested with Mono 4.3.2 on openSUSE 13.2 (64 bit).

Revision history for this message
kolAflash (colaflash) wrote :

Fix for master commit ad23dab (2016-04-27) as patch (instead of a script).
Tested with Mono 4.3.2 on openSUSE 13.2 (64 bit).

This could be committed to master. Nevertheless, it would probably break building with Mono < 4.0.
So if Mono < 4.0 support should be kept, some intelligent solution in autogen.sh / configure is needed.

Revision history for this message
Cameron White (cameronwhite91) wrote :

I think the issue with these changes is that the GTK# package for Windows only provides Mono.Posix 2.0.0.0. https://github.com/mono/gtk-sharp/pull/115 might fix that.

Revision history for this message
Cameron White (cameronwhite91) wrote :

I think https://github.com/PintaProject/Pinta/commit/2e33aade should fix the compilation issues.

Changed in pinta:
assignee: nobody → Cameron White (cameronwhite91)
milestone: none → 1.7
status: New → Fix Committed
Revision history for this message
kolAflash (colaflash) wrote :

https://github.com/PintaProject/Pinta/commit/2e33aade looks good. No more "[...] `Unix' does not exist in the namespace `Mono' [...] errors.

Unfortunately this commit gives me a new error when building:

: warning : Default tasks file /usr/lib/mono/3.5/Microsoft.Common.tasks not found, ignoring.
[...]
: error : Error initializing task MakeDir: Not registered task MakeDir.

Workaround:
sudo mkdir /usr/lib/mono/3.5/
sudo ln -s /usr/lib/mono/4.5/Microsoft.Common.tasks /usr/lib/mono/3.5/

But this workaround isn't needed for building the preceding commit 7c34b07 when using the Pinta-1.6_mono4-patch-script.sh script I provided. (just tested again)
https://bugs.launchpad.net/pinta/+bug/1523739/comments/1

Revision history for this message
Imerion (imerion) wrote :

Can this be applied to the PPA? It still doesn't seem to build correctly for Ubuntu 16.04 and 16.10.

Or maybe that is another issue?

Revision history for this message
Cameron White (cameronwhite91) wrote :

It looks like the "mono-reference-assemblies-4.0" package is also required to build on Ubuntu 16.04 and above. I've updated the packaging for the PPA, so hopefully the next build will go through

grofaty (grofaty)
Changed in pinta:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.