Are the gcc build files still needed after section 5.4?

steve crosby steve.crosby at gmail.com
Mon Jun 5 19:17:52 PDT 2006


On 6/6/06, m at de-minimis.co.uk <m at de-minimis.co.uk> wrote:
>
> > Confusion
>
> Re-read the bit about search path for sources.  That's the bit that's not
> in the man.  The syntax is also different between hard and soft links, but
> we won't go into that (yet!).
>

I may have introduced some confusion - hope the following clarifies things.

You seem to be confusing two seperate things about how symlinks work:
1. *where* the symlink file is placed in the filesystem by the ln command
2. *how* the symlink is resolved by the Operating System.

For 1), the type of path you provide the ln command determines *where*
the resulting symlink file is created. For example

cd /
mkdir -p tmp/ln-test
touch /tmp/ln-test/afile

now we have a file in /tmp/ln-test called "afile"

create a link to this file two different ways, using absolute and relative paths

Relative 1:
=======
cd /
ln -s afile tmp/ln-test/bfile

This creates link bfile --> afile in directory /tmp/ln-test

Relative 2:
=======
cd /usr/bin
ln -s afile ../../tmp/ln-test/bfile

This *also* creates link bfile --> afile in directory /tmp/ln-test

Absolute:
=======
cd /
ln -s afile /tmp/ln-test/bfile

This always creates link bfile --> afile in directory /tmp/ln-test,
regardless of your current working directory.

Therefore, the location of the symlink file is determined by the path
you use. If it's a relative path (not starting with a /) then it will
be relative to your current working directory.

For 2) The method used to resolve the symlink by the OS, the choice of
relative and absolute paths is also relavant. For example

/tools/bin/cc --> gcc
/tools/bin/cc --> ../../tools/bin/gcc
/tools/bin/cc --> /tools/bin/gcc

All three of these symlinks point to the *same* file (/tools/bin/gcc).
The relative paths are relative to the *location of the symlink file*,
not your current working directory. If you were to move the first two
symlinks to another directory, they would no longer work (they are
then broken or dangling symlinks) - the thrid example will always work
regardless of *where* the symlink file is. All three will always work
regardless of your current working directory.

The discussion of hard vs soft links is way outside the scope of this
email thread - suffice it to say the two are very different, and have
different rules (both in how they work, and in how they are created).

Hope that clears things up - the man page for ln refers to *where* the
ln command will place the symlink file - I don't think the ln manpage
does (or should) cover how the OS resolves symlinks.

-- 
-- -
Steve Crosby



More information about the lfs-support mailing list