Results 1 to 7 of 7

Thread: DllNotFoundException when running OpenTk application

  1. #1
    Join Date
    Jun 2011
    Location
    Netherlands
    Beans
    181
    Distro
    Ubuntu 12.04 Precise Pangolin

    DllNotFoundException when running OpenTk application

    Hi,

    I want to program in C# - OpenTK - MonoDevelop on my ubuntu 12.04 computer.
    I downloaded and installed everything as explained here http://www.opentk.com/doc/install: I added the references to OpenTK.dll, added the OpenTK.dll.config in the binary folder, added the reference to System.Drawing.
    However I get an exception when I run the given examples from the tutorial.
    The message I get is "System.DllNotFoundException has been thrown. libX11.so".
    When I run the generated binary from the terminal I get this (different) message:

    Code:
    Unhandled Exception: System.TypeInitializationException: An exception was thrown by the type initializer for OpenTK.Graphics.GraphicsMode ---> System.PlatformNotSupportedException: Please, refer to http://www.opentk.com for more information.
      at OpenTK.Platform.Factory+UnsupportedPlatform.CreateGraphicsMode () [0x00000] in <filename unknown>:0 
      at OpenTK.Graphics.GraphicsMode..cctor () [0x00000] in <filename unknown>:0 
      --- End of inner exception stack trace ---
      at StarterKit.Game..ctor () [0x00000] in <filename unknown>:0 
      at StarterKit.Game.Main () [0x00000] in <filename unknown>:0 
    [ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: An exception was thrown by the type initializer for OpenTK.Graphics.GraphicsMode ---> System.PlatformNotSupportedException: Please, refer to http://www.opentk.com for more information.
      at OpenTK.Platform.Factory+UnsupportedPlatform.CreateGraphicsMode () [0x00000] in <filename unknown>:0 
      at OpenTK.Graphics.GraphicsMode..cctor () [0x00000] in <filename unknown>:0 
      --- End of inner exception stack trace ---
      at StarterKit.Game..ctor () [0x00000] in <filename unknown>:0 
      at StarterKit.Game.Main () [0x00000] in <filename unknown>:0
    Does anyone know what causes this problem? How can I solve it?
    Any help very much appreciated.

    BTW: Is this the right subforum to ask this question?

    Regards
    Last edited by Chiel92; June 5th, 2012 at 10:00 AM.
    Vim - Comfortable text editing and coding
    vim-autoformat - a code-formatting plugin for vim supporting various languages - https://github.com/Chiel92/vim-autoformat
    Vimperator - Fast browsing using keyboard only

  2. #2
    Join Date
    Jun 2011
    Location
    Netherlands
    Beans
    181
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: DllNotFoundException when running OpenTk application

    Bump
    Vim - Comfortable text editing and coding
    vim-autoformat - a code-formatting plugin for vim supporting various languages - https://github.com/Chiel92/vim-autoformat
    Vimperator - Fast browsing using keyboard only

  3. #3
    Join Date
    Apr 2011
    Beans
    2

    Re: DllNotFoundException when running OpenTk application

    I had this problem on 12.04 64-bit Desktop edition.

    Installing libx11-dev solved it for me:
    sudo apt-get install libx11-dev

  4. #4
    Join Date
    Jun 2011
    Location
    Netherlands
    Beans
    181
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: DllNotFoundException when running OpenTk application

    Quote Originally Posted by daegul View Post
    I had this problem on 12.04 64-bit Desktop edition.

    Installing libx11-dev solved it for me:
    sudo apt-get install libx11-dev
    Hey, thanks!
    It immediately solved my problem!
    Do you know why this occured and what the libx11-dev package exactly does?
    Vim - Comfortable text editing and coding
    vim-autoformat - a code-formatting plugin for vim supporting various languages - https://github.com/Chiel92/vim-autoformat
    Vimperator - Fast browsing using keyboard only

  5. #5
    Join Date
    Apr 2011
    Beans
    2

    Re: DllNotFoundException when running OpenTk application

    I believe libX11.so is to do with the X-window server (hence it's required to run up an OpenTK graphics context). Beyond that I don't know.

    Googling the library name showed which package libX11.so was in. Installing that package installed the .so file.

    It seems really odd for an X11 library to be missing when I'm running everything with through a Gnome environment. I'm guessing it's something to do with having an x64 OS, but mono compiling to x86.

  6. #6
    Join Date
    Apr 2009
    Location
    Germany
    Beans
    2,134
    Distro
    Ubuntu Development Release

    Re: DllNotFoundException when running OpenTk application

    that you need to install libx11-dev indicates a broken dllmap:
    http://www.mono-project.com/Config_DllMap

    in some in *.config file there is probably something like this:
    Code:
    <configuration>
                <dllmap dll="somedll.dll" target="libX11.so"/>
    </configuration>
    the target is unversioned which is pretty much always wrong. Native libraries must always be versioned. The fix on 12.04 would be:
    Code:
    <dllmap dll="somedll.dll" target="libX11.so.6"/>

    edit: this actually appears to be a bug in mono:
    https://bugs.launchpad.net/ubuntu/+s...o/+bug/1008212
    I'll see to get it fixed.
    Last edited by MadCow108; June 3rd, 2012 at 09:14 PM.

  7. #7
    Join Date
    Oct 2006
    Location
    /dev/null
    Beans
    1,574
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: DllNotFoundException when running OpenTk application

    Quote Originally Posted by MadCow108 View Post
    that you need to install libx11-dev indicates a broken dllmap:
    http://www.mono-project.com/Config_DllMap

    in some in *.config file there is probably something like this:
    Code:
    <configuration>
                <dllmap dll="somedll.dll" target="libX11.so"/>
    </configuration>
    the target is unversioned which is pretty much always wrong. Native libraries must always be versioned. The fix on 12.04 would be:
    Code:
    <dllmap dll="somedll.dll" target="libX11.so.6"/>

    edit: this actually appears to be a bug in mono:
    https://bugs.launchpad.net/ubuntu/+s...o/+bug/1008212
    I'll see to get it fixed.
    This is a correct analysis.

    I fixed it in Debian as part of an effort to get OpenTK into the distro (which has now happened), but Ubuntu didn't get the fix yet.

    Dllmap correctness is enforced by our packaging tools in Debian/Ubuntu - a package will fail to build if dh_clideps cannot resolve a valid library for a Dllmap. So this issue was discovered when packaging OpenTK, which was throwing the correctness error during build.
    Understanding is a three-edged sword: Your side, their side, and the truth

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •