Cannot run (cross compiled) opencascade app on windows


i am having trouble to get a windows opencascade app to work.

The app is cross compiled under linux using mxe.

I copy all dlls into the app folder + the src dir from linux to the app folder, so i end up with:

c:\MyApp\libTKernel-0.dll (as example for all opencascade dll files)
c:\MyApp\src\StdResource (an everything else from src

I then set all environment variables with code like this:

OSD_Environment xcafDef("CSF_XCAFDefaults", QDir::toNativeSeparators(prefix+"/StdResource").toLocal8Bit().toStdString().c_str());
debugVar(xcafDef, doDebug);

Which outputs the followin:

CSF_XmlOcafResource = C:\MyApp\src\XmlOcafResource
CSF_StandardDefaults = C:\MyApp\src\StdResource
CSF_XSMessage = C:\MyApp\src\XSMessage
CSF_StandardLiteDefaults = C:\MyApp\src\StdResource
CSF_UnitsDefinition = C:\MyApp\src\UnitsAPI\Units.dat
CSF_XmlOcafResource = C:\MyApp\src\XmlOcafResource
CSF_STEPDefaults = C:\MyApp\src\XSTEPResource
CSF_IGESDefaults = C:\MyApp\src\XSTEPResource
CSF_PluginDefaults = C:\MyApp\src\StdResource
CSF_UnitsLexicon = C:\MyApp\src\UnitsAPI\Lexi_Expr.dat
CSF_XCAFDefaults = C:\MyApp\src\StdResource
CSF_MDTVTexturesDirectory = C:\MyApp\src\Textures
CSF_SHMessage = C:\MyApp\src\SHMessage

When i run the app with the same setup under a linux that has no opencascade libs installed, all works fine. But when i try the same under windows, the app starts up, but as soon as i try to read an XCAF document, it crashes:

could not open: TKXCAFSchema ; reason: The specified module could not be found.
terminate called after throwing an instance of 'Plugin_Failure'

Unfortunately my possibilities for debuging are limited on Windows, but it seems to happen here:

Handle(Storage_Schema) aSchema = PCDM::Schema("MDTV-XCAFSchema", application);

Any ideas?

Thanx in advance.

Benjamin Bihler's picture

Hi Heiko,

just an idea: the plugin loading mechanism of OpenCASCADE will look for DLLs with certain names. If you compile with g++ on Linux, probably your DLLs are named libLibrary.dll. This is different from the MSVC naming Library.dll, on which the plugin loading mechanism relies. If you check the community edition of OpenCASCADE, there the plugin loading mechanism is modified to use the g++ library names when compiling with MinGW.

I hope, that this may help you.


Heiko Irrgang's picture

Great, thank you, that was the problem.

I don't think we actually need opencascade, i can live with oce for now.

Kind regards,