Loading SDK Examples

the last days i tried the Plugin example from the SDK docs and also the example SDK projects but unfortunately i can´t bring them to work.

I tried the examples on Ubuntu 22.04 and on windows. I dont get an error from cmake or the compiler. When i copy the .so or the dll files in the bin/plugins folder cubit doesnt load the plugins. When i specify a loading location with tools->plugins then nothing changes.
On Ubuntu with Cubit 2022.4, Cubit simply crahes on Startup.

Right now I don’t know where to continue the troubleshooting, so i thought i ask you for a little guidance.

I would be very happy about a few tips or tutorials.

Does Cubit crash on startup normally when you run it on Ubuntu? Please set the environment variable CUBIT_VERBOSE=5 and run coreform_cubit, then send me the full output.
You can also build the plugins in Debug mode and run them under a debugger. Please send me the callstack as well.

terminal_output.txt (7.1 KB)
gdb_libmy_plugin.so.txt (1.2 KB)
gdb_coreform_cubit.txt (14.3 KB)
make -d.txt (210.6 KB)

usually no. it starts crashing when i try the plugins.

Is the source code of the plugin the same as the example? What do you get when you run ldd libmy_plugin.so?

sudo_ldd_libmy_plugin.so.txt (16.2 KB)
ldd_libmy_plugin.so.txt (16.1 KB)

in this case it`s the example code from the examples/CommandPlugin

I’ve managed to reproduce this. The problem is likely that our Cubit is built on Centos 7, and since your plugin is built on Ubuntu it’s pulling in symbols that conflict with Cubit’s. On Windows you shouldn’t have this issue though. What version of Visual Studio are you compiling with on Windows? We’re using VS 2022.

I rebuilt the CommandPlugin on Centos 7 and on Windows with VS 2022. Cubit 2022.4 doesn´t crash anymore and what i see in the terminal the plugin should be loaded.

As i understand it, the example/CommandPlugin should add two new commands to cubit, MyExportCommand and MyVersionCommand but cubit just throw me an error when i type the commands.

ERROR: Unrecognized Keyword: ‘myexportcommand’

ERROR: Unrecognized Keyword: ‘myversioncommand’

what am i missing?

The syntax of the plugin command is defined in the get_syntax function in MyVersionCommand.cpp and MyExportCommand.cpp. If you look at the get_syntax function, you’ll see that the correct syntax is version and export sample <filename>, respectively.

Thanks a lot!
I don´t know why i mistook the keys for the syntax, maybe reading a documentation late at night should not be repeated again.
But thanks to you i can finally start to build the first part of my plugin :smiley:

Hello Scot,

i finally found some free time to finish the first part for my plugin. Everything works fine for ubuntu when i compile on Centos 7.

When i compile on Windows 10 with VS 2022 something goes wrong. The plugin seems to load when i look in the terminal but the commands from the plugin are not available in cubit.
Could you describe me your workflow with VS 2022 or the chosen settings like the toolset and cmake generator or other mandatory flags?

So do you see the output that says Cubit is loading your plugin? Try running it with the environment variable CUBIT_VERBOSE set to “5”.
We use the Visual Studio 2022 generator, and I’m not aware of any flags that could be tripping it up. Maybe the C Runtime Library setting is different? For Cubit we use MD because we build in Release. If you’re building in Debug you should select MDd.

i expected a line which tells me that the calculix_plugin.dll will be loaded. similar to the output from ubuntu with the libcalculix_plugin.so .
when i look at the output on windows i have to say no, the plugin doesn´t load. just because it doesn´t crash on startup doesn´t mean it is loading. i have to remember that.

i also checked the runtime library settings that should be fine.

what can i try next?

output_win10.txt (10.5 KB)
output_ubuntu.txt (7.6 KB)

Where did you put your .dll file? It should be in bin/plugins.

C:\Program Files\Coreform Cubit 2022.4\bin\plugins

Try this: move the plugin into bin and change the extension from .dll to .ccg.

now it attempts to load.

but i get an error

[2022-08-02 18:46:22.524] [app_logger] [error] claro_plugin_verification_data is not present, unloading

output.txt (11.3 KB)

Include the file <Cubit installation dir>include/claro/ComponentPlugin.hpp into your project, then put the macro COMPONENT_PLUGIN into your main.cpp file.

To be clear, this is a hack that shouldn’t be necessary. The .ccg extension and COMPONENT_PLUGIN registers your plugin as a foundational component of Cubit.

Do you have “CubitPluginExport.hpp” included and CUBIT_PLUGIN declared in your .cpp file? That’s the recommended way of doing it for third-party plugins.

i tried the hack, but unfortunately the error still occured.

yes the “CubitPluginExport.hpp” is included and the CUBIT_PLUGIN is declared.

can i send you the plugin? maybe it is faster if you can take a quick look over it. right now it is only a mesh exporter. the example CommandPlugin was the layout for it.

Sure, go ahead, I’ll see if I can reproduce.

hi scot,
i send you a personal message via the forum. i hope you got it.