shared library/GNU toolchain linker flag: default link behaviour replacing existing files generates incomplete archive when object files have same basename
ar r to link a static library such that the static library is surprisingly incomplete when the object files in different directories have the same basename, i.e. for c source files
b/xyz.c the corresponding static library contains only one of the object files, since the first one is replaced. GNU-ar appears to look at the object file basenames, only.
Q: How to drop the
r ideally on the command line when calling
cmake ... or is this a bug?
This issue is surfacing for existing projects
cmake unfortunately produces unusable shared libraries for, so renaming source files and diving deep into
cmake scripts should not be an option.