Is there a way to compile part of a shader into a spirv?
What you want is generally not possible for OpenGL's SPIR-V support. SPIR-V compiles to shader objects, and shader objects theoretically allow you to link multiple objects of the same stage in a program. However, OpenGL's usage of SPIR-V requires that each SPIR-V shader be a complete shader stage with its entrypoint function.
So the requirement of shaderc mirrors the requirements of OpenGL.
The best you could do is combine multiple SPIR-V binaries into a single binary before handing it off to OpenGL. But that's a non-trivial process, since you basically have to renumber every reference in at least one of them, and combine any references that map to the same type.