The Qibla Compass can give the direction towards "some points on earth" other than north pole, eg : Mecca.
Wikipedia first paragraph, last two lines :
To determine the proper direction, one has to know with some precision both the longitude and latitude of "one's own location" and "those of Mecca, or the city toward which one must face". Once that is determined, the values are applied to a spherical triangle, and the angle from the local meridian to the required direction of Mecca can be determined.
After knowing the :
• longitude and latitude of "one's own location",
• longitude and latitude of "the city toward which one is seeking direction"
Next :
the values are applied to a spherical triangle, and the angle from the local meridian to the required direction of "the city toward which one is seeking direction" can be determined.
The above paragraph doesn't make sense to me, probably because I am a beginner on doing calculation on the surface of sphere.
How shall I get a direction at a point on the surface of earth other than north pole, using a magnetic compass.
The answerer may show me some in between steps. I will try to figure out the rest by myself.

Let the radius of Earth (assumed perfectly spherical) be $r_E$. Attach a coordinate frame to Earth, with its center at the center of Earth, and its $z$ axis passing through the two poles of Earth. And let the $x$ axis pass through the equator at Greenwich longitude. In this coordinate frame the coordinates of points on the surface of Earth are given by
$ P = r_E ( \cos \theta \cos \phi, \cos \theta \sin \phi, \sin \theta ) $
where $\theta$ is the Latitude angle (positive in the northern hemisphere, and negative in the southern hemisphere), and $\phi$ is the Longitude (positive east of Greenwich and negative west of it).
Now suppose we have two points $A$ and $B$ on the surface of Earth whose Latitudes and Longitudes are known, then we can compute their Cartesian coordinates from the above formula. The normal vector to the great circle connecting $A$ with $B$ is along the unit vector
$ U = \dfrac{A \times B}{\| A \times B \|} $
Orthogonalizing the vectors $A$ and $B$, by taking $A$ as a reference, then the orthogonal vector to $A$ lying on this great circle is given by
$ C = U \times A $
Now we can express the parametric equation of the great circle as
$ P(t) = A \cos t + C \sin t $
Note that $P(0) = A $
The tangent vector to the great circle $P(t)$ at $A$ is given by $P'(0)$
$P'(t) = - A \sin t + C \cos t $
Therefore
$P'(0) = C $
To find our directions at point $A$ to point in the direction of $C$, we have to build a local coordinate system as follows
The local North unit vector is given by
$ N = \dfrac{ \partial (\cos \theta \cos \phi, \cos \theta \sin \phi, \sin \theta )}{\partial \theta } = ( -\sin \theta \cos \phi , -\sin \theta \sin \phi, \cos \theta ) $
The local East unit vector is given by
$ E = (- \sin \phi , \cos \phi , 0 ) $
And the radial unit vector is
$ V = E \times N = ( \cos \theta \cos \phi, \cos \theta \sin \phi, \sin \theta) $
Define the rotation matrix corresponding to this local frame as R
$ R = [E , N , V ] $
Then the local unit direction in the basis $R$ is
$ C' = \dfrac{1}{r_E} R^T C $
The $z$ component of $C'$ is zero. And the first and second coordinates of $C'$ determine the components of this unit vector along the East and North directions respectively. The angle $\psi$ from the North (the bearing) is
$ \psi = ATAN2( C'_y , C'_x) $
Example: Let $A$ represent Ottawa, Canada. The latitude is $45.424721^\circ$, and the longitude is $-75.695^\circ $
And let $B$ represent Mecca, Saudi Arabia. The latitude is $21.426388^\circ$ and the longitude is $39.82555^\circ$
With these values the bearing is calculated as
$ \psi = 57.1667^\circ $ (Clock wise from local North).
The following program summarizes these calculations outlined above.