Addressed Issue #6. Yes, NVK can now be built.

Added back Meson cross toolchain file, fixed LLVM, Fixed Rustc, and Fixed Mesa.
This commit is contained in:
Zeckmathederg 2024-06-22 18:04:48 -06:00
parent 0ade4fb2bd
commit 02779b3a63
7 changed files with 90 additions and 96 deletions

View File

@ -39,6 +39,16 @@
</listitem>
-->
<listitem>
<para>June 22, 2024</para>
<itemizedlist>
<listitem>
<para>[Zeckmathederg] - Addressed Issue #6. Yes, NVK can now be
built.</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>June 21, 2024</para>
<itemizedlist>

View File

@ -20,6 +20,6 @@
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="needml.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="achievingml.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="pkgconf.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="mesonnative.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="mesonfiles.xml"/>
</chapter>

View File

@ -5,11 +5,11 @@
%general-entities;
]>
<sect1 id="mesonnative" xreflabel="Meson Native Toolchain File">
<?dbhtml filename="mesonnative.html"?>
<sect1 id="mesonfiles" xreflabel="Meson Toolchain Files">
<?dbhtml filename="mesonfiles.html"?>
<title>Meson Native Toolchain File</title>
<title>Meson Toolchain Files</title>
<para>
Most applications that rely on the <application>Meson</application>
@ -20,27 +20,64 @@
</userinput> command to compile 32-bit binaries on a 64-bit system.
However, some projects are more complicated for many different
reasons, leading to the necessity of a <application>Meson
</application> native toolchain file. It specifies the compilers,
</application> toolchain files. They specify compilers,
options that should be invoked, the <application>pkg-conf</application>
binary (or rather symlink that uses a certain personality file) to use,
<command>llvm-config</command> to use, etc. This isn't required for
<xref linkend="steam"/> unless you want to install Mesa's NVK driver,
which isn't in the book at the moment. It is needed for Gstreamer which
is a recommended dependency of <xref linkend="wine"/>.
<command>llvm-config</command> to use, etc. This is required for Mesa's
Nouveau and/or Swrast Vulkan drivers. It is also needed for Gstreamer
(not in the book), which is a recommended dependency of
<xref linkend="wine"/>.
</para>
<para>
There exists another type of <application>Meson</application> file
called a cross toolchain file. However, it equates to pretending
that cross compilation is happening, leading to build failures.
Native toolchain files are the solution to this.
There are two <application>Meson</application> files: the cross
toolchain file and the native toolchain file. There are different situations
for using either.
</para>
<para>
The instructions below will show how to create and use the file if
The instructions below will show how to create and use the files if
necessary.
</para>
<sect2 role="installation">
<title>Creating the Cross Toolchain File</title>
<para>
Create the following toolchain file by running the following
commands as the <systemitem class="username">root</systemitem>
user:
</para>
<screen role="root"><userinput>mkdir -v /usr/share/meson/cross
cat &gt; /usr/share/meson/cross/lib32 &lt;&lt; "EOF"
<literal>[binaries]
c = ['gcc', '-m32']
cpp = ['g++', '-m32']
rust = ['rustc', '--target', 'i686-unknown-linux-gnu']
pkg-config = 'i686-pc-linux-gnu-pkg-config'
ar = '/usr/bin/ar'
strip = '/usr/bin/strip'
cups-config = 'cups-config'
llvm-config = 'llvm-config'
exe_wrapper = ''
[properties]
sizeof_void* = 4
sizeof_long = 4
[host_machine]
system = 'linux'
subsystem = 'linux'
kernel = 'linux'
cpu_family = 'x86'
cpu = 'i686'
endian = 'little'</literal>
EOF</userinput></screen>
</sect2>
<sect2 role="installation">
<title>Creating the Native Toolchain File</title>
@ -70,6 +107,8 @@ sizeof_long = 4
[host_machine]
system = 'linux'
subsystem = 'linux'
kernel = 'linux'
cpu_family = 'x86'
cpu = 'i686'
endian = 'little'</literal>
@ -85,8 +124,14 @@ EOF</userinput></screen>
<userinput>meson setup ..</userinput>, you can simply do:
</para>
<screen><userinput>meson setup .. --cross-file lib32 &lt;other-options&gt;</userinput></screen>
<para>
Or...
</para>
<screen><userinput>meson setup .. --native-file x86 &lt;other-options&gt;</userinput></screen>
</sect2>
</sect1>

View File

@ -184,17 +184,17 @@ mv projects/compiler-rt-&llvm-version;.src projects/compiler-rt</userinput></scr
<screen><userinput>mkdir -v build &amp;&amp;
cd build &amp;&amp;
CC=gcc CXX=g++ \
cmake -DCMAKE_INSTALL_PREFIX=/usr \
-DLLVM_ENABLE_FFI=ON \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_BUILD_LLVM_DYLIB=ON \
-DLLVM_LINK_LLVM_DYLIB=ON \
-DLLVM_ENABLE_RTTI=ON \
-DLLVM_TARGETS_TO_BUILD="host;AMDGPU" \
-DLLVM_BINUTILS_INCDIR=/usr/include \
-DLLVM_INCLUDE_BENCHMARKS=OFF \
-DCLANG_DEFAULT_PIE_ON_LINUX=ON \
CC=gcc CXX=g++ \
cmake -DCMAKE_INSTALL_PREFIX=/usr \
-DLLVM_ENABLE_FFI=ON \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_BUILD_LLVM_DYLIB=ON \
-DLLVM_LINK_LLVM_DYLIB=ON \
-DLLVM_ENABLE_RTTI=ON \
-DLLVM_TARGETS_TO_BUILD="X86;host;AMDGPU" \
-DLLVM_BINUTILS_INCDIR=/usr/include \
-DLLVM_INCLUDE_BENCHMARKS=OFF \
-DCLANG_DEFAULT_PIE_ON_LINUX=ON \
-DCLANG_CONFIG_FILE_SYSTEM_DIR=/etc/clang \
-Wno-dev -G Ninja .. &amp;&amp;
ninja</userinput></screen>
@ -208,52 +208,6 @@ cp bin/FileCheck /usr/bin</userinput></screen>
</sect2>
<sect2 role="installation">
<title>32-bit Installation of LLVM</title>
<para>
First clean the build directory:
</para>
<para>
Install lib32-<application>LLVM</application> by running the following
commands:
</para>
<screen><userinput>cmake -DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib32 \
-DCMAKE_CXX_FLAGS:STRING=-m32 \
-DCMAKE_C_FLAGS:STRING=-m32 \
-DLLVM_ENABLE_FFI=ON \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_BUILD_LLVM_DYLIB=ON \
-DLLVM_LINK_LLVM_DYLIB=ON \
-DLLVM_ENABLE_RTTI=ON \
-DLLVM_DEFAULT_TARGET_TRIPLE="i686-pc-linux-gnu" \
-DLLVM_TARGETS_TO_BUILD="AMDGPU;X86" \
-DLLVM_HOST_TRIPLE=x86_64-pc-linux-gnu \
-DLLVM_BINUTILS_INCDIR=/usr/include \
-DLLVM_INCLUDE_BENCHMARKS=OFF \
-DCLANG_DEFAULT_PIE_ON_LINUX=ON \
-DLLVM_LIBDIR_SUFFIX=32 \
-DLLVM_TARGET_ARCH:STRING=i686 \
-DLLVM_BUILD_32_BITS=ON \
-DCLANG_CONFIG_FILE_SYSTEM_DIR=/etc/clang \
-Wno-dev -G Ninja .. &amp;&amp;
ninja</userinput></screen>
<para>
Now, as the &root; user:
</para>
<screen role="root"><userinput>DESTDIR=$PWD/DESTDIR ninja install
cp -vr DESTDIR/usr/lib32/* /usr/lib32
rm -rf DESTDIR
ldconfig</userinput></screen>
</sect2>
<sect2 role="commands">
<title>Command Explanations</title>

View File

@ -119,12 +119,13 @@
<para>
<xref linkend="llvm"/> (required for the r300, r600, and radeonsi
drivers, and the LLVMpipe software rasterizer which can make the
swrast driver much faster... also Clang is required for Vulkan swrast)
Swrast driver much faster... also Clang is required for Vulkan Swrast)
</para>
</listitem>
<listitem>
<para>
<xref linkend="mesonnative"/> (required for multilib lib32-NVK)
<xref linkend="mesonfiles"/> (required for multilib 32-bit Nouveau and
Swrast Vulkan)
</para>
</listitem>
<listitem>
@ -362,23 +363,7 @@ ldconfig</userinput></screen>
</sect2>
<sect2 role="installation">
<title>32-bit Installation of NVK and Vulkan swrast</title>
<note>
<para>
NVK does not currently build with current GLFS instructions.
You can try but odds are the build will fail. However, they
work for Vulkan swrast. Errors regarding NVK have an unknown
cause but it may be a programming error. <xref linkend="steam"/>
<emphasis>WILL</emphasis> want a 32-bit Vulkan driver. You have
a few options at the moment - consider installing <xref linkend="nvidia"/>
as it often just works and is more performant, compiling 32-bit
NVK on Arch or in a Distrobox, or copy the drivers installed on
another system onto the LFS system. These aren't ideal solutions
but are solutions nonetheless that you should consider before
continuing.
</para>
</note>
<title>32-bit Installation of NVK and Vulkan Swrast</title>
<note>
<para>
@ -388,7 +373,7 @@ ldconfig</userinput></screen>
</note>
<para>
NVK and Vulkan swrast has special requirements to be configured and
NVK and Vulkan swrast have special requirements to be configured and
compiled, requiring extra steps. You are going to need to modify a
few paths in a personality
file used by <application>Pkgconf</application>, as it searches in
@ -417,7 +402,7 @@ ldconfig</userinput></screen>
</para>
<screen><userinput>meson setup \
--native-file x86 \
--cross-file lib32 \
--prefix=$XORG_PREFIX \
--libdir=$XORG_PREFIX/lib32 \
--buildtype=release \

View File

@ -336,7 +336,7 @@ llvm-config = "/usr/bin/llvm-config"
cc = "/usr/bin/gcc"
cxx = "/usr/bin/g++"
ar = "/usr/bin/gcc-ar"
ranlib = "/usr/bin/gcc-ranlib</literal>
ranlib = "/usr/bin/gcc-ranlib"</literal>
EOF</userinput></screen>
<note>

View File

@ -76,8 +76,8 @@
(gstreamer is not included in this book yet due to its wide variety of
recommended dependencies. If you are on multilib and want a 32-bit or WoW64
build, you must install 32-bit variants of the dependencies if they provide
a library, and when compiling gstreamer, use the cross file from
<xref linkend="mesonnative"/>. Do this this for the Base and
a library, and when compiling gstreamer, use the native toolchain file from
<xref linkend="mesonfiles"/>. Do this this for the Base and
Good plugins as well),
OSMesa from <xref linkend="mesa"/> (compiled using the <parameter>
-Dosmesa=true</parameter> option),