0

I'm preparing to build crypto++ libraries on debian system, although debian repositories provide them via apt-get I want to to do it from source to make sure that the compiled libraries are the latest one and to build with certain options only.

The default makefile is configured to build a static library, release build, and I want to modify makefile for my needs and to add some other stuff there.

Basically I'll use these libraries only for learning, no release programs of any kind, so my question is whether I need release build or debug for learning, also I'm not sure if it's better to build shared or static libraries for learning purposes?

I suppose this question sounds funny but I'm unsure why would I need debug libraries, to debug simple programs? or to debug libraries it self?

codekiddy
  • 5,897
  • 9
  • 50
  • 80
  • When using the debug you'll have more information given by the compiler on errors. –  Jul 03 '14 at 06:27
  • good, and what about shared libraries for learning purposes? – codekiddy Jul 03 '14 at 06:43
  • I think shared are better for release, because their share the code betwin the program using them, and static just copypasta the whole lib into your exe. It's easier for development to use static, because you just have you exe (bigger but not pointing to various shared lib) –  Jul 03 '14 at 07:32
  • This [**metaphore**](http://stackoverflow.com/a/2650053/1585121) is maybe clearer –  Jul 03 '14 at 07:34

1 Answers1

1

Difference between a debug and a release lib is that the debug usually have more internal checks to ensure that you are using the lib correctly, the counterpart is that the lib is also heavier and slower. That's why release build are done with the release lib.

Static linking(Copy): one large exe file, more comfy for development. You move the parts of the librairy you use into your binary.

Dynamic linking(Reference): a small exe file plus one or more .so/.dll files. Your executable use reference to the librairy, so X programs using the same lib only refer to the same instance of the lib. It doesn't duplicate code as static linking does.

  • Thanks, thats exactly what I wanted to know, that .a files are easier to deal with while learning. – codekiddy Jul 03 '14 at 07:49
  • Well it's easier at start, but once you've made the effort to set up correctly your shared librairy (debug/release) it's the same. What matters the most is picking the **debug**/release build of the librairy. –  Jul 03 '14 at 07:59