Author: ken
Date: Sat Jan 26 18:38:43 2019
New Revision: 21044

Log:
Rust - strongly recommend using /opt, and explain why.

Modified:
   trunk/BOOK/general/prog/rust.xml
   trunk/BOOK/introduction/welcome/changelog.xml

Modified: trunk/BOOK/general/prog/rust.xml
==============================================================================
--- trunk/BOOK/general/prog/rust.xml    Sat Jan 26 17:49:29 2019        (r21043)
+++ trunk/BOOK/general/prog/rust.xml    Sat Jan 26 18:38:43 2019        (r21044)
@@ -73,19 +73,25 @@
 
     <note>
       <para>
-        When you upgrade to a newer version, the new libraries will have 
various
-        hashes in their names and therefore there will be a mix of versions but
-        only one of each will be usable. A binary distribution would use its
-        package manager to delete all the old <application>rust</application>
-        installation before updating. You may wish to do the same to save 
space.
+        Although BLFS usually installs in <filename
+        class="directory">/usr</filename>, when you later upgrade to a newer
+        version of <application>rust</application> the old libraries in 
<filename
+        class="directory">/usr/lib/rustlib</filename> will remain, with various
+        hashes in their names, but will not be usable and will waste space. The
+        editors recommend placing the files in the <filename
+        class="directory">/opt</filename> directory.  In particular, if you
+        have reason to rebuild with a modified configuration (e.g. using the
+        shipped LLVM after building with shared LLVM, but perhaps also the
+        reverse situation) it it possible for the install to leave a broken
+        <command>cargo</command> program. In such a situation, either remove
+        the existing installation first, or use a different prefix such as
+        /opt/rustc-&rust-version;-build2.
       </para>
 
       <para>
-        One alternative when working with multiple versions or just updating
-        to a new version is to place the files in the 
-        <filename class="directory">/opt</filename> directory.  The 
instructions
-        below provide optional commands to support better control of
-        new package versions or reinstallation of the current version.
+        If you prefer, you can of course change the prefix to <filename
+        class="directory">/usr</filename> and omit the
+        <command>ldconfig</command> and the actions to add rustc to the PATH.
       </para>
     </note>
 
@@ -104,7 +110,7 @@
       <para>
         Rustc defaults to building for ALL supported architectures, using a
         shipped copy of LLVM. In BLFS the build is only for the X86 
architecture.
-        If you intend to develop rust crates, this build may not be good 
+        If you intend to develop rust crates, this build may not be good
         enough for your purposes.
       </para>
       <para>
@@ -187,16 +193,16 @@
     <title>Installation of Rust</title>
 
     <para>
-      If you are going to install into the
-      <filename class="directory">/opt</filename> directory, remove
-      conflicting entries and recreate the required entries. 
+      To install into the
+      <filename class="directory">/opt</filename> directory, remove the symlink
+      and create a new directory (i.e. with a different name if trying a
+      modified build).
       As the <systemitem class="username">root</systemitem> 
       user:
     </para>
 
-<screen role="root"><userinput>rm -rf /opt/rustc /opt/rustc-&rust-version; 
&amp;&amp;
-mkdir /opt/rustc-&rust-version;             &amp;&amp;
-ln -sv rustc-&rust-version; /opt/rustc</userinput></screen>
+<screen role="root"><userinput>mkdir /opt/rustc-&rust-version;             
&amp;&amp;
+ln -svfin rustc-&rust-version; /opt/rustc</userinput></screen>
 
     <note>
       <para>
@@ -339,6 +345,13 @@
     <title>Command Explanations</title>
 
     <para>
+      <command>ln -svfn rustc-&rust-version; /opt/rustc</command>: if this is
+      not the first use of the <filename 
class="directory">/opt/rustc</filename>
+      symlink, overwrite it by forcing, and use the '-n' flag to avoid getting
+      confusing results from e.g. <command>ls -l</command>.
+    </para>
+
+    <para>
       <command>targets = "X86"</command>: this avoids building all the 
available
       linux cross-compilers (Aarch64, MIPS, PowerPC, SystemZ, etc). 
Unfortunately,
       rust insists on installing source files for these below

Modified: trunk/BOOK/introduction/welcome/changelog.xml
==============================================================================
--- trunk/BOOK/introduction/welcome/changelog.xml       Sat Jan 26 17:49:29 
2019        (r21043)
+++ trunk/BOOK/introduction/welcome/changelog.xml       Sat Jan 26 18:38:43 
2019        (r21044)
@@ -45,6 +45,17 @@
       <para>January 24th, 2019</para>
       <itemizedlist>
         <listitem>
+          <para>[ken] - For rust, strongly recommend installing in /opt - this
+          allows multiple versions to be used (fallback, testing a different
+          config, trying a newer version) by merely (re-)running ldconfig after
+          updating the symlink. It also prevents libraries from a previous 
version
+          taking up space in /usr/lib/rustlib/ (previous /opt versions can 
easily
+          be removed). Using a new prefix should also prevent the situation 
where
+          changing the config.toml (e.g. from sys llvm to shipped llvm) builds
+          fine but leaves a broken installation because cargo can no longer 
find
+          the matching versions of the libraries.</para>
+        </listitem>
+        <listitem>
           <para>[ken] - Tweak the details of which rust tests might 
fail.</para>
         </listitem>
         <listitem>
-- 
http://lists.linuxfromscratch.org/listinfo/blfs-book
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to