Skip to content

Instantly share code, notes, and snippets.

@gniuk
gniuk / strip_static_lib_with_dup_obj.sh
Last active February 23, 2022 03:11
strip static library with duplicated object file names; strip .a with duplicated .o names
#!/bin/bash
## note: if more than two object files with the same name then you need modify the code.
lib="your_static_lib.a"
origin_lib="origin_${lib}"
mv $lib $origin_lib
dups=$(ar t $origin_lib | sort | uniq -c | sort | grep "^ *2 " | awk '{print $NF}')
mkdir -p output1 output2