ClassiCube icon indicating copy to clipboard operation
ClassiCube copied to clipboard

Error when compiling for Linux PowerPC 32-bit

Open Link4Electronics opened this issue 1 month ago • 3 comments

Hello,

When trying to compile on powerpc 32-bit running linux, it fails with multiple errors: undefinied reference to sqrtf Adding -lm to LIBS += fixes that, compiles and works. I dind't make a PR about it because I don't know it it breaks for other linux platforms or not.

Best regards, Link.

Link4Electronics avatar Nov 28 '25 01:11 Link4Electronics

Which compiler are you using? And how specifically are you compiling it?

UnknownShadow200 avatar Nov 29 '25 10:11 UnknownShadow200

GCC 15.2.1 compiling by just tyíng make. It doesn't happen with ppc64. Is this gcc fault, how it was compiled for this platform?

Regards, Link.

Link4Electronics avatar Nov 29 '25 18:11 Link4Electronics

__builtin_sqrtf can resolve to either

  • the sqrtf function in libm
  • native assembly instruction(s) for calculating the square root

In the case of the PowerPC ISA, although there is a fsqrts instruction for calculating the square root, it is only an optional instruction.

So I guess what happens is that the 32 bit compiler assumes it is NOT supported by default, while the 64 bit compiler assumes it is. (Apparently -mpowerpc-gpopt enables assuming that fsqrts is supported)

UnknownShadow200 avatar Dec 01 '25 20:12 UnknownShadow200

b4fdd26946256a1d3327fcd89d70d160986b3f98 changes the makefile so that -lm is always linked, which should resolve this.

UnknownShadow200 avatar Dec 15 '25 10:12 UnknownShadow200