Open CASCADE, the 3D modelling kernel
3D modeling & numerical simulation

Search the Forums
See All Topics
 

compilation error

compilation error
kentigens 2009/06/19 00:20
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
CC=g++

TARGET=makebottle

OBJS= main.o \
MakeBottle.o \
gtkmmocascade.o

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

OCC_INCLUDES_OLD=-DCSFDB -DNO_CXX_EXCEPTION -DNo_Exception \
-DHAVE_CONFIG_H -DHAVE_WOK_CONFIG_H -DLIN -DLININTEL \
-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/adm/make/TKernel/.libs

OCC_INCLUDES=-DCSFDB \
-DHAVE_CONFIG_H -DHAVE_WOK_CONFIG_H -DLIN -DLININTEL \
-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/adm/make/TKernel/.libs

OCC_LDFLAGS=-L/opt/OpenCASCADE6.3.0/ros/Linux/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

CPPFLAGS= -Wno-deprecated -I./ $(GTK_INCLUDES) $(OCC_INCLUDES)
CFLAGS=$(CPPFLAGS)

LDFLAGS=$(GTK_LDFLAGS) $(OCC_LDFLAGS) $(LIB_OCC)

$(TARGET): $(OBJS)
     $(CC) -o $@ $^ $(LDFLAGS)

.PHONY: clean distclean

clean:
     -rm -f $(OBJS)

distclean:
     -rm -f $(TARGET)

.SUFFIXES: .cpp .o

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



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
Kent
Fernando Ghedin 2009/06/19 04:15
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,
Fernando
kentigens 2009/06/20 01:47
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.
thanks
kentigens 2009/06/20 01:48
and one thing, by the way, does the compilation/installation differ for a 64-bit machine?
Fernando Ghedin 2009/06/24 19:12
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.

Regards,
Fernando
kentigens 2009/06/20 07:05
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"
OS_NAME=`uname`
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;
fi
export PATH
if [ -z "LD_LIBRARY_PATH" ];
then LD_LIBRARY_PATH=$CASROOT/../3rdparty/$OS_NAME/tcltk/lib:$CASROOT/$OS_NAME/lib;
else LD_LIBRARY_PATH=$CASROOT/../3rdparty/$OS_NAME/tcltk/lib:$CASROOT/$OS_NAME/lib:$LD_LIBRARY_PATH;
fi
export LD_LIBRARY_PATH
export CSF_MDTVFontDirectory=$CASROOT/src/FontMFT
export CSF_LANGUAGE=us
export MMGT_CLEAR=1
export CSF_EXCEPTION_PROMPT=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
export TCLLIBPATH=$TCLHOME/lib
if [ $OS_NAME = "SunOS" ]; then
export ITK_LIBRARY=$TCLLIBPATH/itk3.2
export ITCL_LIBRARY=$TCLLIBPATH/itcl3.2
export TIX_LIBRARY=$TCLLIBPATH/tix8.1
export TK_LIBRARY=$TCLLIBPATH/tk8.4
export TCL_LIBRARY=$TCLLIBPATH/tcl8.4;
elif [ $OS_NAME = "Linux" ]; then
export ITK_LIBRARY=$TCLLIBPATH/itk3.2
export ITCL_LIBRARY=$TCLLIBPATH/itcl3.2
if [ -n "TIX_LIBRARY" ];
then TIX_LIBRARY="";
fi
export TIX_LIBRARY
export TK_LIBRARY=$TCLLIBPATH/tk8.4
export TCL_LIBRARY=$TCLLIBPATH/tcl8.4
fi
Hugh Sorby 2009/06/25 00:06
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

/this/is/where/opencascade/is/ros

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.

Hugh.
Kent Zhou 2009/06/25 03:05
Thank you very much , i'll give a try. thanks
Kent Zhou 2009/06/27 15:42
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:
/opt/OpenCASCADE6.3.0/ros/lib

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 2009/06/27 16:39
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 2009/07/24 01:40
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,
Fernando
Nicholas Fette 2013/08/29 22:06
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.
 
 
Latest news
  • OCCT Applications
  • Open CASCADE Technology 6.8.0 is available for download!
  • New features to enhance the development process

  • © OPEN CASCADE 2000 - 2014  |  Search  |  Contacts   |  Site map