Compiling under Linux

Forums: 

Hi, I would like to try to compile the exoTK core libraries and exoTKAD under Linux.
What do I have to do?

Thanks.
Paolo.

Stephane Routelous's picture

Hi Paolo,

first, download OpenCASCADE and install it on Linux.
second, download the exoTK sources from sourceforge (http://sourceforge.net/project/showfiles.php?group_id=37373&release_id=8... )
and unzip them in the directory of your choice.

from http://sourceforge.net/project/shownotes.php?group_id=37373&release_id=8... :
Notes: This archive contains the sources of exoTKAD, and of the exoTK library. To compile the library and the programm, you have to download OpenCASCADE from http://www.opencascade.com . To compile and run the DX3DS plugin, you have to download and install lib3ds ( http://sf.net/projects/showfiles.php?group_id=4041 ) To compile and run exoTKAD on Linux, you have to download ans install Qt3.0 ( http://www.trolltech.com/developer/download/qt_x11.html ). To compile and run exoTKAD on Windows, you need to have VisualC++ 6.0 with the lat service pack installed.

download and install the previous libraries.

go in the directory where you unzipped exoTK.
you should be able to launch :
qmake all_qt.pro
It should compile all.

If you have any problem, drop me a line.

Thanks for your interess in exoTK.

walter steffe's picture

Hi Stephane

I have some more problem with linux:

On my system `qmake all_qt.pro` doesn't compile but only produce a Makefile.
So after that I have given a `make` and indeed a lot of compiling has been done.
At the end the command exited with the following message:

.....

make[3]: Leaving directory `/home/walter/EMSIM/exotk/exoTK/plugins/DXBRep'
make[2]: Leaving directory `/home/walter/EMSIM/exotk/exoTK/plugins'
make[1]: Leaving directory `/home/walter/EMSIM/exotk/exoTK'
cd exoTKAD/Qt && qmake -o Makefile
Usage: qmake [mode] [options] [files]

QMake has two modes, one mode for generating project files based on
some heuristics, and the other for generating makefiles. Normally you
shouldn't need to specify a mode, as makefile generation is the default
mode for qmake, but you may use this to test qmake on an existing project

Mode:
-project Put qmake into project file generation mode
In this mode qmake interprets files as files to
be built,
defaults to *.cpp; *.l; *.y; *.ui
-makefile Put qmake into makefile generation mode (default)
In this mode qmake interprets files as project files to
be processed, if skipped qmake will try to find a project
file in your current working directory

Warnings Options:
-Wnone Turn off all warnings
-Wall Turn on all warnings
-Wparser Turn on parser warnings
-Wlogic Turn on logic warnings

Options:
* You can place any variable assignment in options and it will be *
* processed as if it was in [files]. These assignments will be parsed *
* before [files]. *
-o file Write output to file
-unix Run in unix mode
-win32 Run in win32 mode
-macx Run in Mac OS X mode
-d Increase debug level
-t templ Overrides TEMPLATE as templ
-tp prefix Overrides TEMPLATE so that prefix is prefixed into the value
-help This help
-v Version information
-after All variable assignments after this will be
parsed after [files] [makefile mode only]
-cache file Use file as cache [makefile mode only]
-spec spec Use spec as QMAKESPEC [makefile mode only]
-nocache Don't use a cache file [makefile mode only]
-nodepend Don't generate dependencies [makefile mode only]
-nomoc Don't generate moc targets [makefile mode only]
-nopwd Don't look for files in pwd [ project mode only]
-r Recursive search [ project mode only]
make: *** [exoTKAD/Qt/Makefile] Error 154

Walter

Stephane Routelous's picture

Hi Walter,

you can check that the file exoTKAD.pro is in the folder exoTKAD/Qt
If the file is there, you can try to run "qmake exoTKAD.pro"
Which version of Qt do you have ?

Stephane

walter steffe's picture

Thanks for help

I have Qt 3.0.5 (that one included in the last Suse distribution, that is last update of Suse 8.1).

Your advice worked fine for qmake exoTKAD.pro but when I entered another make in the exotk root dir I got a compilation error for exoTKAD_Application.cpp:

.....

/home/walter/EMSIM/OpenCascade/CAS4.0/inc/Standard_Real.hxx:37: warning: `extern' is not at beginning of declaration
/home/walter/EMSIM/OpenCascade/CAS4.0/inc/Standard_Real.hxx:38: warning: `extern' is not at beginning of declaration
In file included from exoTKAD_Application.cpp:43:
exoTKAD_Document.h:61: friend declaration requires class-key, i.e. `friend class exoTKAD_View'
In file included from exoTKAD_LogWidget.h:35,
from exoTKAD_Application.cpp:49:
PJLogWidget.h:49:8: warning: extra tokens at end of #endif directive
make[1]: *** [.obj/exoTKAD_Application.o] Error 1
make[1]: Leaving directory `/home/walter/EMSIM/exotk/exoTKAD/Qt'
make: *** [sub-exoTKAD-Qt] Error 2

walter

Stephane Routelous's picture

Hi Walter.

It seems you don't use the same compile as mine.
Which one are you using ?

in exoTKAD_Document.h line 61 :
replace
friend exoTKAD_View
with
friend class exoTKAD_View

in PJLogWidget.h line 49
replace
#endif !defined (_PJ_LOGWIDGET_H_INCLUDED_)
with
#endif // !defined (_PJ_LOGWIDGET_H_INCLUDED_)

HTH

walter steffe's picture

I have gcc 3.2-39.
I have set QMAKESPEC=linux-g++ and so I am using gcc. An other option was to use icc7.0 which is also installed on my system but I have chosen gcc because OpenCascade is compiled with it. I am not sure that the two can be mixed.

After having made the suggested replacements I have found the need of another similar substitution in exiTKAD_View.h line 54.

Then I have encountered a different error:

../../exoTK/kernel/inc/exotkAIS_GraphicDevice.hxx:121:8: warning: no newline at end of file
In file included from ../../exoTK/kernel/inc/exotkAIS_DisplayManager.hxx:58,
from qexotkoccwidget.cpp:66:
../../exoTK/kernel/inc/exotkAIS_DisplayMode.hxx:54:7: warning: no newline at end of file
qexotkoccwidget.cpp: In member function `void QexotkOCCWidget::DrawRectangle(unsigned int)':
qexotkoccwidget.cpp:518: `min' undeclared (first use this function)
qexotkoccwidget.cpp:518: (Each undeclared identifier is reported only once for each function it appears in.)
qexotkoccwidget.cpp:520: `max' undeclared (first use this function)
make[1]: *** [.obj/qexotkoccwidget.o] Error 1
make[1]: Leaving directory `/home/walter/EMSIM/exotk/exoTKAD/Qt'
make: *** [sub-exoTKAD-Qt] Error 2

Walter

Stephane Routelous's picture

If I remember correctly, I was using gcc2.9.something.
Mainly because I heard of compatibility issues with the newest versions.

I will check later with the new gcc.

About your errors, min and max should be declared in stdlib.h

if not, declare the macros
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define max(a, b) (((a) > (b)) ? (a) : (b))

HTH

walter steffe's picture

It seems to me that the definition of min and max is really needed. I have tried also with Intel icc 7.0 and I got the same complain about min and max. This is the last syntax error given by both compilers but now I am getting a lot of undefined references, many hundreds of them. Just to give a somple look at the following listing:

.........

.obj/main.o(.text+0x24e5): undefined reference to `TCollection_AsciiString::TCollection_AsciiString[in-charge](TCollection_AsciiString const&, TCollection_AsciiString const&)'
.obj/main.o(.text+0x24fb): undefined reference to `TCollection_AsciiString::TCollection_AsciiString[in-charge](char*)'
.obj/main.o(.text+0x2517): undefined reference to `TCollection_AsciiString::TCollection_AsciiString[in-charge](TCollection_AsciiString const&, TCollection_AsciiString const&)'
.obj/main.o(.text+0x252d): undefined reference to `TCollection_AsciiString::TCollection_AsciiString[in-charge](char)'
.obj/main.o(.text+0x2549): undefined reference to `TCollection_AsciiString::TCollection_AsciiString[in-charge](TCollection_AsciiString const&, TCollection_AsciiString const&)'
.obj/main.o(.text+0x2568): undefined reference to `TCollection_AsciiString::TCollection_AsciiString[in-charge](TCollection_AsciiString const&, TCollection_AsciiString const&)'
.obj/main.o(.text+0x2580): undefined reference to `TCollection_AsciiString::Copy(TCollection_AsciiString const&)'
.obj/main.o(.text+0x258e): undefined reference to `TCollection_AsciiString::Destroy()'
.obj/main.o(.text+0x259c): undefined reference to `TCollection_AsciiString::Destroy()'
.obj/main.o(.text+0x25aa): undefined reference to `TCollection_AsciiString::Destroy()'
.obj/main.o(.text+0x25b8): undefined reference to `TCollection_AsciiString::Destroy()'
.obj/main.o(.text+0x25c6): undefined reference to `TCollection_AsciiString::Destroy()'
.obj/main.o(.text+0x25d4): more undefined references to `TCollection_AsciiString::Destroy()' follow
.obj/main.o: In function `ReadSetting(TCollection_AsciiString const&, TCollection_AsciiString const&, TCollection_AsciiString const&, TCollection_AsciiString const&)':
.obj/main.o(.text+0x2672): undefined reference to `TCollection_AsciiString::Copy(TCollection_AsciiString const&)'
.obj/main.o(.text+0x267f): undefined reference to `TCollection_AsciiString::IsEmpty() const'
.obj/main.o(.text+0x269c): undefined reference to `OSD_Environment::OSD_Environment[in-charge](TCollection_AsciiString const&)'
.obj/main.o(.text+0x26b1): undefined reference to `OSD_Environment::Value()'
.obj/main.o(.text+0x26c3): undefined reference to `TCollection_AsciiString::Copy(TCollection_AsciiString const&)'
.obj/main.o(.text+0x26ce): undefined reference to `TCollection_AsciiString::Destroy()'
.obj/main.o(.text+0x26e2): undefined reference to `TCollection_AsciiString::Clear()'
.obj/main.o(.text+0x26ed): undefined reference to `TCollection_AsciiString::Destroy()'
.obj/main.o(.text+0x26f8): undefined reference to `TCollection_AsciiString::Destroy()'
.obj/main.o(.text+0x2706): undefined reference to `TCollection_AsciiString::Destroy()'
.obj/main.o(.text+0x2721): undefined reference to `OSD_Environment::OSD_Environment[in-charge](TCollection_AsciiString const&)'
.obj/main.o(.text+0x2736): undefined reference to `OSD_Environment::Value()'
.obj/main.o(.text+0x2748): undefined reference to `TCollection_AsciiString::Copy(TCollection_AsciiString const&)'
.obj/main.o(.text+0x2753): undefined reference to `TCollection_AsciiString::Destroy()'
.obj/main.o(.text+0x2767): undefined reference to `TCollection_AsciiString::Clear()'
.obj/main.o(.text+0x2772): undefined reference to `TCollection_AsciiString::Destroy()'
.obj/main.o(.text+0x277d): undefined reference to `TCollection_AsciiString::Destroy()'
.obj/main.o(.text+0x278b): undefined reference to `TCollection_AsciiString::Destroy()'
.obj/main.o(.text+0x27a4): undefined reference to `TCollection_AsciiString::Copy(char*)'
.obj/main.o(.text+0x27bc): undefined reference to `TCollection_AsciiString::Clear()'
.obj/main.o(.text+0x27db): undefined reference to `TCollection_AsciiString::Destroy()'
.obj/main.o(.text+0x27e3): undefined reference to `TCollection_AsciiString::Destroy()'
.obj/main.o(.text+0x2832): undefined reference to `TCollection_AsciiString::Destroy()'
.obj/main.o(.text+0x283d): undefined reference to `TCollection_AsciiString::Destroy()'
.obj/main.o(.text+0x2848): undefined reference to `TCollection_AsciiString::Destroy()'
.obj/main.o(.text+0x2856): more undefined references to `TCollection_AsciiString::Destroy()' follow
.obj/main.o: In function `ReadSetting(TCollection_AsciiString const&, TCollection_AsciiString const&, TCollection_AsciiString const&, TCollection_AsciiString const&)':
.obj/main.o(.text+0x2868): undefined reference to `vtable for Standard_Failure'
.obj/main.o(.text+0x2876): undefined reference to `TCollection_AsciiString::Clear()'
.obj/main.o(.text+0x2881): undefined reference to `Standard_Failure::~Standard_Failure [in-charge]()'
.obj/main.o(.text+0x28bd): undefined reference to `Standard_Failure::~Standard_Failure [in-charge]()'
.obj/main.o(.text+0x28d7): undefined reference to `TCollection_AsciiString::Destroy()'
.obj/main.o(.text+0x28e2): undefined reference to `TCollection_AsciiString::Destroy()'
.obj/main.o(.text+0x28ed): undefined reference to `TCollection_AsciiString::Destroy()'
.obj/main.o(.text+0x28fb): undefined reference to `TCollection_AsciiString::Destroy()'

......

walter

Stephane Routelous's picture

For this one, I think the OCC libraries are not found.
Check that TKernel is included in the Makefile.
If it is, check if you have CASROOT defined.

walter steffe's picture

TKernel is included and CASROOT is defined.
The problem is that CASROOT is referenced as $(CASROOT) instead of ${CASROOT}.

The same thing applies to many other variables sparsed in the various Makefiles. May be it is better to make the change in the project files.

Walter

Stephane Routelous's picture

perhaps Trollltech changed qmake, because it worked fine.

Stephane Routelous's picture

perhaps Trollltech changed qmake, because it worked fine.

walter steffe's picture

I am sorry I have said a stupid thing.
$(CASROOT) in the Makefile is ok (I have confused with the sintax of the bash shell).

libTKernel.so is linked for sure because if I remove the $(CASROOT) I get a message saying that the linker is not able to find it.

So I can not understand what is happening.
The long listing of undefined references comes out in the last step: the making of the TARGET = exoTKAD.

Stephane Routelous's picture

For this one, I think the OCC libraries are not found.
Check that TKernel is included in the Makefile.
If it is, check if you have CASROOT defined.

Pawel's picture

test, please delete

Ezhil's picture

i am beginner to occ, while compiling occ QT samples i am getting the following error, please any one help me

Document.h:9:38: AIS_InteractiveContext.hxx: No such file or directory
Document.h:10:26: V3d_Viewer.hxx: No such file or directory
In file included from Application.h:4,
from Application.cxx:1:
Document.h:23: error: `AIS_InteractiveContext' was not declared in this scope
Document.h:23: error: variable declaration is not allowed here
Document.h:23: error: syntax error before `(' token
Document.h:46: error: `V3d_Viewer' was not declared in this scope
Document.h:46: error: variable declaration is not allowed here
Document.h:46: error: syntax error before `(' token
Document.h:57: error: `V3d_Viewer' was not declared in this scope
Document.h:57: error: variable declaration is not allowed here
Document.h:57: error: syntax error before `;' token
Document.h:58: error: `AIS_InteractiveContext' was not declared in this scope
Document.h:58: error: variable declaration is not allowed here
Document.h:58: error: syntax error before `;' token
In file included from Application.cxx:4:
Translate.h:6:38: AIS_InteractiveContext.hxx: No such file or directory
Translate.h:7:41: TopTools_HSequenceOfShape.hxx: No such file or directory
In file included from Application.cxx:4:
Translate.h:21: error: `AIS_InteractiveContext' was not declared in this scope
Translate.h:21: error: syntax error before `&' token
Translate.h:22: error: `AIS_InteractiveContext' was not declared in this scope
Translate.h:22: error: syntax error before `&' token
Translate.h:27: error: `TopTools_HSequenceOfShape' was not declared in this scope
Translate.h:27: error: variable declaration is not allowed here
Translate.h:27: error: syntax error before `(' token
Translate.h:29: error: `TopTools_HSequenceOfShape' was not declared in this scope
Translate.h:29: error: syntax error before `&' token
Translate.h:29: error: `bool Translate::exportModel(...)' and `bool Translate::exportModel(...)' cannot be overloaded
Translate.h:32: error: `TopTools_HSequenceOfShape' was not declared in this scope
Translate.h:32: error: variable declaration is not allowed here
Translate.h:32: error: syntax error before `(' token
Translate.h:34: error: `TopTools_HSequenceOfShape' was not declared in this scope
Translate.h:34: error: variable declaration is not allowed here
Translate.h:34: error: syntax error before `(' token
Translate.h:35: error: `TopTools_HSequenceOfShape' was not declared in this scope
Translate.h:35: error: variable declaration is not allowed here
Translate.h:35: error: syntax error before `(' token
Translate.h:36: error: `TopTools_HSequenceOfShape' was not declared in this scope
Translate.h:36: error: variable declaration is not allowed here
Translate.h:36: error: syntax error before `(' token
Translate.h:37: error: `TopTools_HSequenceOfShape' was not declared in this scope
Translate.h:37: error: variable declaration is not allowed here
Translate.h:37: error: syntax error before `(' token
Translate.h:39: error: `TopTools_HSequenceOfShape' was not declared in this scope
Translate.h:39: error: syntax error before `&' token
Translate.h:40: error: `TopTools_HSequenceOfShape' was not declared in this scope