The objective is to construct a rotation matrix defining a Cartesian frame B with respect to frame A. We only know one axis of B. In more details I know the Z-axis of B. Thus, the objective is to get X and Y axes such that the rotation matrix is $^AR_B= (X~ Y ~Z)$.
If we assume the orientation around Z is not constrained, how to get X and Y? One solution would be to solve $X^TZ=0$ and $\|X\|=1$ which leads to a circular solution. But is there not a straight forward manner to get X and Y?