From 0e01e1b68900b2345af59cce5a41144ca4e1ef7c Mon Sep 17 00:00:00 2001 From: Zeckmathederg Date: Wed, 17 Apr 2024 09:03:42 -0600 Subject: [PATCH] Created rough version of Multilib chapter and modified precursor parts --- index.xml | 1 + introduction/welcome/important.xml | 137 +++++++++++++++++++++++++++++ introduction/welcome/welcome.xml | 1 + multilib/achievingml.xml | 46 ++++++++++ multilib/coveringml.xml | 24 +++++ multilib/multilib.xml | 15 ++++ multilib/needml.xml | 90 +++++++++++++++++++ multilib/pkgconf.xml | 99 +++++++++++++++++++++ multilib/whatisml.xml | 64 ++++++++++++++ steam/intro.xml | 15 ++++ wine/intro.xml | 15 ++++ 11 files changed, 507 insertions(+) create mode 100644 introduction/welcome/important.xml create mode 100644 multilib/achievingml.xml create mode 100644 multilib/coveringml.xml create mode 100644 multilib/needml.xml create mode 100644 multilib/pkgconf.xml create mode 100644 multilib/whatisml.xml diff --git a/index.xml b/index.xml index 9698c0d729..8b1dd1bd3d 100644 --- a/index.xml +++ b/index.xml @@ -15,6 +15,7 @@ $Date$ + diff --git a/introduction/welcome/important.xml b/introduction/welcome/important.xml new file mode 100644 index 0000000000..2571472d67 --- /dev/null +++ b/introduction/welcome/important.xml @@ -0,0 +1,137 @@ + + + %general-entities; +]> + + + + + Important Information + + + BLFS has more information regarding compilation, /usr vs /usr/local, + boot scripts, etc. at + . + Unlike this book, this would be a chapter in BLFS. + A lot of that information has been omitted as this book is more linear + and doesn't follow how BLFS follows. However, we will cover some bases + here. + + + + + Building software + + + Building software on BLFS-Next is identical to how it's done in the + BLFS books, along with having lib32 compilation instructions. It + goes without saying firstmost that you should have MAKEFLAGS + set to save yourself a lot of time. This is useful for the make + utility to use the amount of threads that you both want + and have. + + + export MAKEFLAGS='-jx' + + + Replace with the amount of threads you have. + You can check the amount of threads you have with: + + + grep processor /proc/cpuinfo + + + Make sure that you have enough RAM for your system! + A general method is having 2.5G per thread that is thrown at + make. For instance, if you want to use 6 threads, + multiply 6 by 2.5 (which is 15), then make sure you have 15G of RAM. + If you don't have that RAM, try and limit the threads you throw at + make. + + + + Next is compiling for 32-bit. There are many packages which will have + a lib32 counterpart. If you just got done with a normal compilation + of a package and wish to do a 32-bit compilation of that same package, + make sure to clean the directory first: + + + make distclean + + Or, if you made a build directory: + + rm -rf build + + Then proceed with the 32-bit compilation instructions. + + + Generally, the format of targetting 32-bit goes like this: + + + For ./configure: +CC="gcc -m32" CXX="g++ -m32" PKG_CONFIG_PATH=/usr/lib32/pkgconfig \ + ./configure --prefix=/usr --libdir=/usr/lib32 \ + --host=i686-pc-linux-gnu +make + +make DESTDIR=$PWD/DESTDIR install +cp -vr DESTDIR/usr/lib32/* /usr/lib32 +rm -rf DESTDIR +ldconfig + + + For meson: +mkdir -v build +cd build + +CC="gcc -m32" CXX="g++ -m32" PKG_CONFIG_PATH=/usr/lib32/pkgconfig \ + meson setup .. --prefix=/usr --libdir=/usr/lib32 +ninja + +DESTDIR=$PWD/DESTDIR ninja install +cp -vr DESTDIR/usr/lib32/* /usr/lib32 +rm -rf DESTDIR +ldconfig + + For cmake: +export CFLAGS="-m32" +export CXXFLAGS="-m32" +export ASFLAGS="--32" +export PKG_CONFIG_PATH="/usr/lib32/pkgconfig" + +mkdir -v build +cd build + +cmake .. -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_INSTALL_LIBDIR=lib32 +make + +make DESTDIR=$PWD/DESTDIR install +cp -vr DESTDIR/usr/lib32/* /usr/lib32 +rm -rf DESTDIR +ldconfig +unset CFLAGS CXXFLAGS ASFLAGS PKG_CONFIG_PATH + + + + After you do a DESTDIR installation, it is recommended to + to use file on one of the libraries in + DESTDIR/usr/lib32. An output of such + a command for a 32-bit build of a library should be + comparable to the following: + + + ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked + + + Note the 32-bit LSB shared object part. + A 64-bit library would show as a 64-bit LSB shared + object. + + + + + + diff --git a/introduction/welcome/welcome.xml b/introduction/welcome/welcome.xml index b0017e1123..b66a112533 100644 --- a/introduction/welcome/welcome.xml +++ b/introduction/welcome/welcome.xml @@ -34,5 +34,6 @@ + diff --git a/multilib/achievingml.xml b/multilib/achievingml.xml new file mode 100644 index 0000000000..b633874cde --- /dev/null +++ b/multilib/achievingml.xml @@ -0,0 +1,46 @@ + + + %general-entities; +]> + + + + + + Achieving Multilib + + + On many distros, getting multilib support is very straight + forward. There exists a guide that can act as a replacement + for LFS: compiling and configuring a system that can boot, + run, and compile software; and also have that same ability + with 32-bit. It acts to form the basis that will allow you + to follow any of the instructions laid out in the Steam + and Wine chapters. + + + + Such a guide is maintained by Thomas Trepl at + . + It is very comprehensive and also covers how to get x32-bit + support, a format that is 32-bit with bigger registers. Such + a format is unnecessary. Most applications that is covered here + either don't: support it, require it, or is simply not necessary + to compile for, for any sort of interest. Therefore, any mention + of x32-bit, x32, mx32, and x32-bit instructions can be skipped. + Most users will not need it and the extra support in the compilers + and libraries on the system will serve as dead weight, taking up + disk space. + + + + The same principles of compiling for 32-bit in that book will also + apply to this book as well. If you haven't already, read + + to check what basic principles still apply in this book when targeting + 32-bit. + + + diff --git a/multilib/coveringml.xml b/multilib/coveringml.xml new file mode 100644 index 0000000000..ef4ac44c56 --- /dev/null +++ b/multilib/coveringml.xml @@ -0,0 +1,24 @@ + + + %general-entities; +]> + + + + + Covering Multilib + + + In this chapter, we cover multilib, from explaining what it is, + if you need it, and how to get multilib support. Please do not + skip this chapter and read through most of it carefully. + + + + + + + + diff --git a/multilib/multilib.xml b/multilib/multilib.xml index e69de29bb2..27b8a2d814 100644 --- a/multilib/multilib.xml +++ b/multilib/multilib.xml @@ -0,0 +1,15 @@ + + + %general-entities; +]> + + + + + Multilib + + + + diff --git a/multilib/needml.xml b/multilib/needml.xml new file mode 100644 index 0000000000..5d02038429 --- /dev/null +++ b/multilib/needml.xml @@ -0,0 +1,90 @@ + + + %general-entities; +]> + + + + + + Do I Need Multilib? + + + If you have a CPU that is capable of multilib, it is time + to decide whether to go for it or not. Depending on the + circumstance, it may be necessary to go for it. + + + + Steam + + + Most gamers would not know this unless they push the + limits of the game they play, but many games on Steam + are 32-bit. Some games are no longer receiving updates + while some are still being updated but are still 32-bit + to this day. A good example of this is Geometry Dash, + the developer of GD, RobTop, made plans to switch to + 64-bit, but that hasn't come to fruition yet, and thus + leads to many issues such as online levels having too + many objects that require a big amount of RAM but the + 32-bit application can't use that much RAM, which + results in a crash. + + + + Not only are a lot of games 32-bit, but Steam itself + requires that you have 32-bit libraries. If the 32-bit + libraries aren't on the system, Steam will quit, saying + it needs a library, libc.so.6 being the most common + example. So if you have a 64-bit CPU, you will need the + ability to execute 32-bit applications as well as all the + libraries necessary which is laid out in Chapter 3. + + + + If you have a 32-bit CPU, you can skip the 32-bit libraries + and compile everything normally as they will build for your + architecture. + + + + + Steam will eventually kill off 32-bit CPU support so be wary + that while you can run Steam with a 32-bit CPU, in the future + perhaps sometime soon, you will no longer be able to do this. + + + + + + + Wine + + + Unlike Steam, Wine does not require that you have 32-bit libraries + or the i686-w64-mingw32 toolchain. Moreover, to get multilib + support in Wine, it must be compiled twice: a w64 build and a w32 + w/ w64 build. However, it was discussed eariler in the Steam + section that many games are 32-bit and are no longer maintained or + will take a while to switch to 64-bit. This is the case with + Windows applications as well. This means that if you do a 64-bit + only build, compatabilty for all those 32-bit applications will + be lost. + + + + A Wine WoW64 (can run 32-bit and 64-bit applications) build is + recommended. If you do not have a 64-bit CPU, then follow only + the i686 build instructions. Likewise, if you have a 64-bit + CPU, then you can follow only the x86_64 build instructions. + The mingw-w64 toolchain is also really helpful for developers, + so if you don't want full support with Wine but full support + for the mingw-w64 toolchain, then by all means: go for it. + + + + + diff --git a/multilib/pkgconf.xml b/multilib/pkgconf.xml new file mode 100644 index 0000000000..faea2fa0dc --- /dev/null +++ b/multilib/pkgconf.xml @@ -0,0 +1,99 @@ + + + %general-entities; +]> + + + + + + Pkgconf Personalties + + + The pkgconf compilation in the multilib + mirror does not cover pkgconf personalities + which are needed for some lib32 variants of packages such as + Gstreamer. This part is not necessary if you only intend to + follow the Steam chapter and not the Wine chapter. + + + + The pkgconf personalities allow for + pkgconf to be ran without having to specify + the pkgconfig path. + + + + Creating the personalites + + + Create the following personalties as the + root + user: + + + mkdir -v /usr/share/pkgconfig/personality.d + +cat > /usr/share/pkgconfig/x86_64-pc-linux-gnu.personality << "EOF" +Triplet: x86_64-pc-linux-gnu +SysrootDir: / +DefaultSearchPaths: /usr/lib/pkgconfig:/usr/share/pkgconfig +SystemIncludePaths: /usr/include +SystemLibraryPaths: /usr/lib +EOF + +cat > /usr/share/pkgconfig/i686-pc-linux-gnu.personality << "EOF" +Triplet: i686-pc-linux-gnu +SysrootDir: / +DefaultSearchPaths: /usr/lib32/pkgconfig:/usr/share/pkgconfig +SystemIncludePaths: /usr/include +SystemLibraryPaths: /usr/lib32 +EOF + + + Again as the root user, + create the symlinks that enable pkgconf to find the personalites: + + + ln -sv pkgconf /usr/bin/x86_64-pc-linux-gnu-pkg-config +ln -sv pkgconf /usr/bin/i686-pc-linux-gnu-pkg-config + + + Now verify that the x86_64 pkg-config is using the right + personality: + + + x86_64-pc-linux-gnu-pkg-config --dump-personality + + + The result should be: + + + Triplet: x86_64-pc-linux-gnu +SysrootDir: / +DefaultSearchPaths: /usr/lib/pkgconfig /usr/share/pkgconfig +SystemIncludePaths: /usr/include +SystemLibraryPaths: /usr/lib + + + Then verify the i686 pkg-config is using the right personality: + + + i686-pc-linux-gnu-pkg-config --dump-personality + + + The result should be: + + + Triplet: i686-pc-linux-gnu +SysrootDir: / +DefaultSearchPaths: /usr/lib32/pkgconfig /usr/share/pkgconfig +SystemIncludePaths: /usr/include +SystemLibraryPaths: /usr/lib32 + + + + + diff --git a/multilib/whatisml.xml b/multilib/whatisml.xml new file mode 100644 index 0000000000..d7fcd957c8 --- /dev/null +++ b/multilib/whatisml.xml @@ -0,0 +1,64 @@ + + + %general-entities; +]> + + + + + + What is Multilib? + + + Multilib is essentially the ability to at least execute software + that was built for another architecture different from your own. + For example, and most common: the user has a x86_64 CPU that is + wanting to execute software built to run on a x86 CPU. To better + establish terms, x86_64 is 64-bit and amd64, whereas x86 is + 32-bit and ix86 where can vary from 3 to 6 + usually. + + + + + How Does it Work? + + + Multilib can be achieved firstmost by having the hardware + capable of x86 emulation, then having libraries built for x86. + We will get into how to compile x86 libraries and software and + their execution later, but know the general process for LFS + and BLFS is to almost always compile software and that's what + we'll be doing. + + + + + It is worth nothing that when covering multilib, we mean + emulation of 32-bit software on a 64-bit CPU and this + is the case for most users nowadays, but the future is heading + towards ARM64 slowly. We will not be covering ARM at this time. + + + + + + + + Am I Capable of Multilib? + + + If you are on a 32-bit CPU, you are not capable of multilib. + If you are on a 64-bit CPU, and are capable of 32-bit emulation, + then you are capable of multilib. + + + + Run uname -m to find out if you are on a + capable CPU. + + + + diff --git a/steam/intro.xml b/steam/intro.xml index e69de29bb2..95e20371fb 100644 --- a/steam/intro.xml +++ b/steam/intro.xml @@ -0,0 +1,15 @@ + + + %general-entities; +]> + + + + + Introduction + + + + diff --git a/wine/intro.xml b/wine/intro.xml index e69de29bb2..95e20371fb 100644 --- a/wine/intro.xml +++ b/wine/intro.xml @@ -0,0 +1,15 @@ + + + %general-entities; +]> + + + + + Introduction + + + +