OCAF driver not found

Hi,

I can compile and run OCAF sample in Windows. Since there is not an OCAF sample in Linux, I try to make my own. Undo-redo function works fine. But when I want to implement saving file, I got the following error.

.so: cannot open shared object file: No such file or directory

I have set the following environment variables, and put the files Resources and Plugin in res directory. I make the setting the same as in Windows.

export CASROOT=/opt/OpenCASCADE6.2.0/ros/
export LD_LIBRARY_PATH=/opt/OpenCASCADE6.2.0/ros/lin/lib/
export CSF_PluginDefaults=res
export CSF_NewFormatDefaults=res

Does anybody has ever successfully make OCAF application in Linux? Will you share your experiences? Thanks.

Torsten Sadowski's picture

Hi Umar,

I use OCAF on Linux and Mac OSX. For the Mac I have:

export CASROOT=/Users/totty/Projects/OpenCASCADE6.1.0/ros
#export CSF_GraphicShr
#export CSF_CurrentUnitsDefaults
#export CSF_CurrentUnitsUserDefaults
export ResourceDebug=1
export CSF_PluginDefaults=res
export CSF_PluginUserDefaults=res
export CSF_ResourceVerbose=1
export CSF_ResourcesDefaults=res
export CSF_SHMessage=res
export CSF_STEPDefaults=res
export CSF_XSMessage=res
export DEBUGMODE=1
export MMGT_VERBOSE=1
export DISPLAY=:0.0

Could you paste the files res/Plugin and res/Resources?

Torsten

Umar Said's picture

Thanks Torsten for your response.

Below are files of Plugin, Resources, run.sh and output of executable file in console. I have also tried to append .so to plugin such as FWOSPlugin into FWOSPlugin.so as suggested on the Ocaf documentation. But I got the same result.

Could you send me your code and script for environment settings to umarsaid at yahoo.com ?

=================================================
res/Plugin
=================================================
! Description of available plugins
! ********************************
!
a148e300-5740-11d1-a904-080036aaa103.Location: FWOSPlugin
!
! standard attribute drivers plugin
!
ad696000-5b34-11d1-b5ba-00a0c9064368.Location: StdPlugin
ad696001-5b34-11d1-b5ba-00a0c9064368.Location: StdPlugin
ad696002-5b34-11d1-b5ba-00a0c9064368.Location: StdPlugin
!
! standard attribute drivers plugin
!
bd696000-5b34-11d1-b5ba-00a0c9064368.Location: StdLPlugin
bd696001-5b34-11d1-b5ba-00a0c9064368.Location: StdLPlugin
bd696002-5b34-11d1-b5ba-00a0c9064368.Location: StdLPlugin
!
! XmlOcaf Document Plugin
!
03a56820-8269-11d5-aab2-0050044b1af1.Location: XmlPlugin
03a56822-8269-11d5-aab2-0050044b1af1.Location: XmlPlugin
03a56824-8269-11d5-aab2-0050044b1af1.Location: XmlPlugin
!
! BinOcaf Document Plugin
!
03a56835-8269-11d5-aab2-0050044b1af1.Location: BinPlugin
03a56836-8269-11d5-aab2-0050044b1af1.Location: BinPlugin

=================================================
res/Resources
=================================================

formatlist:Ocaf-Sample|XmlOcaf|BinOcaf
!
! standard attributes
!
Ocaf-Sample.Description: OCAF sample Document Version 1.0
Ocaf-Sample.FileExtension: sta
Ocaf-Sample.StoragePlugin: ad696000-5b34-11d1-b5ba-00a0c9064368
Ocaf-Sample.RetrievalPlugin: ad696001-5b34-11d1-b5ba-00a0c9064368
Ocaf-SampleSchema: ad696002-5b34-11d1-b5ba-00a0c9064368
!
! standard attributes
!
MDTV-Standard.Description: Standard Document Version 1.0
MDTV-Standard.FileExtension: std
MDTV-Standard.StoragePlugin: ad696000-5b34-11d1-b5ba-00a0c9064368
MDTV-Standard.RetrievalPlugin: ad696001-5b34-11d1-b5ba-00a0c9064368
MDTV-StandardSchema: ad696002-5b34-11d1-b5ba-00a0c9064368
!
! XmlOcaf format
!
XmlOcaf.Description: Xml Document Version 1.0
XmlOcaf.FileExtension: xml
XmlOcaf.StoragePlugin: 03a56820-8269-11d5-aab2-0050044b1af1
XmlOcaf.RetrievalPlugin: 03a56822-8269-11d5-aab2-0050044b1af1
!
! BinOcaf format
!
BinOcaf.Description: Bin Ocaf Document Version 1.0
BinOcaf.FileExtension: cbf
BinOcaf.StoragePlugin: 03a56835-8269-11d5-aab2-0050044b1af1
BinOcaf.RetrievalPlugin: 03a56836-8269-11d5-aab2-0050044b1af1

=================================================
run.sh
=================================================
#!/bin/bash

export QTDIR=/usr/local/stow/qt-3.3.7/
export CASROOT=/opt/OpenCASCADE6.2.0/ros/
export LD_LIBRARY_PATH=/opt/OpenCASCADE6.2.0/ros/lin/lib/
export CSF_PluginDefaults=res
export CSF_NewFormatDefaults=res

export ResourceDebug=1
export CSF_PluginDefaults=res
export CSF_PluginUserDefaults=res
export CSF_ResourceVerbose=1
export CSF_ResourcesDefaults=res
export CSF_SHMessage=res
export CSF_STEPDefaults=res
export CSF_XSMessage=res
export DEBUGMODE=1
export MMGT_VERBOSE=1
./Linux/bin/mycad

=================================================
console output
=================================================

$ ./run.sh
'ey = 'a148e300-5740-11d1-a904-080036aaa103.Location' Value = 'FWOSPlugin
'ey = 'ad696000-5b34-11d1-b5ba-00a0c9064368.Location' Value = 'StdPlugin
'ey = 'ad696001-5b34-11d1-b5ba-00a0c9064368.Location' Value = 'StdPlugin
'ey = 'ad696002-5b34-11d1-b5ba-00a0c9064368.Location' Value = 'StdPlugin
'ey = 'bd696000-5b34-11d1-b5ba-00a0c9064368.Location' Value = 'StdLPlugin
'ey = 'bd696001-5b34-11d1-b5ba-00a0c9064368.Location' Value = 'StdLPlugin
'ey = 'bd696002-5b34-11d1-b5ba-00a0c9064368.Location' Value = 'StdLPlugin
'ey = '03a56820-8269-11d5-aab2-0050044b1af1.Location' Value = 'XmlPlugin
'ey = '03a56822-8269-11d5-aab2-0050044b1af1.Location' Value = 'XmlPlugin
'ey = '03a56824-8269-11d5-aab2-0050044b1af1.Location' Value = 'XmlPlugin
'ey = '03a56835-8269-11d5-aab2-0050044b1af1.Location' Value = 'BinPlugin
'ey = '03a56836-8269-11d5-aab2-0050044b1af1.Location' Value = 'BinPlugin
Resource Manager: Reference file "res/Plugin" loaded
'ey = 'a148e300-5740-11d1-a904-080036aaa103.Location' Value = 'FWOSPlugin
'ey = 'ad696000-5b34-11d1-b5ba-00a0c9064368.Location' Value = 'StdPlugin
'ey = 'ad696001-5b34-11d1-b5ba-00a0c9064368.Location' Value = 'StdPlugin
'ey = 'ad696002-5b34-11d1-b5ba-00a0c9064368.Location' Value = 'StdPlugin
'ey = 'bd696000-5b34-11d1-b5ba-00a0c9064368.Location' Value = 'StdLPlugin
'ey = 'bd696001-5b34-11d1-b5ba-00a0c9064368.Location' Value = 'StdLPlugin
'ey = 'bd696002-5b34-11d1-b5ba-00a0c9064368.Location' Value = 'StdLPlugin
'ey = '03a56820-8269-11d5-aab2-0050044b1af1.Location' Value = 'XmlPlugin
'ey = '03a56822-8269-11d5-aab2-0050044b1af1.Location' Value = 'XmlPlugin
'ey = '03a56824-8269-11d5-aab2-0050044b1af1.Location' Value = 'XmlPlugin
'ey = '03a56835-8269-11d5-aab2-0050044b1af1.Location' Value = 'BinPlugin
'ey = '03a56836-8269-11d5-aab2-0050044b1af1.Location' Value = 'BinPlugin
Resource Manager: User file "res/Plugin" loaded
.so: cannot open shared object file: No such file or directory
'ey = 'formatlist' Value = 'Ocaf-Sample|XmlOcaf|BinOcaf
'ey = 'Ocaf-Sample.Description' Value = 'OCAF sample Document Version 1.0
'ey = 'Ocaf-Sample.FileExtension' Value = 'sta
Key = 'Ocaf-Sample.StoragePlugin' Value = 'ad696000-5b34-11d1-b5ba-00a0c9'64368
Key = 'Ocaf-Sample.RetrievalPlugin' Value = 'ad696001-5b34-11d1-b5ba-00a0c9'64368
'ey = 'Ocaf-SampleSchema' Value = 'ad696002-5b34-11d1-b5ba-00a0c9064368
'ey = 'MDTV-Standard.Description' Value = 'Standard Document Version 1.0
'ey = 'MDTV-Standard.FileExtension' Value = 'std
Key = 'MDTV-Standard.StoragePlugin' Value = 'ad696000-5b34-11d1-b5ba-00a0c9'64368
Key = 'MDTV-Standard.RetrievalPlugin' Value = 'ad696001-5b34-11d1-b5ba-00a0c9'64368
'ey = 'MDTV-StandardSchema' Value = 'ad696002-5b34-11d1-b5ba-00a0c9064368
'ey = 'XmlOcaf.Description' Value = 'Xml Document Version 1.0
'ey = 'XmlOcaf.FileExtension' Value = 'xml
'ey = 'XmlOcaf.StoragePlugin' Value = '03a56820-8269-11d5-aab2-0050044b1af1
'ey = 'XmlOcaf.RetrievalPlugin' Value = '03a56822-8269-11d5-aab2-0050044b1af1
'ey = 'BinOcaf.Description' Value = 'Bin Ocaf Document Version 1.0
'ey = 'BinOcaf.FileExtension' Value = 'cbf
'ey = 'BinOcaf.StoragePlugin' Value = '03a56835-8269-11d5-aab2-0050044b1af1
'ey = 'BinOcaf.RetrievalPlugin' Value = '03a56836-8269-11d5-aab2-0050044b1af1
Resource Manager: Reference file "res/Resources" loaded
Resource Manager Warning: Environment variable "CSF_ResourcesUserDefaults" not set.
Resource Manager Warning: Environment variable "CSF_CharSetDefaults" not set.
Resource Manager Warning: Environment variable "CSF_CharSetUserDefaults" not set.
./run.sh: line 19: 17064 Aborted ./Linux/bin/mycad

Torsten Sadowski's picture

Hello Umar,

this is my SaveAs method. As you can see, there is the original windows code still in evidence.

void Document::onFileSaveAs()
{
QString s = QFileDialog::getSaveFileName(
"/home/totty/Diss",
"tcad Files (*.tcad *.xtcad)",
0,
"save file dialog",
"Choose a file" );
if (!s) return;
Handle(TOcaf_Application) m_App= getApplication()->getOccApp();

// SetTitle(s);

QApplication::setOverrideCursor( Qt::waitCursor );
// CString CSPath = dlg.GetPathName();

// if((CSPath.Find(CString(".sta")))==-1 )
// CSPath = CSPath + ".sta";

cout << "Save As " << s << endl;
// PathName=CSPath;
// Standard_CString SPath = (Standard_CString) (LPCTSTR) CSPath;
Standard_CString SPath = (Standard_CString) qstrdup(s);
TCollection_ExtendedString TPath(SPath);
cout << TPath << endl;
// save the document in the current application
TCollection_ExtendedString status;
m_App->SaveAs(myOcafDoc,TPath,status);
cout<

Umar Said's picture

I use your code but the same error still occurs. I think it is not about the code or Resources file. As you can see, before saving, plugin must be loaded. That's the point where my program failed, as seen on console output above.

.so: cannot open shared object file: No such file or directory

In fact, when I check with IsDriverLoaded(), the driver is not loaded. This is before calling to SaveAs(myDoc,TPath,status). So when I call SaveAs while the driver not loaded, the program exit. I suspect this is caused by wrong Plugin file or environment variables. Could you send me your Plugin file and environment variables?

Thank you very much.

Torsten Sadowski's picture

Hallo Said,

This is my Plugin file:

! Description of available plugins
! ********************************
!
a148e300-5740-11d1-a904-080036aaa103.Location: FWOSPlugin
!
! standard attribute drivers plugin
!
ad696000-5b34-11d1-b5ba-00a0c9064368.Location: StdPlugin
ad696001-5b34-11d1-b5ba-00a0c9064368.Location: StdPlugin
ad696002-5b34-11d1-b5ba-00a0c9064368.Location: StdPlugin
!
! standard attribute drivers plugin
!
bd696000-5b34-11d1-b5ba-00a0c9064368.Location: StdLPlugin
bd696001-5b34-11d1-b5ba-00a0c9064368.Location: StdLPlugin
bd696002-5b34-11d1-b5ba-00a0c9064368.Location: StdLPlugin
!
! XmlOcaf Document Plugin
!
03a56820-8269-11d5-aab2-0050044b1af1.Location: XmlPlugin
03a56822-8269-11d5-aab2-0050044b1af1.Location: XmlPlugin
03a56824-8269-11d5-aab2-0050044b1af1.Location: XmlPlugin
!
! XmlLOcaf Document Plugin
!
13a56820-8269-11d5-aab2-0050044b1af1.Location: XmlLPlugin
13a56822-8269-11d5-aab2-0050044b1af1.Location: XmlLPlugin
13a56824-8269-11d5-aab2-0050044b1af1.Location: XmlLPlugin
!
! BinOcaf Document Plugin
!
03a56835-8269-11d5-aab2-0050044b1af1.Location: BinPlugin
03a56836-8269-11d5-aab2-0050044b1af1.Location: BinPlugin
!
! BinLOcaf Document Plugin
!
13a56835-8269-11d5-aab2-0050044b1af1.Location: BinLPlugin
13a56836-8269-11d5-aab2-0050044b1af1.Location: BinLPlugin
!
! XCAF Document Plugin
!
ed8793f8-3142-11d4-b9b5-0060b0ee281b.Location: XCAFPlugin
ed8793f9-3142-11d4-b9b5-0060b0ee281b.Location: XCAFPlugin
ed8793fa-3142-11d4-b9b5-0060b0ee281b.Location: XCAFPlugin
!
! XmlXCAF Document Plugin
!
f78ff496-a779-11d5-aab4-0050044b1af1.Location: XmlXCAFPlugin
f78ff497-a779-11d5-aab4-0050044b1af1.Location: XmlXCAFPlugin
!
! BinXCAF Document Plugin
!
a78ff496-a779-11d5-aab4-0050044b1af1.Location: BinXCAFPlugin
a78ff497-a779-11d5-aab4-0050044b1af1.Location: BinXCAFPlugin

and this is in TOcaf_Application.cxx:

void TOcaf_Application::Formats(TColStd_SequenceOfExtendedString& Formats)
{
Formats.Append(TCollection_ExtendedString ("Ocaf-Sample"));
Formats.Append(TCollection_ExtendedString ("MDTV-Standard"));
Formats.Append(TCollection_ExtendedString ("Shaft-XML"));
}

//=======================================================================
//function : ResourcesName
//purpose :
//=======================================================================

Standard_CString TOcaf_Application::ResourcesName()
{
return Standard_CString ("Resources");
}

TOcaf_Application::~TOcaf_Application() {}

Standard_EXPORT Handle_Standard_Type& TOcaf_Application_Type_()
{

static Handle_Standard_Type aType1 = STANDARD_TYPE(TDocStd_Application);
if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDocStd_Application);
static Handle_Standard_Type aType2 = STANDARD_TYPE(CDF_Application);
if ( aType2.IsNull()) aType2 = STANDARD_TYPE(CDF_Application);
static Handle_Standard_Type aType3 = STANDARD_TYPE(CDM_Application);
if ( aType3.IsNull()) aType3 = STANDARD_TYPE(CDM_Application);
static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient);
if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient);

static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL};
static Handle_Standard_Type _aType = new Standard_Type("TOcaf_Application",
sizeof(TOcaf_Application),
1,
(Standard_Address)_Ancestors,
(Standard_Address)NULL);

return _aType;
}

There are strange apostrophies in your console output. Is this just a copy Problem or is there a real error?

Torsten

Umar Said's picture

The content of your Plugin file is the same as mine. The only difference is that in my file, new line is marked with OA (CR) while yours with OD OA (CRLF). That's why the console output is 'ey = instead of Key =. That's why the program cannot open it and then not load it.

I don't know where I got that kind of newline. But aside from my carelessness, I think OpenCascade should be more robust by being able to read line regardless what type of newline we use.

Torsten, thank you so much for giving me your file. Now I can continue my experiment with OCAF.