Am 2019-06-04 05:37, schrieb Bruce Dubbs via lfs-dev:
On 6/3/19 4:04 PM, Thomas Trepl via lfs-dev wrote:
Hi all,

...

Btw, we have statements in gcc echoing a #define
STANDARD_STARTFILE_PREFIX_1 etc. to some files. Couldn't that be
simplified if we change gcc/gcc.c (the STANDARD_STARTFILE_PREFIXes are
defined there)?  I'm going to test that when build is finished...

I'm hesitant to change the working instructions for gcc, but let us
know the results of your testing.

Thats for sure not the worst idea to be a bit defensive in terms of fooling around with one of the most important and complex packages in LFS ;-)

Anyway, i just run ... no, not run but sneak thru the book as i did it manually, not using tools like jhalfs or even my own build machinery - just for having as much control on the instructions as well as on the output they produce. Two things i'd like to bring up:

First, i saw that we're changing a handfull files in gcc adding #undef/#define of the location of the start files. I wondered where the startfiles are defined which we do than undefine and redefine them with a new value. I found the #define is in gcc/gcc.c and modified the instructions in chap5 so they look like

...
for file in gcc/config/{linux,i386/linux{,64}}.h; do
   cp -uv $file{,.orig};
   sed -e 's@/lib\(64\)\?\(32\)\?\(x32\)\?/ld@/tools&@g' \
       -e 's@/usr@/tools@g' $file.orig > $file
   touch $file.orig
done
sed -e "/^#define[[:blank:]]*STANDARD_STARTFILE_PREFIX_1/ s;\".*\";\"/tools/lib/\";" \ -e "/^#define[[:blank:]]*STANDARD_STARTFILE_PREFIX_2/ s;\".*\";\"\";" \
    -i gcc/gcc.c
...

Ok, not much saving in textual amount of the instuctions but it looks to me more straightforward as it now changes the locations where they are defined and we need not to redefine them in many other files while leaving the one which defines the original value untouched.

Secondly, on the journey thru the (SysV-)book i come across eudev. There are instructions like "LD_LIBRARY_PATH=/tools/lib dosomething". I wondered why that? Eudev has been moved to be the very last package in chapter 6 and i think the LD_LIBRARY_PATH-thing is a left-over from the time eudev has been built before core-utils or so. If eudev is the last pkg in chap6 and it still needs something from chap5, then in chap6 must be something missing. But i didn't find a lack. I removed all the references to /tools from eudev and building went fine.

Btw, a VM built with instructions including that patch just booted fine. So for the first look - the patch seems not to damage LFS at all.

Find attached a patch for this two packages.

Ah, and a third thing:  I had to do
  ln -s libncurses.so /tools/lib/libcurses.so
in addition to the ln we allready do in 5.16 because the following bash complained about not finding libcurses (-lcurses). Not sure how that comes...

--
Thomas

Index: chapter05/gcc-pass1.xml
===================================================================
--- chapter05/gcc-pass1.xml	(revision 11613)
+++ chapter05/gcc-pass1.xml	(working copy)
@@ -73,13 +73,11 @@
   cp -uv $file{,.orig}
   sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \
       -e 's@/usr@/tools@g' $file.orig > $file
-  echo '
-#undef STANDARD_STARTFILE_PREFIX_1
-#undef STANDARD_STARTFILE_PREFIX_2
-#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
-#define STANDARD_STARTFILE_PREFIX_2 ""' >> $file
   touch $file.orig
-done</userinput></screen>
+done
+sed -e "/^#define[[:blank:]]*STANDARD_STARTFILE_PREFIX_1/ s;\".*\";\"/tools/lib/\";" \
+    -e "/^#define[[:blank:]]*STANDARD_STARTFILE_PREFIX_2/ s;\".*\";\"\";" \
+    -i gcc/gcc.c</userinput></screen>
 
     <para>In case the above seems hard to follow, let's break it down a bit.
     First we copy the files <filename>gcc/config/linux.h</filename>,
Index: chapter05/gcc-pass2.xml
===================================================================
--- chapter05/gcc-pass2.xml	(revision 11613)
+++ chapter05/gcc-pass2.xml	(working copy)
@@ -75,13 +75,11 @@
   cp -uv $file{,.orig}
   sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&amp;@g' \
       -e 's@/usr@/tools@g' $file.orig &gt; $file
-  echo '
-#undef STANDARD_STARTFILE_PREFIX_1
-#undef STANDARD_STARTFILE_PREFIX_2
-#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
-#define STANDARD_STARTFILE_PREFIX_2 ""' &gt;&gt; $file
   touch $file.orig
-done</userinput></screen>
+done
+sed -e "/^#define[[:blank:]]*STANDARD_STARTFILE_PREFIX_1/ s;\".*\";\"/tools/lib/\";" \
+    -e "/^#define[[:blank:]]*STANDARD_STARTFILE_PREFIX_2/ s;\".*\";\"\";" \
+    -i gcc/gcc.c</userinput></screen>
 
     <para>If building on x86_64, change the default directory name for 64-bit
     libraries to <quote>lib</quote>:</para>
Index: chapter06/eudev.xml
===================================================================
--- chapter06/eudev.xml	(revision 11613)
+++ chapter06/eudev.xml	(working copy)
@@ -49,15 +49,7 @@
 
 <screen><userinput remap="pre">sed -i '/keyboard_lookup_key/d' src/udev/udev-builtin-keyboard.c</userinput></screen>
 -->
-    <para>First, add a workaround to prevent the /tools directory from being 
-    hard coded into Eudev binary files library locations:</para>
 
-<screen><userinput remap="pre">cat &gt; config.cache &lt;&lt; "EOF"
-HAVE_BLKID=1
-BLKID_LIBS="-lblkid"
-BLKID_CFLAGS="-I/tools/include"
-EOF</userinput></screen>
-
 <para>Prepare Eudev for compilation:</para>
 
 <screen><userinput remap="configure">./configure --prefix=/usr           \
@@ -69,19 +61,10 @@
             --with-rootprefix=      \
             --with-rootlibdir=/lib  \
             --enable-manpages       \
-            --disable-static        \
-            --config-cache</userinput></screen>
+            --disable-static</userinput></screen>
 
 <para>Compile the package:</para>
 
-<screen><userinput remap="make">LIBRARY_PATH=/tools/lib make</userinput></screen>
-
-<note><para>The LIBRARY_PATH variable here and the LD_LIBRARY_PATH variable
-below are needed to allow the use of libraries that were installed in /tools,
-but have not yet been installed in the main system.  LIBRARY_PATH is
-used to find libraries during the linking process.  LD_LIBRARY_PATH is
-used to find libraries during program execution.</para></note>
-
 <para>Create some directories now that are needed for tests, but
 will also be used as a part of installation:</para>
 
@@ -90,11 +73,11 @@
 
 <para>To test the results, issue:</para>
 
-<screen><userinput remap="test">make LD_LIBRARY_PATH=/tools/lib check</userinput></screen>
+<screen><userinput remap="test">make check</userinput></screen>
 
     <para>Install the package:</para>
 
-<screen><userinput remap="install">make LD_LIBRARY_PATH=/tools/lib install</userinput></screen>
+<screen><userinput remap="install">make install</userinput></screen>
 
     <para>Install some custom rules and support files useful in an LFS 
     environment:</para>
@@ -123,7 +106,7 @@
     into a binary database <filename>/etc/udev/hwdb.bin</filename>. Create the
     initial database:</para>
 
-<screen><userinput>LD_LIBRARY_PATH=/tools/lib udevadm hwdb --update</userinput></screen>
+<screen><userinput>udevadm hwdb --update</userinput></screen>
 
     <para>This command needs to be run each time the hardware information is
     updated.</para>
-- 
http://lists.linuxfromscratch.org/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to