Our Solutions

Need professional assistance?
Consider our:

Support Offerings


Need to speed up your development?
Have a look at our:

Samples & Tools


Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

compilation error

Kent Zhou's picture

Im using linux 8.04 right at the moment.
I've just got OCC installed without any error messages yesterday, which i think its a successful installtion?
and when i was trying to run one of the examples, i can successfully make it. but when i was trying to run it, the following error messages poped up:

./makebottle: error while loading shared libraries: libTKernel.so.0: cannot open shared object file: No such file or directory

and heres my Makefile, don't know if it helps


OBJS= main.o \
MakeBottle.o \

GTK_INCLUDES=`pkg-config gtkmm-2.4 gtkglextmm-1.2 --cflags `
GTK_LDFLAGS=`pkg-config gtkmm-2.4 gtkglextmm-1.2 --libs`

-I/opt/OpenCASCADE6.3.0/ros/inc \
-I/opt/OpenCASCADE6.3.0/ros/src/WOKTclLib \
-I/opt/OpenCASCADE6.3.0/ros/lib \

-I/opt/OpenCASCADE6.3.0/ros/inc \
-I/opt/OpenCASCADE6.3.0/ros/src/WOKTclLib \
-I/opt/OpenCASCADE6.3.0/ros/lib \


LIB_OCC= -lTKernel -lTKMath -lTKG2d -lTKG3d -lTKGeomBase -lTKBRep -lTKGeomAlgo -lTKTopAlgo \
-lTKPrim -lTKBool -lTKFeat -lTKFillet -lTKOffset -lTKHLR \
-lTKService -lTKV2d -lTKV3d -lTKPCAF -lTKCDF -lTKCAF \
-lPTKernel -lTKIGES -lTKSTEP -lTKSTL -lTKVRML -lTKShHealing \
-lTKXSBase -lTKPShape -lTKShapeSchema -lTKOpenGl -lTKBO \
-lTKBool -lTKTopAlgo -lTKPrim -lTKOffset -lTKFillet -lTKBO



$(CC) -o $@ $^ $(LDFLAGS)

.PHONY: clean distclean

-rm -f $(OBJS)

-rm -f $(TARGET)

.SUFFIXES: .cpp .o

.cpp.o: $(CC) $(CPPFLAGS) -c $

main.o : main.cpp gtkmmocascade.h
MakeBottle.o : MakeBottle.cpp
gtkmmocascade.o : gtkmmocascade.cpp gtkmmocascade.h

The last two lines under OCC_INCLUDES and OCC_INCLUDES_OLD were added by me because that where libTKernel.so.0 is located (used command locate libTKernel), but the same error message was given.
Anyone who would be kind enough to tell me what is wrong with my OCC?
thank you

Fernando Ghedin's picture

Hi kentigens,

It seems that you do not have all the necessary environment variables set. They can be defined through the script under your OpenCASCADE's root directory (it's called "env.ksh" - or something like that).

But you can also try the following:
export LD_LIBRARY_PATH=/opt/OpenCASCADE6.3.0/ros/Linux/lib:$LD_LIBRARY_PATH

After typing the command above, try to run your example again.

Hope it helps.

Best regards,

Kent Zhou's picture

Thanks a lot for replying, i'll try to recompile and see what happens.
I got a few warning messages during compilation, not sure if it affects anythying:

checking X11/extensions/transovl.h usability... no
checking X11/extensions/transovl.h presence... no
checking for X11/extensions/transovl.h... no
checking X11/extensions/readdisplay.h usability... no
checking X11/extensions/readdisplay.h presence... no
checking for X11/extensions/readdisplay.h... no
checking X11/extensions/multibuf.h usability... no
checking X11/extensions/multibuf.h presence... yes
configure: WARNING: X11/extensions/multibuf.h: present but cannot be compiled
configure: WARNING: X11/extensions/multibuf.h: check for missing prerequisite headers?
configure: WARNING: X11/extensions/multibuf.h: see the Autoconf documentation
configure: WARNING: X11/extensions/multibuf.h: section "Present But Cannot Be Compiled"
configure: WARNING: X11/extensions/multibuf.h: proceeding with the preprocessor's result
configure: WARNING: X11/extensions/multibuf.h: in the future, the compiler will take precedence

and when the makefile was created, warning messages came up again, almost everyline for the makefile section. Im just pasting the first several lines as follows:

configure: creating ./config.status
config.status: creating Makefile
config.status: creating adm/make/Makefile
config.status: WARNING: adm/make/Makefile.in seems to ignore the --datarootdir setting
config.status: creating adm/make/TKernel/Makefile
config.status: WARNING: adm/make/TKernel/Makefile.in seems to ignore the --datarootdir setting
config.status: creating adm/make/TKMath/Makefile
config.status: WARNING: adm/make/TKMath/Makefile.in seems to ignore the --datarootdir setting
config.status: creating adm/make/TKAdvTools/Makefile
config.status: WARNING: adm/make/TKAdvTools/Makefile.in seems to ignore the --datarootdir setting

etc, don't know if those two things actually affects the installation.

Kent Zhou's picture

and one thing, by the way, does the compilation/installation differ for a 64-bit machine?

Fernando Ghedin's picture

Hello kentigens,

Yes, it is different for 64-bit Machines. For 32-bit machines you do not need to compile anything, since the shared objects are already there for you.

In order to learn how to compile for 64-bit you should look to the documentation (OpenCASCADE6.2.0/doc/whnjs.htm => Click at Welcome / Building Modules / Building on 64-bit platforms).

You can also try to check the options of the script $CASROOT/configure, like this: cd $CASROOT && ./configure --help

I'm quite sure there's more information on the forum already, but if you still have problems, please post your doubts again.


Kent Zhou's picture

Hmm...I've just tried and it doesn't work,
Heres my env.ksh, don't konw if it helps

#!/bin/ksh -f

export CASROOT="Open CASCADE location/ros"
if [ -z "PATH" ];
then PATH=$CASROOT/../3rdparty/$OS_NAME/tcltk/bin:$CASROOT/$OS_NAME/bin;
else PATH=$CASROOT/../3rdparty/$OS_NAME/tcltk/bin:$CASROOT/$OS_NAME/bin:$PATH;
export PATH
if [ -z "LD_LIBRARY_PATH" ];
then LD_LIBRARY_PATH=$CASROOT/../3rdparty/$OS_NAME/tcltk/lib:$CASROOT/$OS_NAME/lib;
export CSF_MDTVFontDirectory=$CASROOT/src/FontMFT
export CSF_LANGUAGE=us
export MMGT_CLEAR=1
export CSF_SHMessage=$CASROOT/src/SHMessage
export CSF_MDTVTexturesDirectory=$CASROOT/src/Textures
export CSF_XSMessage=$CASROOT/src/XSMessage
export CSF_StandardDefaults=$CASROOT/src/StdResource
export CSF_PluginDefaults=$CASROOT/src/StdResource
export CSF_XCAFDefaults=$CASROOT/src/StdResource
export CSF_StandardLiteDefaults=$CASROOT/src/StdResource
export CSF_GraphicShr=$CASROOT/$OS_NAME/lib/libTKOpenGl.so
export CSF_UnitsLexicon=$CASROOT/src/UnitsAPI/Lexi_Expr.dat
export CSF_UnitsDefinition=$CASROOT/src/UnitsAPI/Units.dat
export CSF_IGESDefaults=$CASROOT/src/XSTEPResource
export CSF_STEPDefaults=$CASROOT/src/XSTEPResource
export CSF_XmlOcafResource=$CASROOT/src/XmlOcafResource

export TCLHOME=$CASROOT/../3rdparty/$OS_NAME/tcltk
if [ $OS_NAME = "SunOS" ]; then
elif [ $OS_NAME = "Linux" ]; then
if [ -n "TIX_LIBRARY" ];
then TIX_LIBRARY="";

Hugh Sorby's picture

Please tell me you changed this line

export CASROOT="Open CASCADE location/ros" (3rd from the top)

To where your opencascade actually is. Something like this


which is the absolute path to your opencascade.

Also to repeat Fernando you just need to set your LD_LIBRARY_PATH to

export LD_LIBRARY_PATH=/where/your/opencascade/libraries/are/installed/lib

This will solve your original problem as it simply couldn't locate the opencascade shared objects on your library path. No need to recompile anything.

I really hope this helps.


Kent Zhou's picture

Thank you very much , i'll give a try. thanks

Kent Zhou's picture

Sorry to bother again. i know this is a dummie question, but where do you put the "export LD_LIBRARY_PATH=/opt/OpenCASCADE6.3.0/ros/lib" as thats where my libraries were installed.

By the way, i have the following messages shown in terminal when doing make install for occ:

Libraries have been installed in:

If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the '-LLIBDIR' flag during linking and do at least one of the following:
-add LIBDIR to the 'LD_LIBRARY_PATH' enviroment variable during execution
-add LIBDIR to the 'LD_RUN_PATH' enviroment variable during linking
-use the '-Wl, --rpath -Wl, LIBDIR' linker flag
-have your system adminstrator add LIBDIR to '/etc/ld.so.conf'

See any operating system documentation about shared libraries for mroe information, such as the ld(1) and ld.so(8) manual pages.

Will any of the above solve my problem?
cuz i've changed the open cascade directory in the third line in env.ksh and tried to type "export LD_LIBRARY_PATH=/opt/OpenCASCADE6.3.0/ros/lib" in terminal but the same error message is still presented.
Anything i've done wrong?
Thank you, Kent

Kent Zhou's picture

Sorry, my mistake. it just worked, but i have to manually type:
export LD_LIBRARY_PATH="/opt/OpenCASCADE6.3.0/ros/lib"
everytime im trying to run the ./
is there any other ways which i dont have to do this, cuz my mate didn't have any of this stuff.
and also, I have Segmentation fault when im running the first example.
The second example gives me error:
terminate called after throwing an instance of 'Aspect_GraphicDeviceDefinitionError'
You have not defined CSF_GraphicShr or CASROOT, aborting...Aborted

Thank you, Kent

Fernando Ghedin's picture

Hello Kent,

In fact, the line "export LD_LIBRARY_PATH=..." is a command that should be executed at a console. I'm not sure if this is really the best option, but you can edit the file:

~/.bashrc ( the "~/" => will give the path to your home dir.)

.. with your prefered text editor and add the following line to the end of this file:

export LD_LIBRARY_PATH="/opt/OpenCASCADE6.3.0/ros/lib"

`CSF_GraphicShr' is another environment variable that should be defined, as you can see at the Manual. If you do the same thing with the other variables (as explained on previous post), the example must work.

Good luck! ;-)

Best regards,

Nicholas Fette's picture

Thanks for this thread, it has helped me finally compile sample code from samples/qt/Tutorial. With this project what worked for me was:
1. edit custom.sh (comes with the sample) to put the CASROOT and QTDIR paths (I have /usr/local/occt-6.6.0 and /usr/local/Trolltech/Qt-4.8.5)
2. export LD_LIBRARY_PATH=/usr/local/occt-6.6.0/lib (on command line, or could put in custom.sh)
3. source make.sh
I had been doing in order #3 then #2, and manually add -L/usr/local/occt-6.6.0/lib to LFLAGS in the Makefile generated by qmake, and then make. But doing #2 first causes those steps to happen automatically and seems to resolve some resources in executing as well.