question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problems running under Linux mono

See original GitHub issue

It’s my first time trying to run the tools, and I uncovered an error when running in the obvious way on Linux. This occurs under both older Ubuntu (mono 3.2.8) and recent Arch (mono 4.8.0). The same release works fine under Windows 10. I haven’t looked into whether previous GerberTools releases behave any better though.

$ cd GerberTools_2017_2_17/Panelizer
$ mono GerberPanelizer.exe

Unhandled Exception:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: XOR data length expected 2046820352, read 1370
Parameter name: stream
  at System.Drawing.Icon.InitFromStreamWithSize (System.IO.Stream stream, Int32 width, Int32 height) [0x00000] in <filename unknown>:0 
  at System.Drawing.Icon..ctor (System.Runtime.Serialization.SerializationInfo info, StreamingContext context) [0x00000] in <filename unknown>:0 
  at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
  at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0 
  at System.Reflection.MonoCMethod.DoInvoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.ObjectRecord.LoadData (System.Runtime.Serialization.ObjectManager manager, ISurrogateSelector selector, StreamingContext context) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.ObjectManager.DoFixups () [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadNextObject (System.IO.BinaryReader reader) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObjectGraph (BinaryElement elem, System.IO.BinaryReader reader, Boolean readHeaders, System.Object& result, System.Runtime.Remoting.Messaging.Header[]& headers) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.NoCheckDeserialize (System.IO.Stream serializationStream, System.Runtime.Remoting.Messaging.HeaderHandler handler) [0x00000] in <filename unknown>:0 
  at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize (System.IO.Stream serializationStream) [0x00000] in <filename unknown>:0 
  at System.Resources.ResourceReader.ReadNonPredefinedValue (System.Type exp_type) [0x00000] in <filename unknown>:0 
  at System.Resources.ResourceReader.ReadValueVer2 (Int32 type_index) [0x00000] in <filename unknown>:0 
  at System.Resources.ResourceReader.LoadResourceValues (ResourceCacheItem[] store) [0x00000] in <filename unknown>:0 
  at System.Resources.ResourceReader+ResourceEnumerator.FillCache () [0x00000] in <filename unknown>:0 
  at System.Resources.ResourceReader+ResourceEnumerator..ctor (System.Resources.ResourceReader readerToEnumerate) [0x00000] in <filename unknown>:0 
  at System.Resources.ResourceReader.GetEnumerator () [0x00000] in <filename unknown>:0 
  at System.Resources.ResourceSet.ReadResources () [0x00000] in <filename unknown>:0 
  at System.Resources.ResourceSet.GetObjectInternal (System.String name, Boolean ignoreCase) [0x00000] in <filename unknown>:0 
  at System.Resources.ResourceSet.GetObject (System.String name, Boolean ignoreCase) [0x00000] in <filename unknown>:0 
  at System.Resources.RuntimeResourceSet.GetObject (System.String name, Boolean ignoreCase) [0x00000] in <filename unknown>:0 
  at System.Resources.ResourceManager.GetObject (System.String name, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  at System.Resources.ResourceManager.GetObject (System.String name) [0x00000] in <filename unknown>:0 
  at GerberCombinerBuilder.GerberPanelizerParent.InitializeComponent () [0x00000] in <filename unknown>:0 
  at GerberCombinerBuilder.GerberPanelizerParent..ctor () [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) GerberCombinerBuilder.GerberPanelizerParent:.ctor ()
  at GerberCombinerBuilder.Program.Main () [0x00000] in <filename unknown>:0 

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:26 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
runesoeknudsencommented, Nov 14, 2017

I have looked at bit into the problem and created a pull request that fixes the problem, see #41 Basically I have extracted the icon file from the code and saved it as a separated file. Thanks for all the hints.

To make it easy for others I have here attached a compiled version: Panelizer.zip This one I have succesfully used to panellized a PCB on Linux with Mono JIT compiler version 5.4.0.201

0reactions
Alfystarcommented, Jun 4, 2021

My problem

Hi every one I’m trying compile te project under linux, in particular ubuntu 20.04.

Unfortunaly i’m getting in truble… anyway this is my error ouput after the installation of the dotnet and mono-complete packege:

/home/alfy/Documents/GitHub-Other/GerberTools/GerberProjects/GerberProjects.sln (default targets) ->
(Build target) ->
/home/alfy/Documents/GitHub-Other/GerberTools/GerberLibrary/GerberLibrary.csproj (default targets) ->
/usr/lib/mono/xbuild/14.0/bin/Microsoft.CSharp.targets (CoreCompile target) ->

        Core/Gerber.cs(14,7): error CS0246: The type or namespace name 'Ionic' could not be found (are you missing a using directive or an assembly reference?)
        Artwork Related/GerberOutlineWriter.cs(4,7): error CS0246: The type or namespace name 'QiHe' could not be found (are you missing a using directive or an assembly reference?)
        Core/GerberPanel.cs(13,7): error CS0246: The type or namespace name 'Ionic' could not be found (are you missing a using directive or an assembly reference?)
        Core/ImageCreator.cs(13,7): error CS0246: The type or namespace name 'Ionic' could not be found (are you missing a using directive or an assembly reference?)
        Core/SickOfBeige.cs(13,7): error CS0246: The type or namespace name 'Ionic' could not be found (are you missing a using directive or an assembly reference?)

Any one cane help me??? I realy don’t know what i need to install now.

Update build.sh

I also update the build.sh script to automatize the mono packge installation for ubuntu, maybe is possible extend to all the OS. This is the modify script:

#!/bin/bash

set -euo pipefail
set -x

nuget () {
	package="$1"
	version="$2"
	zip="`mktemp`.zip"
	url="https://www.nuget.org/api/v2/package/$package/$version"
	dir="GerberProjects/packages/$package.$version"

	test -d "$dir" || {
		wget "$url" -O "$zip"
		mkdir -p "$dir"
		unzip "$zip" -d "$dir"
		rm "$zip"
	}
}

# Needed as xbuild gets confused about some modern terminals
export TERM=xterm

echo "If 'mono' aren't install in your computer, please follow the most appropriate guide here:"
echo 'https://docs.microsoft.com/it-it/dotnet/core/install/linux'
echo "In particular the 'mono-complete' version, now try install for ubuntu"

UBUNTU_VERSION=$(lsb_release -rs);
REQ_UBUNTU_VERSION_1="20.04";
REQ_UBUNTU_VERSION_1_1="21.04";
REQ_UBUNTU_VERSION_2="18.04";
REQ_UBUNTU_VERSION_3="16.04";

# Mono install
if [[ $UBUNTU_VERSION == $REQ_UBUNTU_VERSION_1 ]] || [[ $UBUNTU_VERSION == $REQ_UBUNTU_VERSION_1_1 ]]; then
	sudo apt install gnupg ca-certificates
	sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
	echo "deb https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
	sudo apt update
elif [[ $UBUNTU_VERSION == $REQ_UBUNTU_VERSION_2 ]]; then
	sudo apt install gnupg ca-certificates
	sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
	echo "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
	sudo apt update
elif [[ $UBUNTU_VERSION == $REQ_UBUNTU_VERSION_3 ]]; then
	sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
	sudo apt install apt-transport-https ca-certificates
	echo "deb https://download.mono-project.com/repo/ubuntu stable-xenial main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
	sudo apt update
else
	echo "Imppossible select appropriate Mono-version, please download your self"
	exit 1
fi
sudo apt install mono-complete

#dependance packges
nuget Triangle 0.0.6-Beta3
nuget DotNetZip 1.12.0
nuget OpenTK 3.0.1
nuget OpenTK.GLControl 3.0.1
nuget netDXF 2.0.2
nuget netDXF 0.9.3
nuget GlmNet 0.5.1
nuget DockPanelSuite 3.0.6
nuget DockPanelSuite.ThemeVS2015 3.0.6

echo "If 'dotnet' aren't install in your computer, please follow the most appropriate guide here:"
echo 'https://docs.microsoft.com/it-it/dotnet/core/install/linux'

xbuild /p:Configuration=Debug GerberProjects/GerberProjects.sln

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mono problem!
Seems whatever you are trying to run in mono is not implemented in mono so you can't run it and are getting a...
Read more >
FAQ: Technical | Mono
Yes, Mono is binary compatible with Windows. Which means that you can run binaries produced by .NET compilers from Microsoft and other vendors....
Read more >
Linux: Mono installation and errors
The problem is your mono files are installed in /usr/lib/mono but it is looking for them in /usr/local/lib/mono which doesn't exist.
Read more >
Mono package and problem with making game server ...
I have problem with making mono startup with TerrariaServer on my vps. I've installed mono-runtime and all "required" packages like this:
Read more >
What is Mono and why it can be dangerous
The main argument against Mono is that it is not free of software patents, and there is a risk that Microsoft will require...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found