Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QtPluginLoader fails to load plugin if I use Tensorflow functions in it

QtPluginLoader fails to load plugin if I use Tensorflow functions in it

Scheduled Pinned Locked Moved Solved General and Desktop
pluginsplugin windowsload
4 Posts 3 Posters 960 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    fugreh
    wrote on 23 May 2018, 13:21 last edited by fugreh
    #1

    I am making a plugin as a project in Visual Studio 2017 which loads a Tensorflow model and uses it in an application. The plugin includes a class which loads a Tensorflow model and links with Tensorflow 1.7 (built for Release, I also build the plugin for Release). If I comment out all of the functions and structures from the Tensorflow library (e.g., tensorflow::GraphDef, etc.) then the plugin loads. If I uncomment them it fails to load:

    QPluginLoader *loader = new QPluginLoader(pluginsDir.absoluteFilePath(pluginPath));
    QObject *plugin = loader->instance(); // plugin is NULL
    

    plugin->errorString() is

    "CNNPlugin.dll" "Cannot load library ...\\bin\\Release\\plugins\\CNNPlugin.dll: The specified module could not be found."
    

    But it is there, and it loads just fine if I comment out all Tensorflow related code as mentioned. I tried linking with and running tensorflow in a simple C++ console application and that worked without issue.

    J 1 Reply Last reply 24 May 2018, 00:07
    0
    • C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 23 May 2018, 15:57 last edited by
      #2

      Make sure the TensorFlow library is in your Path when trying to load the library.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      4
      • F fugreh
        23 May 2018, 13:21

        I am making a plugin as a project in Visual Studio 2017 which loads a Tensorflow model and uses it in an application. The plugin includes a class which loads a Tensorflow model and links with Tensorflow 1.7 (built for Release, I also build the plugin for Release). If I comment out all of the functions and structures from the Tensorflow library (e.g., tensorflow::GraphDef, etc.) then the plugin loads. If I uncomment them it fails to load:

        QPluginLoader *loader = new QPluginLoader(pluginsDir.absoluteFilePath(pluginPath));
        QObject *plugin = loader->instance(); // plugin is NULL
        

        plugin->errorString() is

        "CNNPlugin.dll" "Cannot load library ...\\bin\\Release\\plugins\\CNNPlugin.dll: The specified module could not be found."
        

        But it is there, and it loads just fine if I comment out all Tensorflow related code as mentioned. I tried linking with and running tensorflow in a simple C++ console application and that worked without issue.

        J Offline
        J Offline
        JKSH
        Moderators
        wrote on 24 May 2018, 00:07 last edited by
        #3

        @fugreh said in QtPluginLoader fails to load plugin if I use Tensorflow functions in it:

        But it is there, and it loads just fine if I comment out all Tensorflow related code as mentioned.

        To clarify @Christian-Ehrlicher's comment: Qt can't load your plugin if it can't find the TensorFlow libraries

        I tried linking with and running tensorflow in a simple C++ console application

        In this test, how did you tell Qt where to find the TensorFlow libraries?

        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

        1 Reply Last reply
        3
        • F Offline
          F Offline
          fugreh
          wrote on 25 May 2018, 12:38 last edited by
          #4

          Thanks for your input, the problem was that the DLL was actually not in the place where it should have been, my mistake.

          1 Reply Last reply
          1

          1/4

          23 May 2018, 13:21

          • Login

          • Login or register to search.
          1 out of 4
          • First post
            1/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved