Some issues with Pipeline tool on Fedora

Hi,

I have seen on Twitter and Github that the Pipeline tool is now available for Mac and Linux and It works almost as the Windows version, except that we can’t build shaders. So I tested it on my Linux system and I had to do some hacks before having this tool running.

Firstly, I’m using Fedora 21 with the Xamarin repository of Mono/MonoDevelop, so I’m really up to date about that (Mono 3.12 and MonoDevelop 5.7. Note that Xamarin has repository for other distributions such as OpenSuse, Debian, Ubuntu, etc… It’s the perfect way to have an updated version of these package because a lot of distribution don’t update it.

Well the first issue was about some libraries with a “bad path”

System.TypeInitializationException: An exception was thrown by the type initializer for Gtk.Container —> System.DllNotFoundException: /usr/lib/cli/gtk-sharp-2.0/libgtksharpglue-2.so

This is the concerned libraries

  • libatksharpglue-2.so
  • libgdksharpglue-2.so
  • libgladesharpglue-2.so
  • libglibsharpglue-2.so
  • libgtksharglue-2.so

So the easiest and dumbest thing is to copy or link the missing libraries which are present in /usr/lib64 for me.

/usr/lib/cli/at-sharp-2.0/libatkglue-2.0.so
/usr/lib/cli/gdk-sharp-2.0/libgdksharpglue-2.0.so
/etc…

But the good way is to edit all config files of these libraries

  • atk-sharp.dll.config
  • gdk-sharp.dll.config
  • etc…

and replace one of these line :

<dllmap os="linux" dll="glibsharpglue-2" target="/usr/lib/cli/glib-sharp-2.0/libglibsharpglue-2.so"/>

by this

<dllmap os="linux" dll="glibsharpglue-2" target="libglibsharpglue-2.so"/>

By doing this, the pipeline tool will now run with the following command: mono ./Pipeline.

But now there is another problem : The font generation

If I add a SpriteFont in my Pipeline project, and of course the correct TTF file in the same folder of my SpriteFont, I can’t build it because of this first error :

/usr/share/fonts/default is missing, I don’t have it on my system. I have a lot of other fonts like dejavu, gnufree, truetype, etc… but I don’t have a folder named default.

ls /usr/share/fonts

aajohan-comfortaa         google-droid    lohit-devanagari  opensymbol           tabish-eeyek
abattis-cantarell         google-noto     lohit-gujarati    paktype-naskh-basic  thai-scalable
blender                   jomolhari       lohit-gurmukhi    sil-abyssinica       truetype
khmeros         lohit-kannada     sil-mingzat          wqy-microhei
dejavu                    liberation      lohit-odia        sil-nuosu
gnu-free                  lklug           lohit-tamil       sil-padauk
google-crosextra-caladea  lohit-assamese  lohit-telugu      smc
google-crosextra-carlito  lohit-bengali   lyx               stix

No problem I’ve created a folder named “default” and I copied the content of another font folder into it. The first error is fixed but now I have a last error during the font generation :

This is the MonoDevelop’s output

> [ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentOutOfRangeException: Argument is out of range.
> Parameter name: index
>   at System.Collections.Generic.List`1[T].get_Item (Int32 index) [0x00000] in <filename unknown>:0 
>   at System.Collections.ObjectModel.Collection`1[T].get_Item (Int32 index) [0x00000] in <filename unknown>:0 
>   at Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler.Texture2DWriter.Write (Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler.ContentWriter output, Microsoft.Xna.Framework.Content.Pipeline.Graphics.Texture2DContent value) [0x00000] in <filename unknown>:0 
>   at Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler.ContentTypeWriter`1[Microsoft.Xna.Framework.Content.Pipeline.Graphics.Texture2DContent].Write (Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler.ContentWriter output, System.Object value) [0x00000] in <filename unknown>:0 
>   at Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler.ContentWriter.WriteObject[Texture2DContent] (Microsoft.Xna.Framework.Content.Pipeline.Graphics.Texture2DContent value) [0x00000] in <filename unknown>:0 
>   at Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler.SpriteFontContentWriter.Write (Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler.ContentWriter output, Microsoft.Xna.Framework.Content.Pipeline.Graphics.SpriteFontContent value) [0x00000] in <filename unknown>:0 
>   at Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler.ContentTypeWriter`1[Microsoft.Xna.Framework.Content.Pipeline.Graphics.SpriteFontContent].Write (Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler.ContentWriter output, System.Object value) [0x00000] in <filename unknown>:0 
>   at Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler.ContentWriter.WriteObject[Object] (System.Object value) [0x00000] in <filename unknown>:0 
>   at Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler.ContentCompiler.Compile (System.IO.Stream stream, System.Object content, TargetPlatform targetPlatform, GraphicsProfile targetProfile, Boolean compressContent, System.String rootDirectory, System.String referenceRelocationPath) [0x00000] in <filename unknown>:0 
>   at MonoGame.Framework.Content.Pipeline.Builder.PipelineManager.WriteXnb (System.Object content, MonoGame.Framework.Content.Pipeline.Builder.PipelineBuildEvent pipelineEvent) [0x00000] in <filename unknown>:0 
>   at MonoGame.Framework.Content.Pipeline.Builder.PipelineManager.BuildContent (MonoGame.Framework.Content.Pipeline.Builder.PipelineBuildEvent pipelineEvent, MonoGame.Framework.Content.Pipeline.Builder.PipelineBuildEvent cachedEvent, System.String eventFilepath) [0x00000] in <filename unknown>:0 
>   at MonoGame.Framework.Content.Pipeline.Builder.PipelineManager.BuildContent (System.String sourceFilepath, System.String outputFilepath, System.String importerName, System.String processorName, Microsoft.Xna.Framework.Content.Pipeline.OpaqueDataDictionary processorParameters) [0x00000] in <filename unknown>:0 
>   at MGCB.BuildContent.Build (System.Int32& successCount, System.Intlog32& errorCount) [0x00000] in <filename unknown>:0 
>   at MGCB.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0  

And this is the Pipeline’s output :

System.NullReferenceException: Object reference not set to an instance of an object
  at (wrapper unknown) SharpFont.Internal.GlyphSlotRec:PtrToStructure (intptr,object)
  at (wrapper managed-to-native) System.Runtime.InteropServices.Marshal:PtrToStructure (intptr,System.Type)
  at SharpFont.PInvokeHelper.PtrToStructure[GlyphSlotRec] (IntPtr reference) [0x00000] in <filename unknown>:0 
  at SharpFont.GlyphSlot.set_Reference (IntPtr value) [0x00000] in <filename unknown>:0 
  at SharpFont.GlyphSlot..ctor (IntPtr reference, SharpFont.Face parentFace, SharpFont.Library parentLibrary) [0x00000] in <filename unknown>:0 
  at SharpFont.Face.get_Glyph () [0x00000] in <filename unknown>:0 
  at Microsoft.Xna.Framework.Content.Pipeline.Graphics.SharpFontImporter.ImportGlyph (Char character, SharpFont.Face face, System.Drawing.Brush brush, System.Drawing.StringFormat stringFormat, System.Drawing.Bitmap bitmap, System.Drawing.Graphics graphics) [0x00000] in <filename unknown>:0 
  at Microsoft.Xna.Framework.Content.Pipeline.Graphics.SharpFontImporter.Import (Microsoft.Xna.Framework.Content.Pipeline.Graphics.FontDescription options, System.String fontName) [0x00000] in <filename unknown>:0 
  at Microsoft.Xna.Framework.Content.Pipeline.Processors.FontDescriptionProcessor.ImportFont (Microsoft.Xna.Framework.Content.Pipeline.Graphics.FontDescription options, System.Single& lineSpacing, System.Int32& yOffsetMin, Microsoft.Xna.Framework.Content.Pipeline.ContentProcessorContext context, System.String fontName) [0x00000] in <filename unknown>:0 
  at Microsoft.Xna.Framework.Content.Pipeline.Processors.FontDescriptionProcessor.Process (Microsoft.Xna.Framework.Content.Pipeline.Graphics.FontDescription input, Microsoft.Xna.Framework.Content.Pipeline.ContentProcessorContext context) [0x00000] in <filename unknown>:0 

In first place, I would like to say thank you to the Linux/Mac maintainers because the work done on this tool is good. By the way we need to fix these issues because not everybody use Ubuntu.
Unfortunately, I don’t have access to my Linux system with Fedora the week, only the weekend, so if some files are made, I can’t test it quickly. But I hope that my feedback will help you to solve these last problems to have a Linux version that work as expected on all Linux systems.

Here, hopefully all is working now: https://mega.co.nz/#!bEQUAYbI!zTzzIX0OgC3yR6fS0szESfI45igbn2DXAXQwIE9z0BQ

I tested latest changes from #3426 pull request and now the Pipeline tool display this message

Building Font /home/yann/Sources/OldDosSharp/ODS.Content/Font/interstate-black.ttf
Using DXT Compression
System.DllNotFoundException: nvtt
  at (wrapper managed-to-native) Nvidia.TextureTools.Compressor:nvttCreateCompressor ()
  at Nvidia.TextureTools.Compressor..ctor () [0x00000] in <filename unknown>:0 
  at Microsoft.Xna.Framework.Content.Pipeline.Graphics.GraphicsUtil.CompressDxt (GraphicsProfile profile, Microsoft.Xna.Framework.Content.Pipeline.Graphics.TextureContent content, Boolean generateMipmaps, Boolean premultipliedAlpha, Boolean sharpAlpha) [0x00000] in <filename unknown>:0 
  at Microsoft.Xna.Framework.Content.Pipeline.Graphics.GraphicsUtil.CompressTexture (GraphicsProfile profile, Microsoft.Xna.Framework.Content.Pipeline.Graphics.TextureContent content, Microsoft.Xna.Framework.Content.Pipeline.ContentProcessorContext context, Boolean generateMipmaps, Boolean premultipliedAlpha, Boolean sharpAlpha) [0x00000] in <filename unknown>:0 
  at Microsoft.Xna.Framework.Content.Pipeline.Processors.FontDescriptionProcessor.Process (Microsoft.Xna.Framework.Content.Pipeline.Graphics.FontDescription input, Microsoft.Xna.Framework.Content.Pipeline.ContentProcessorContext context) [0x00000] in <filename unknown>:0 

Build 11 succeeded, 0 failed.

The XNB is created and I can load it in my game, it’s weird but it’s works.

Oh yea, the actual error is:

Unhandled Exception:
System.DllNotFoundException: nvtt
  at (wrapper managed-to-native) Nvidia.TextureTools.Compressor:nvttDestroyCompressor (intptr)
  at Nvidia.TextureTools.Compressor.Finalize () [0x00000] in <filename unknown>:0 

basically there is an error in nvtt c# wrapper when calling destroy, but everything should still work.

Yep, after installing the nvidia-texture-tools-dev package, I’ve less errors and all works

By the way, we need to inform the developer that a manual configuration of the .config file can be necessary to have this tool working on its system.

I am the one who is maintaining linux monogame stuff… all is fixed already… https://github.com/mono/MonoGame/pull/3426