Guide to compilation of make bottle tutorial in Linux (Ubuntu 12.10)

Since i had a lot of problems in compilation of bottle tutorial, i sent this guide.

1) Make a new directory such as "BottleTutorial"
2) Copy the attached bottle.pro into it.
3) Copy the tutorial files in a subdirectory named "src". The file names are:
ApplicationCommon.cxx
ApplicationCommon.h
ApplicationTut.cxx
ApplicationTut.h
Common-icon.ts
CommonSample.h
Common-string.ts
DocumentCommon.cxx
DocumentCommon.h
DocumentTut.cxx
DocumentTut.h
Main.cxx
MakeBottle.cxx
Material.cxx
Material.h
MDIWindow.cxx
MDIWindow.h
Transparency.cxx
Transparency.h
Tutorial-icon.ts
Tutorial-string.ts
View.cxx
View.h

4) Add the include and library path for openCascade in the attached bottle.pro file and store it in the "BottleTutorial" directory
5) run "qmake bottle.pro" command.
6) run "make" to build the tutorial.

Have fun.

Thanks to Benjamin Bihler.
http://www.opencascade.org/org/forum/thread_24543/?forum=5

Attachments: 
Thomas Kramer's picture

I am working in ubuntu linux. I wanted to compile the tutorial code as given in opencascade-7.1.0/doc/pdf/occt_tutorial.pdf. The code in the HTML version is identical, That code defines the MakeBottle.cxx function but has no main function. The tutorial document says nothing about graphics and says nothing about how to compile. I copied opencascade-7.1.0/samples/qt/Tutorial/src/MakeBottle.cxx into the attached file tutorial.cc. I changed the formatting (white space only), added a line including stdio.h and added a main function at the end. The main function calls MakeBottle with the parameter values suggested in the documentation and then prints a message saying it did that. Then I wrote a Makefile that uses the minimum set of libraries necessary to compile tutorial.cc.

If you:

- make sure CASROOT is defined in your environment and points to the OpenCascade installation directory

- put the two attached files (tutorial.cc and Makefile.txt) into a clean directory, and change the name of Makefile.txt to Makefile

- edit the definition of GNUROOT in the Makefile as necessary,

- make sure your LD_LIBRARY_PATH includes the OpenCascade library directory

- and give the command "make tutorial" from the directory into which you put the two files,

you should get an executable tutorial. When you run the tutorial (by giving the ./tutorial command) it should print

ran MakeBottle(50, 80, 30)

I think this is as simple as the compiling process can be for the tutorial.

Attachments: 
joseph.rewald_157667's picture

Hey it worked. Thanks a billion! 

Thomas Kramer's picture

Apparently the Makefile.txt file did not upload successfully. Here it is.

Attachments: 
justin.l.rittenhouse_142827's picture

I'm getting an error when running the bottle example.

When I leave "OCLIBS = -L$(CASROOT)/lib" as in the Makefile. It compiles fine, but when I run ./tutorial I get:

Segmentation fault (core dumped)

Just in case this mean something to someone, I ran strace -e trace=open ./tutorial and got:

--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x16} ---
+++ killed by SIGSEGV (core dumped) +++
Segmentation fault (core dumped)

_________________________

when I change to "OCLIBS = -L$(CASROOT)/lib" to "OCLIBS = -L$(CASROOT)/lin64/gcc/lib":

I get: (when trying to compile) 

error: tutorial.o: No such file or directory

Makefile:22: recipe for target 'tutorial' failed
make: *** [tutorial] Error 1

Note this is on opencascade-6.9.1, using ubuntu 18.04. Also, it should be "OCLIBS = -L$(CASROOT)/lin64/gcc/lib" for 6.9.1, corrent?

FYI, echo $CASROOT

/usr/local/completeChrono/opencascade-6.9.1/occtInstall