Linking Problem with OpenCascade

discuss compiling applications for Puppy
Post Reply
Message
Author
emil
Posts: 633
Joined: Tue 10 Nov 2009, 08:36
Location: Austria
Contact:

Linking Problem with OpenCascade

#1 Post by emil »

I want to compile FreeCad (3d Cad program), It uses OpenCascade technology. OpenCascade would actually be quite cool to have, because it is the engine behind lots of 3d projects.
I already have compiled a decent stack of dependencies, nailed out some bugs and applied patches and I think I am 95% through with the built. But I got stuck on something and maybe somebody sees what I don't.

As the last Stage, when all the OpenCascade Libraries were built, it compiles "DRAWEXE". This is a simple 3d drawer/Viewer. I get an error at the final linking stage i.e. I have DRAWEXE.o

the Makefile executes

Code: Select all

g++ -DCSFDB -DOCC_CONVERT_SIGNALS -DLIN -DLININTEL -D_GNU_SOURCE=1 -O2 -o .libs/DRAWEXE DRAWEXE.o  ../TKDraw/.libs/libTKDraw.so -L/usr/lib/tbb -L/usr/lib /initrd/mnt/dev_save/COMPILE/ros/adm/make/TKMesh/.libs/libTKMesh.so /initrd/mnt/dev_save/COMPILE/ros/adm/make/TKHLR/.libs/libTKHLR.so /initrd/mnt/dev_save/COMPILE/ros/adm/make/TKService/.libs/libTKService.so ../TKMesh/.libs/libTKMesh.so ../TKGeomAlgo/.libs/libTKGeomAlgo.so ../TKTopAlgo/.libs/libTKTopAlgo.so ../TKHLR/.libs/libTKHLR.so /initrd/mnt/dev_save/COMPILE/ros/adm/make/TKTopAlgo/.libs/libTKTopAlgo.so /initrd/mnt/dev_save/COMPILE/ros/adm/make/TKGeomAlgo/.libs/libTKGeomAlgo.so /initrd/mnt/dev_save/COMPILE/ros/adm/make/TKBRep/.libs/libTKBRep.so ../TKGeomBase/.libs/libTKGeomBase.so ../TKG2d/.libs/libTKG2d.so ../TKBRep/.libs/libTKBRep.so /initrd/mnt/dev_save/COMPILE/ros/adm/make/TKGeomBase/.libs/libTKGeomBase.so /initrd/mnt/dev_save/COMPILE/ros/adm/make/TKG3d/.libs/libTKG3d.so ../TKMath/.libs/libTKMath.so ../TKG3d/.libs/libTKG3d.so /initrd/mnt/dev_save/COMPILE/ros/adm/make/TKG2d/.libs/libTKG2d.so ../TKernel/.libs/libTKernel.so ../TKService/.libs/libTKService.so /initrd/mnt/dev_save/COMPILE/ros/adm/make/TKMath/.libs/libTKMath.so /initrd/mnt/dev_save/COMPILE/ros/adm/make/TKernel/.libs/libTKernel.so /usr/lib/libstdc++.so -lm -lrt -ltcl8.5 -ltk8.5 -ltbb -ltbbmalloc -lXt /usr/lib/libX11.so /usr/lib/libXau.so /usr/lib/libXdmcp.so -lXmu -ldl -lpthread -Wl,--rpath -Wl,/opt/OpenCascade/lib
which bombs with

Code: Select all

/initrd/mnt/dev_save/COMPILE/ros/adm/make/TKService/.libs/libTKService.so: undefined reference to `fipImage::accessPixels() const'
/initrd/mnt/dev_save/COMPILE/ros/adm/make/TKService/.libs/libTKService.so: undefined reference to `fipImage::convertToType(FREE_IMAGE_TYPE, int)'
/initrd/mnt/dev_save/COMPILE/ros/adm/make/TKService/.libs/libTKService.so: undefined reference to `fipImage::convertTo24Bits()'
/initrd/mnt/dev_save/COMPILE/ros/adm/make/TKService/.libs/libTKService.so: undefined reference to `fipImage::getColorType() const'
/initrd/mnt/dev_save/COMPILE/ros/adm/make/TKService/.libs/libTKService.so: undefined reference to `fipImage::getWidth() const'
/initrd/mnt/dev_save/COMPILE/ros/adm/make/TKService/.libs/libTKService.so: undefined reference to `fipImage::save(char const*, int) const'
/initrd/mnt/dev_save/COMPILE/ros/adm/make/TKService/.libs/libTKService.so: undefined reference to `fipImage::getImageType() const'
/initrd/mnt/dev_save/COMPILE/ros/adm/make/TKService/.libs/libTKService.so: undefined reference to `fipImage::~fipImage()'
/initrd/mnt/dev_save/COMPILE/ros/adm/make/TKService/.libs/libTKService.so: undefined reference to `fipImage::colorQuantize(FREE_IMAGE_QUANTIZE)'
/initrd/mnt/dev_save/COMPILE/ros/adm/make/TKService/.libs/libTKService.so: undefined reference to `fipImage::adjustGamma(double)'
/initrd/mnt/dev_save/COMPILE/ros/adm/make/TKService/.libs/libTKService.so: undefined reference to `fipImage::getHeight() const'
/initrd/mnt/dev_save/COMPILE/ros/adm/make/TKService/.libs/libTKService.so: undefined reference to `FreeImage_GetFIFFromFilename'
/initrd/mnt/dev_save/COMPILE/ros/adm/make/TKService/.libs/libTKService.so: undefined reference to `fipImage::fipImage(fipImage const&)'
/initrd/mnt/dev_save/COMPILE/ros/adm/make/TKService/.libs/libTKService.so: undefined reference to `fipImage::getPixelColor(unsigned int, unsigned int, tagRGBQUAD*) const'
/initrd/mnt/dev_save/COMPILE/ros/adm/make/TKService/.libs/libTKService.so: undefined reference to `fipImage::getScanLine(unsigned short) const'
/initrd/mnt/dev_save/COMPILE/ros/adm/make/TKService/.libs/libTKService.so: undefined reference to `fipImage::operator=(FIBITMAP*)'
/initrd/mnt/dev_save/COMPILE/ros/adm/make/TKService/.libs/libTKService.so: undefined reference to `fipImage::fipImage(FREE_IMAGE_TYPE, unsigned short, unsigned short, unsigned short)'
/initrd/mnt/dev_save/COMPILE/ros/adm/make/TKService/.libs/libTKService.so: undefined reference to `FreeImage_ConvertFromRawBits'
collect2: ld returned 1 exit status
make: *** [DRAWEXE] Error 1
Now it seems It cant find the library functions of the FreeImage library. But I checked that I have this library (in /usr/lib/libfreeimage.so and libfreeimage.a) and I also have FreeImage.h and FreeImagePlus.h (which is a c++ wrapper around FreeImage.h) in /usr/include.

I also checked that the missing functions are present in the header files. So my guess is that it doesn't pick up the library correctly at the linker stage. The Makefile is rather cryptic for my untrained eyes, but I have identified:

Code: Select all

CSF_FreeImagePlus_INCLUDES = -I/usr/include/ #-DHAVE_FREEIMAGE
CSF_FreeImagePlus_LIB = -L/usr/lib -lfreeimage
this goes into

Code: Select all

DRAWEXE_LDADD = ../TKDraw/libTKDraw.la \
../TKMesh/libTKMesh.la \
../TKGeomAlgo/libTKGeomAlgo.la \
../TKTopAlgo/libTKTopAlgo.la \
../TKHLR/libTKHLR.la \
../TKGeomBase/libTKGeomBase.la \
../TKG2d/libTKG2d.la \
../TKBRep/libTKBRep.la \
../TKMath/libTKMath.la \
../TKG3d/libTKG3d.la \
../TKernel/libTKernel.la \
../TKService/libTKService.la \
 $(STLPort_LIB) $(CSF_TclLibs_LIB) $(CSF_TclTkLibs_LIB) $(CSF_gdi32_LIB) $(CSF_advapi32_LIB) $(CSF_user32_LIB) $(CSF_TBB_LIB) $(CSF_SOCKETLibs_LIB) $(CSF_FPELibs_LIB) $(CSF_ThreadLibs_LIB) $(CSF_kernel32_LIB) $(CSF_MotifLibs_LIB) $(CSF_XwLibs_LIB) $(CSF_dpsLibs_LIB) $(CSF_XmuLibs_LIB) $(CSF_FreeImagePlus_LIB)  

and the linking step in the makefile

Code: Select all

CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@


which actually passes the call of the compiler to the script "libtool".

Well, I know I cannot expect to have somebody give me a walkthrough, but I would appreciate any comments on

a) general strategies to solve this and similar problems
b) how can I reduce this problem to a "minimum Non-Working example"
c) Maybe somebody spots something really obvious and I am lucky :D

I am working on a Lupu 511 base. I append the full Makefile just in case.
Thank you in advance
emil

Ibidem
Posts: 549
Joined: Wed 26 May 2010, 03:31
Location: State of Jefferson

#2 Post by Ibidem »

1. It seems you didn't attach the makefile?
2. Looking at the code you showed, it seems there are two things:
a- There should be a \ after EVERY line except the last in the variable DRAWEXE_LDADD
b- grep for DRAWEXE_LDADD -- if it isn't somewhere else, you have a big problem in the makefile.
[/code]

emil
Posts: 633
Joined: Tue 10 Nov 2009, 08:36
Location: Austria
Contact:

#3 Post by emil »

Hi -thanks for respond -
yep I somehow missed the makefile, sorry. I work on something different atm, but I will go back to this. In a PM I got also the hint of the commented option #-DHAVE_FREEIMAGE. Will try those things and give an update, but it will need some weeks I guess.

thanks everybody 8)
emil

emil
Posts: 633
Joined: Tue 10 Nov 2009, 08:36
Location: Austria
Contact:

#4 Post by emil »

Hi -thanks for respond -
yep I somehow missed the makefile, sorry. I work on something different atm, but I will go back to this. In a PM I got also the hint of the commented option #-DHAVE_FREEIMAGE. Will try those things and give an update, but it will need some weeks I guess.

thanks everybody 8)
emil

paulski
Posts: 130
Joined: Fri 06 Oct 2006, 15:30
Location: Cologne, Germany &/or Perth, Australia

#5 Post by paulski »

Hi emil,

Did you ever succeed in getting Freecad to go in Puppy?
I'm trying to use a Ubuntu Lucid build in Lupu Puppy 528.
Working my way through dependencies. Stealing a lot from ubuntu repositories and hoping they will work.

Perhaps you have a pile of pre made libs you are willing to share.

Did you document what you did to get 95% through?

Post Reply