[lfs-support] ln -sv ../usr/bin/cpp /lib

Alexander Kapshuk alexander.kapshuk at gmail.com
Wed Mar 21 12:54:18 PDT 2012

Here's what I did to build gcc:
(1). Extracted the gcc archive within the $LFS/sources directory;
(2). cd'd into gcc-4.6.2;
(3). Ran the instructions from 6.17.1. Installation of GCC;
(4). Created $LFS/sources/gcc-build and cd'd into it;
(5). Configured and compiled gcc;
(6). While still in $LFS/sources/gcc-build, I ran ln -sv ../usr/bin/cpp 
/lib; And this is where I found it confusing, ../usr/bin/cpp == 
$LFS/sources/usr/bin/cpp; but /usr/bin/cpp isn't found in $LFS/sources. 
It's found is $LFS/usr/bin/cpp; I thought that ln was supposed to create 
a link to an existing file whether using an absolute or a relative path;

I hope I'm making sense here.

Anyway, thanks a lot to all those who responded to my query. I reckon 
it'll make more sense as I progress through the book.

Alexander Kapshuk.

On 03/21/2012 10:07 AM, Simon Geard wrote:
> On Tue, 2012-03-20 at 16:50 +0200, Alexander Kapshuk wrote:
>> So in other words, 'ln -sv ../usr/bin/cpp /lib' and 'ln
>> -sv /usr/bin/cpp /lib' are equivalent?
> Not quite, and the difference can be seen when you look at the link
> *outside* the chroot environment (i.e where the filesystem is mounted
> to /mnt/lfs).
> The /lib directory becomes /mnt/lfs/lib, and so the first link now
> expands to /mnt/lfs/usr/bin/cpp. However, the second link is an absolute
> path, and so still points to /usr/bin/cpp - not to the file it was
> intended to point at.
> Simon.

More information about the lfs-support mailing list