Linking using g++ fails searching for -lstdc++

Posting for future reference, a solution I found was to install g++-multilib. I had the same incompatible problem relating to -lstdc++ on g++ version 4.6.1 On further probing: g++-multilib is a dummy package which installed g++4.6-multilib which in turn installed the appropriate libstdc++.so under the /usr/lib/gcc/x86_64-linux-gnu/4.6/32 folder.

Is there a downside to using -Bsymbolic-functions?

Answering my own question because I just earned a Tumbleweed badge for it… and I found out subsequently But I was wondering whether there is perhaps a finer-grained control over this, like overwriting -Bsymbolic for individual function definitions of a library. Yes, there is the option –dynamic-list which does exactly that Should I be aware … Read more

What’s the difference between `-rpath-link` and `-L`?

Here is a demo, for GNU ld, of the difference between -L and -rpath-link – and for good measure, the difference between -rpath-link and -rpath. foo.c #include <stdio.h> void foo(void) { puts(__func__); } bar.c #include <stdio.h> void bar(void) { puts(__func__); } foobar.c extern void foo(void); extern void bar(void); void foobar(void) { foo(); bar(); } main.c … Read more

CMake: how to produce binaries “as static as possible”

I did some investigation and although I could not find a satisfying solution to the problem, I did find a half-solution. The problem of static builds boils down to 3 things: Building and linking the project’s internal libraries. Pretty simple, one just has to flip the BUILD_SHARED_LIBS switch OFF. Finding static versions of external libraries. … Read more

How to resolve __gcov_init undefined reference issue when linking

Try this approach: Compile the code for which you want to generate the coverage with these options: CFLAGS: -fprofile-arcs -ftest-coverage LFLAGS: -lgcov –coverage If this doesn’t solve the problem, then please provide some information on the structure of your application, i.e. whether its single program or an application involving shared/static libraries etc.