SDL fails with certain CFLAGS or fails to detect correct machine Arch
|Reported by:||Owned by:|
This is a hard bug to reproduce. as I have only come across this after building a lot of LFS machines on different hardware
The problem I have come across on SDL 1.2.6 is that on a lot of platforms setting the gcc CFLAGS/CXXFLAGS with an -Ox optimisation causes failure, and not specifying any CFLAGS/CXXFLAGS causes the configure script to set -O2 which again causes it to fail. After much playing I came to the following conclusion optimisation on this package is not good, probably down to the ammount of use of nasm. The reason the optimisation appears to be failing is because if you don't set a -march=$your_cpu or other options that correctly identify your cpu the configure script does not always get it right. I don't know what causes the configure script to get it wrong but on one machine it set my pentium 3 to a pentiumpro and my Opteron to an AMD64. I've seen it have a few messy calls on the UltraSparc CPU also.
The only way I can get around this is to set my CFLAGS/CXXFLAGS to -march-cpu and leave it at that, this way the CPU is correctly identified and the configure script cannot force -O2 on the end, and you have not set any -Ox problems
This does appear a rare occurance in the SDL package, however it may be worth mentioning in the book to set your compile options to force the CPU type - and the CPU type alone, nothing else.
The error caused by this problem is normally some variation on
SDL_RLEaccel.c:845: error: invalid `asm': invalid expression as operand