[fpc-pascal] More OS X problems

Jonas Maebe jonas.maebe at elis.ugent.be
Tue Oct 13 22:14:59 CEST 2009


Paul Davidson wrote on Tue, 13 Oct 2009:

> OS X 10.6.1  FPC 2.2.4  Xcode 3.2 (64 bit)
>
> Using code base that has complied correctly since 2004
>
> Fixed $MODE OBJFPC

What exactly did you fix and how? Marco mentioned something about  
duplicate mode switches, but if you want help you really have to be  
more specific.

> 1)  A unit with identical first few lines as several other  
> successfully compiled units gives a 'Identifier not found "class"  
> error.  Following is start of file:
>
> {
>   tccStack.pas
>   corax60
>   Created by Paul Davidson on 2005/01/01.
>   Copyright (c) 2005 Corax Networks.Inc.. All rights reserved.
> }
> unit cStack;
>   {$I Directives.inc}
> interface
> uses
>   SysUtils;
>   type
>     tccStack = class( TObject )   {Barfs here}

It means that the file is not being compiled in Delphi or ObjFPC mode.  
What happens if you add {$mode objfpc} before the {$i Directives.inc}  
statement? Does the compiler then complain about an illegal/duplicate  
mode switch? What are the contents of that Directives.inc file?

Note that the default compilation mode for the Xcode projects is  
MacPas mode (set via the command line options; see the "FPC Xcode  
ReadMe.rtf" on the installer disk image for information about where  
you can see and change these parameters), so if you don't add any  
{$mode xxx} statement, that's what your code will use.

> 2) All .s files give a "Command /Developer/usr/bin/gcc-4.2 failed  
> with exit code 1

How did you create the project? Did you use a template included with  
FPC 2.2.4? (if so, which one) Are the errors for units that are  
actually used by your main program? If not, have you tried following  
the these instructions from the "FPC Xcode ReadMe.rtf" file on the  
installer disk image under point "6. Troubleshooting and FAQs":

***
1) Q: What can I do when getting the following error after building:

powerpc-apple-darwin8-gcc-4.0.1: warning: '-x assembler-with-cpp'  
after last input file has no effect
powerpc-apple-darwin8-gcc-4.0.1: no input files
powerpc-apple-darwin8-gcc-4.0 failed with exit code 1

• A: Short answer: click on the disclosure triangle next to the  
Targets group, then next to the target with the same name as your  
project, and then next to its "Compile Sources" phase. Remove any  
sources from that phase which are not actually used by your program.

Long answer: the projects work in two phases. First, FPC is used to  
compile all sources from Pascal to assembler code. Next, Xcode calls  
gcc to assemble the resulting files, links them together and builds  
the application bundle (Xcode refuses to link if we let FPC directly  
generates object code). If you remove a unit from the uses clause of  
your program, FPC will no longer compile this unit. Subsequently,  
there will be no assembler code for gcc to assemble, and Xcode will  
pass an "empty filename" to gcc, causing the error displayed above.
***


Jonas

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



More information about the fpc-pascal mailing list