On Tue, 25 Mar 2014, Mattias Gaertner wrote:

Hi,

When I start fpc in a directory containing symlinks the compiler uses
the resolved directory, leading to wrong source file names.
For example:

/tmp/orig/project1.pas
/tmp/link -> /tmp/orig

cd /tmp/link
fpc -vb project1.pas
/tmp/orig/project1.pas(6,5) Error: Identifier not found "w"

Is there a workaround?

No.

For example a way to tell fpc to use the PWD environment
variable?

No.

Because if you do a Chdir('ABC') inside a FPC program, the CWD variable is no 
longer valid.
So it would require us to keep track of what you do. We could hook the Chdir 
and SetDirectory
calls. But that would go wrong at the first direct syscall or library call that changes the current directory.

So, FPC uses a system call to get the correct (resolved) CWD directory. This is the only guaranteed mechanism.

So, the best Lazarus can do is resolve all directories before calling the 
compiler.

Since you brought it up:
IMHO Lazarus must do this resolving anyhow, because now Lazarus does not work at all with symlinks, e.g. to find filenames and resolve packages. Regardless of what the compiler does.

I submitted bugreports on the list about this in the past.

Michael.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to