CMake and Static Linking

I’ve managed to solve my problem by using the following: #Dynamic/Shared Libs … #Static start set_target_properties(icarus PROPERTIES LINK_SEARCH_START_STATIC 1) set_target_properties(icarus PROPERTIES LINK_SEARCH_END_STATIC 1) set(CMAKE_FIND_LIBRARY_SUFFIXES “.a”) #Static Libs … #Set Linker flags set(CMAKE_EXE_LINKER_FLAGS “-static-libgcc -static-libstdc++”) This works without passing a -static which creates other big issues, and can essentially mix static and dynamic libraries. As long … Read more

Makefile removes object files for no reason

The files are being removed because make considers them “intermediate”. When make forms a chain of rules to produce a prerequisite, it treats all files created by the intermediate chains as “intermediate” and removes then when the target is created. See Chained Rules in the manual for GNU make. In your case, you can prevent … Read more

make: *** [ ] Error 1 error [duplicate]

From GNU Make error appendix, as you see this is not a Make error but an error coming from gcc. ‘[foo] Error NN’ ‘[foo] signal description’ These errors are not really make errors at all. They mean that a program that make invoked as part of a recipe returned a non-0 error code (‘Error NN’), … Read more

Why gcc 4.1 + gcov reports 100% branch coverage and newer (4.4, 4.6, 4.8) reports 50% for “p = new class;” line?

Solved ! We have some C/C++ files with and without exceptions handling, so lcov/gcov process “exceptions handling” for each code block. Inside a normal block, for example: int main(void) { … … [+ -] printf(“Hello\n”); … } gcov reports that printf line has a “branch coverage” of 50% —> WHY ? Because exceptions handling is … Read more