[build] automatically figure out libc dir