In lyx-1.3.5.ebuild there is line local flags="${CFLAGS}" that should be local flags="${CXXFLAGS}" as the program is c++ code. This is important, as selecting wrong flags causes the compilation to fail. I'm using: gcc-3.3.4-r1 CFLAGS="-march=pentium4 -Os -pipe -fomit-frame-pointer" CXXFLAGS="-march=pentium4 -O2 -pipe -fomit-frame-pointer"
I applied the patch to lyx-1.3.5.ebuild. Thanks for the bug report.