@FangQ:
As indicated by marcov, from your output
Hint: (lazarus) [RunTool] "/usr/local/bin/ppc386" "-iWTOTP" "-Px86_64"
Hint: (lazarus) [RunTool] "/usr/local/bin/ppc386" "-va" "compilertest.pas" "-Px86_64"
Warning: [TPCTargetConfigCache.Update] no unit paths: /usr/local/bin/ppc386 -Px86_64
Warning: [TPCTargetConfigCache.Update] invalid fpc: Compiler="/usr/local/bin/ppc386" Options="-Px86_64" RealCompiler="/usr/local/lib/fpc/3.2.2/ppcx64" missing FPC_FULLVERSION
You can conclude that it is ppc386 that is being used/setup as compiler for Lazarus. The warning "invalid fpc:" is a dead giveaway.
You can check that by starting lazarus IDE then open the menu View/IDE Internals/About FPC which will open a dialog.
In the tab "FPC values used by IDE" you should be able to locate two entries
- "Default CompilerFilename=<your fpc>"
- "Resolved default compilerFilename=<path and filename to your fpc>"
Those should point to your FPC executable/softlink/script (not ppcXXX). Actually the first one should point to your FPC script/link/executable (directories can be lacking) while the second should be the actual fpc
executable as located on your disk (including full directory name).
On the other tab on that dialog "FPC output" you can see if Lazarus is able to correctly locate/compile things. Have a look at it and try to understand what it reads there.
You can change the compiler by menu/Tools/Options which show the "IDE options" dialog. At the first entry environment/file you can set the fpc compiler under "Compiler Executable".
Your current setting probably shows "/usr/local/bin/ppc386" or ppc386.
If that is not the case then the only other thing that currently comes to mind is that you have an environment variable set somewhere that interferes with the "normal" flow for lazarus/lazbuild.
edit: for the IDE options dialog see also
this wiki entry (first picture).