Apologize in advance if this has been asked before, and if it is very obvious. I'm following the guide pretty literally at this point to get started. The page in question is this:


This point specifies to run this:

patch -Np1 -i ../glibc-2.22-upstream_i386_fix-1.patch

However, doing so seems to return this:

lfs@linux-NVIDIA-nForce-590-SLI /mnt/lfs/tools $ patch -Np1 -i ../glibc-2.22-upstream_i386_fix-1.patch 
can't find file to patch at input line 20
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
|Submitted By:            Bruce Dubbs <bdubbs at linuxfromscratch dot org>
|Date:                    2015-08-23
|Initial Package Version: 2.22
|Upstream Status:         In repository
|Origin:                  https://github.molgen.mpg.de/git-mirror/glibc
|Description:             This patch fixes a build problem on 32-bit systems.
|commit a08e80d1143f6b0386d5bc8cc7b8ed576091dbf3
|Author: Andrew Senkevich <andrew.senkevich@intel.com>
|Date:   Wed Aug 19 16:54:28 2015 +0300
|        [BZ #18796]
|        * scripts/test-installation.pl: Don't add -lmvec to build options if
|        libmvec wasn't built.
|diff --git a/scripts/test-installation.pl b/scripts/test-installation.pl
|index cac1562..79b2b3e 100755
|--- a/scripts/test-installation.pl
|+++ b/scripts/test-installation.pl
File to patch: 

So for starters, for those of you who have followed the guide before, where exactly should the patch be in relation to the file it is patching? From what I've read, it seems it can be anywhere, but is expected to be in the /mnt/lfs/sources directory. What file IS it patching in particular? And what directory should I be in when running this command?

For reference, I have created the directories /mnt/lfs /mnt/lfs/sources /mnt/lfs/tools as asked in the guide, and am running the command from /mnt/lfs/tools, but I'm not sure where I should be that I can reference the file in question with ../ like that.

Currently the patch is in /mnt/lfs/sources and the extracted files for glibc-2.22 are in /mnt/lfs/tools

lfs@linux-NVIDIA-nForce-590-SLI /mnt/lfs $ ls -lah /mnt/lfs/sources/glibc-2.22-upstream_i368_fix-1.patch 
-rw-r--r-- 1 linux linux 1.9K Sep 30 20:23 /mnt/lfs/sources/glibc-2.22-upstream_i368_fix-1.patch

lfs@linux-NVIDIA-nForce-590-SLI /mnt/lfs $ ls -lah /mnt/lfs/tools/glibc-2.22 -ddrwxr-xr-x 68 lfs lfs 4.0K Aug  5 01:42 /mnt/lfs/tools/glibc-2.22

If I'm leaving anything out, please let me know, I'm just beating my head against the wall trying to understand this patch point and how to get it to do what it's supposed to do.


You have to be in the extracted glibc-2.22 directory (hence the .. in the patch path, it assumes the patch is in the upper directory, which in your case would be $LFS).
You're supposed to extract and build within the $LFS/source directory, the $LFS/tools is not meant for that (it's meant to hold the temporary system).

You really need to carefully read Chapter 5.3.


You need to extract glibc tarball first.It has been omitted.

tar -xf glibc-2.22.tar.xz
cd glibc-2.22
patch -Np1 -i ../glibc-2.22-upstream_i386_fix-1.patch

Good luck :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.