Just to emphasize, this bug means that the Prolog programming language is realistically unavailable in all Ubuntu versions since 16.04. The 1.4.5-4.1 build of gprolog has this fundamental crippling bug as reported by the OP - even the most basic Prolog programs will not run - and unfortunately the 1.4.4 make from source also throws up a number of compile errors so it is a specialist job to get that code installed.
Just to emphasize, this bug means that the Prolog programming language is realistically unavailable in all Ubuntu versions since 16.04. The 1.4.5-4.1 build of gprolog has this fundamental crippling bug as reported by the OP - even the most basic Prolog programs will not run - and unfortunately the 1.4.4 make from source also throws up a number of compile errors so it is a specialist job to get that code installed.