If we take "write the specification of how to approach the problem" at literal value, you might be narrowly thinking of a low-level compiler, or what sometimes gets called a transpiler? However, compilers encompass a much wider spectrum than that. Generally they enable users to operate at higher levels of abstraction.
Even so, I'd argue that you still have to define how to use those abstractions rather than only the result you'd like to achieve with them. Sure, maybe the abstraction has a ".achieve_the_result()" method, and calling that method is how you achieve it, but often there's a bunch of stuff you fit together to achieve a solution to your problem and the compiler doesn't necessarily do that for you.
I think there actually may be some compilers that get closer to this, for example some problems can be expressed quite elegantly in Haskell or APL and the compiler will do a lot of black magic behind the scenes to get you a performant executable (somehow). But for most traditional compilers you are still going to have to define how to approach your problem, even if only at a higher level thanks to libraries.