For all issues regarding the Forums use, please, refer to the Forum Rules.

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

Static compiling

varcol's picture

Hello everyone,

please allow me one stupid question. Most recently I nearly finished a bigger project using OCC 5.0, including its Browser etc. Now when I do dynamic linking, it needs a lot of libraries (.so files) being included calling make.
How about makeing a static compilat ? The point is, that my software shall be installed on another computer, where most of the libraries simply just do not exist. But my softweare should run on it.

Does anyone know if static compiling is the solution therefore (I know static compiling is dumb !), any good and quick alternative ?

How to do staic compiling...just put --static before every gcc call in my makefile ?

Best regards and thanks in advance.

Chris

Yu's picture

hi,

Have you solved the problem? I also need to link the static libs of occ to generate my single executable file. would you mind tell me how to do it?

Yu's picture

hi,

Have you solved the problem? I also need to link the static libs of occ to generate my single executable file. would you mind tell me how to do it?

gianni's picture

I use static libraries with Visual Studio 2005 and everything works fine. To create static libraries you have to define the preprocessor symbol HAVE_NO_DLL and of course change the Configuration Type (in the project defaults) to static library.

QbProg's picture

I did it with Visual studio 2009.
I suggest you :
1 - Create a new configuration instead of overriding "Release" and define HAVE_NO_DLL for it.
2- In doing so check the output folders for LIB, intermediate and Obj files, even in the C++ tab since these are explicitly overridden even for Obj files.
3- In debug mode, continue linking to DEBUG version of the libraries. If you want , build a "debug static" configuration, but I don't think it is worth. Using static libraries in debug leads to crashes in the runtime.
4- When adding the static libraries to the project, remember that you have to include many more Libs than in the DLL version, since dependencies of the lib files aren't automatically added.

I have seen a drastic space usage reduction in using static libs.