root user can't create a file in /usr/lib

/usr/lib is protected by SIP. Even if this wouldn't be the case, it's not the best idea to put your own stuff there as any system upgrade can wipe it.

The better place to store such stuff (or link to it) is /usr/local/lib. You may need to pass appropriate flags to the linker then (or you point it directly to the Cellar folder).