Solution (source code)

= Solution
{c}

Use the convention that the <Newtonian gravitational potential> tends to zero at infinity and the <gravitational field> is $-\nabla\phi$. A source element of <mass> $dm$ at <position vector> $\mathbf r'$ contributes $-G\,dm/|\mathbf r-\mathbf r'|$, where $G$ is the <gravitational constant>. For the curve, $dm=\gamma\,ds'$, so
$$
\boxed{\phi(\mathbf r)=-G\gamma\int_C\frac{ds'}{|\mathbf r-\mathbf r'|}.}
$$
Here $ds'$ is <arc length> along the source <curve>; the expression is finite away from it. This normalization fixes the otherwise arbitrary additive constant.