gpu: Missing cc on up-to-date Linux install #281

Closed
opened 2022-05-19 12:53:56 +00:00 by ghost · 5 comments
ghost commented 2022-05-19 12:53:56 +00:00 (Migrated from github.com)

I just tried to go through the install from source as described in the README.
It mentions that besides Git and Zig, no build dependencies are needed.
I am not sure this is true, as evidenced below:

boop@boops: code$ zig -version
boop@boops: code$ 0.10.0-dev.1933+5f2d0d414

boop@boops: code$ git clone https://github.com/hexops/mach-gpu-dawn
boop@boops: code$ cd mach-gpu-dawn
boop@boops: mach-gpu-dawn$ rm -rf libs/mach-glfw
boop@boops: mach-gpu-dawn$ git clone https://github.com/hexops/mach-glfw libs/mach-glfw
boop@boops: mach-gpu-dawn$ zig build -Ddawn-from-source=true

The following was the result. With the error at the bottom:

Submodule 'libs/DirectXShaderCompiler' (https://github.com/hexops/DirectXShaderCompiler) registered for path 'libs/DirectXShaderCompiler'
Submodule 'libs/dawn' (https://github.com/hexops/dawn.git) registered for path 'libs/dawn'
Cloning into 'mach-gpu-dawn/libs/DirectXShaderCompiler'...
Cloning into 'mach-gpu-dawn/libs/dawn'...
remote: Enumerating objects: 62, done.
remote: Counting objects: 100% (62/62), done.
remote: Compressing objects: 100% (36/36), done.
remote: Total 61 (delta 15), reused 61 (delta 15), pack-reused 0
Unpacking objects: 100% (61/61), 57.49 KiB | 1.60 MiB/s, done.
From https://github.com/hexops/DirectXShaderCompiler
 * branch              cff9a6f0b7f961748b822e1d313a7205dfdecf9d -> FETCH_HEAD
Submodule path 'libs/DirectXShaderCompiler': checked out 'cff9a6f0b7f961748b822e1d313a7205dfdecf9d'
Submodule 'external/SPIRV-Headers' (https://github.com/KhronosGroup/SPIRV-Headers) registered for path 'libs/DirectXShaderCompiler/external/SPIRV-Headers'
Submodule 'external/SPIRV-Tools' (https://github.com/KhronosGroup/SPIRV-Tools) registered for path 'libs/DirectXShaderCompiler/external/SPIRV-Tools'
Submodule 'external/effcee' (https://github.com/google/effcee) registered for path 'libs/DirectXShaderCompiler/external/effcee'
Submodule 'external/re2' (https://github.com/google/re2) registered for path 'libs/DirectXShaderCompiler/external/re2'
Cloning into 'mach-gpu-dawn/libs/DirectXShaderCompiler/external/SPIRV-Headers'...
Cloning into 'mach-gpu-dawn/libs/DirectXShaderCompiler/external/SPIRV-Tools'...
Cloning into 'mach-gpu-dawn/libs/DirectXShaderCompiler/external/effcee'...
Cloning into 'mach-gpu-dawn/libs/DirectXShaderCompiler/external/re2'...
Submodule path 'libs/DirectXShaderCompiler/external/SPIRV-Headers': checked out 'eddd4dfc930f1374a70797460240a501c7d333f7'
Submodule path 'libs/DirectXShaderCompiler/external/SPIRV-Tools': checked out 'df2aad68b98279412494a6d449bd71b6756e699b'
Submodule path 'libs/DirectXShaderCompiler/external/effcee': checked out 'cd25ec17e9382f99a895b9ef53ff3c277464d07d'
Submodule path 'libs/DirectXShaderCompiler/external/re2': checked out '4c916c947ab7f2ba2d280bb8c87540c365d30695'
remote: Enumerating objects: 11024, done.
remote: Counting objects: 100% (11024/11024), done.
remote: Compressing objects: 100% (9093/9093), done.
remote: Total 11022 (delta 1953), reused 9320 (delta 1720), pack-reused 0
Receiving objects: 100% (11022/11022), 48.24 MiB | 6.02 MiB/s, done.
Resolving deltas: 100% (1953/1953), completed with 1 local object.
From https://github.com/hexops/dawn
 * branch              9846349afab9e125a8d257130eaebf2f0582e012 -> FETCH_HEAD
Submodule path 'libs/dawn': checked out '9846349afab9e125a8d257130eaebf2f0582e012'
Zig attempted to find the path to native system libc headers by executing this command:
cc -E -Wp,-v -xc /dev/null
error: unable to create compilation: UnableToSpawnCCompiler
gpu...The following command exited with error code 1:
/home/boop/bin/zig/zig build-lib mach-gpu-dawn/src/main.zig mach-gpu-dawn/zig-cache/o/70446f031a366564c81e68e477248ff5/libdawn.a -lc++ -lc -lX11 -lxcb -lXau -lXdmcp -lX11 -lX11 -lxcb -lXau -lXdmcp -lc -lX11 -lxcb -lXau -lXdmcp -lc -lX11 -lxcb -lXau -lXdmcp --cache-dir mach-gpu-dawn/zig-cache --global-cache-dir /home/boop/.cache/zig --name gpu -static -I mach-gpu-dawn/libs/dawn/out/Debug/gen/include -I mach-gpu-dawn/libs/dawn/include -I mach-gpu-dawn/src/dawn --enable-cache 
error: the following build command failed with exit code 1:
mach-gpu-dawn/zig-cache/o/03dbbaeba02aba58123b8f98c0be9d0a/build /home/boop/bin/zig/zig mach-gpu-dawn mach-gpu-dawn/zig-cache /home/boop/.cache/zig -Ddawn-from-source=true

cc -E -Wp,-v -xc /dev/null
error: unable to create compilation: UnableToSpawnCCompiler

cc does not exist on my system.

This system being: Linux boops 5.15.0-30-generic #31-Ubuntu SMP Thu May 5 10:00:34 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

I deliberately did not install things like GCC on this system, as I wanted to do as much as possible using Zig.

I just tried to go through the install from source as described in the README. It mentions that besides Git and Zig, no build dependencies are needed. I am not sure this is true, as evidenced below: ``` boop@boops: code$ zig -version boop@boops: code$ 0.10.0-dev.1933+5f2d0d414 boop@boops: code$ git clone https://github.com/hexops/mach-gpu-dawn boop@boops: code$ cd mach-gpu-dawn boop@boops: mach-gpu-dawn$ rm -rf libs/mach-glfw boop@boops: mach-gpu-dawn$ git clone https://github.com/hexops/mach-glfw libs/mach-glfw boop@boops: mach-gpu-dawn$ zig build -Ddawn-from-source=true ``` The following was the result. With the error at the bottom: ``` Submodule 'libs/DirectXShaderCompiler' (https://github.com/hexops/DirectXShaderCompiler) registered for path 'libs/DirectXShaderCompiler' Submodule 'libs/dawn' (https://github.com/hexops/dawn.git) registered for path 'libs/dawn' Cloning into 'mach-gpu-dawn/libs/DirectXShaderCompiler'... Cloning into 'mach-gpu-dawn/libs/dawn'... remote: Enumerating objects: 62, done. remote: Counting objects: 100% (62/62), done. remote: Compressing objects: 100% (36/36), done. remote: Total 61 (delta 15), reused 61 (delta 15), pack-reused 0 Unpacking objects: 100% (61/61), 57.49 KiB | 1.60 MiB/s, done. From https://github.com/hexops/DirectXShaderCompiler * branch cff9a6f0b7f961748b822e1d313a7205dfdecf9d -> FETCH_HEAD Submodule path 'libs/DirectXShaderCompiler': checked out 'cff9a6f0b7f961748b822e1d313a7205dfdecf9d' Submodule 'external/SPIRV-Headers' (https://github.com/KhronosGroup/SPIRV-Headers) registered for path 'libs/DirectXShaderCompiler/external/SPIRV-Headers' Submodule 'external/SPIRV-Tools' (https://github.com/KhronosGroup/SPIRV-Tools) registered for path 'libs/DirectXShaderCompiler/external/SPIRV-Tools' Submodule 'external/effcee' (https://github.com/google/effcee) registered for path 'libs/DirectXShaderCompiler/external/effcee' Submodule 'external/re2' (https://github.com/google/re2) registered for path 'libs/DirectXShaderCompiler/external/re2' Cloning into 'mach-gpu-dawn/libs/DirectXShaderCompiler/external/SPIRV-Headers'... Cloning into 'mach-gpu-dawn/libs/DirectXShaderCompiler/external/SPIRV-Tools'... Cloning into 'mach-gpu-dawn/libs/DirectXShaderCompiler/external/effcee'... Cloning into 'mach-gpu-dawn/libs/DirectXShaderCompiler/external/re2'... Submodule path 'libs/DirectXShaderCompiler/external/SPIRV-Headers': checked out 'eddd4dfc930f1374a70797460240a501c7d333f7' Submodule path 'libs/DirectXShaderCompiler/external/SPIRV-Tools': checked out 'df2aad68b98279412494a6d449bd71b6756e699b' Submodule path 'libs/DirectXShaderCompiler/external/effcee': checked out 'cd25ec17e9382f99a895b9ef53ff3c277464d07d' Submodule path 'libs/DirectXShaderCompiler/external/re2': checked out '4c916c947ab7f2ba2d280bb8c87540c365d30695' remote: Enumerating objects: 11024, done. remote: Counting objects: 100% (11024/11024), done. remote: Compressing objects: 100% (9093/9093), done. remote: Total 11022 (delta 1953), reused 9320 (delta 1720), pack-reused 0 Receiving objects: 100% (11022/11022), 48.24 MiB | 6.02 MiB/s, done. Resolving deltas: 100% (1953/1953), completed with 1 local object. From https://github.com/hexops/dawn * branch 9846349afab9e125a8d257130eaebf2f0582e012 -> FETCH_HEAD Submodule path 'libs/dawn': checked out '9846349afab9e125a8d257130eaebf2f0582e012' Zig attempted to find the path to native system libc headers by executing this command: cc -E -Wp,-v -xc /dev/null error: unable to create compilation: UnableToSpawnCCompiler gpu...The following command exited with error code 1: /home/boop/bin/zig/zig build-lib mach-gpu-dawn/src/main.zig mach-gpu-dawn/zig-cache/o/70446f031a366564c81e68e477248ff5/libdawn.a -lc++ -lc -lX11 -lxcb -lXau -lXdmcp -lX11 -lX11 -lxcb -lXau -lXdmcp -lc -lX11 -lxcb -lXau -lXdmcp -lc -lX11 -lxcb -lXau -lXdmcp --cache-dir mach-gpu-dawn/zig-cache --global-cache-dir /home/boop/.cache/zig --name gpu -static -I mach-gpu-dawn/libs/dawn/out/Debug/gen/include -I mach-gpu-dawn/libs/dawn/include -I mach-gpu-dawn/src/dawn --enable-cache error: the following build command failed with exit code 1: mach-gpu-dawn/zig-cache/o/03dbbaeba02aba58123b8f98c0be9d0a/build /home/boop/bin/zig/zig mach-gpu-dawn mach-gpu-dawn/zig-cache /home/boop/.cache/zig -Ddawn-from-source=true ``` >>> cc -E -Wp,-v -xc /dev/null >>> error: unable to create compilation: UnableToSpawnCCompiler `cc` does not exist on my system. This system being: Linux boops 5.15.0-30-generic #31-Ubuntu SMP Thu May 5 10:00:34 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux I deliberately did not install things like GCC on this system, as I wanted to do as much as possible using Zig.
alichraghi commented 2022-05-19 12:56:35 +00:00 (Migrated from github.com)

can you run zig build -Ddawn-from-source=true again with --verbose argument passed?

can you run `zig build -Ddawn-from-source=true` again with `--verbose` argument passed?
ghost commented 2022-05-19 13:01:34 +00:00 (Migrated from github.com)

This yields:

$ zig build -Ddawn-from-source=true --verbose 
/home/boop/bin/zig/zig build-lib mach-gpu-dawn/libs/mach-glfw/src/main.zig -cflags -D_GLFW_X11 -Imach-gpu-dawn/libs/mach-glfw/upstream/glfw/src -- mach-gpu-dawn/libs/mach-glfw/src/sources_linux.c mach-gpu-dawn/libs/mach-glfw/src/sources_linux_x11.c -lc -lX11 -lxcb -lXau -lXdmcp --cache-dir mach-gpu-dawn/zig-cache --global-cache-dir /home/boop/.cache/zig --name glfw -static -target native-native-gnu -mcpu skylake -I mach-gpu-dawn/libs/mach-glfw/upstream/glfw/include -I mach-gpu-dawn/libs/mach-glfw/upstream/vulkan_headers/include -isystem /home/boop/.local/share/hexops/sdk-linux-x86_64/root/usr/include -isystem /home/boop/.local/share/hexops/sdk-linux-x86_64/root/usr/share/wayland-generated -L /home/boop/.local/share/hexops/sdk-linux-x86_64/root/usr/lib/x86_64-linux-gnu --enable-cache 
/home/boop/bin/zig/zig build-lib mach-gpu-dawn/libs/mach-glfw/src/main.zig -cflags -D_GLFW_X11 -Imach-gpu-dawn/libs/mach-glfw/upstream/glfw/src -- mach-gpu-dawn/libs/mach-glfw/src/sources_linux.c mach-gpu-dawn/libs/mach-glfw/src/sources_linux_x11.c -lc -lX11 -lxcb -lXau -lXdmcp --cache-dir mach-gpu-dawn/zig-cache --global-cache-dir /home/boop/.cache/zig --name glfw -static -target native-native-gnu -mcpu skylake -I mach-gpu-dawn/libs/mach-glfw/upstream/glfw/include -I mach-gpu-dawn/libs/mach-glfw/upstream/vulkan_headers/include -isystem /home/boop/.local/share/hexops/sdk-linux-x86_64/root/usr/include -isystem /home/boop/.local/share/hexops/sdk-linux-x86_64/root/usr/share/wayland-generated -L /home/boop/.local/share/hexops/sdk-linux-x86_64/root/usr/lib/x86_64-linux-gnu --enable-cache 
/home/boop/bin/zig/zig build-lib @mach-gpu-dawn/zig-cache/args/8c789056aaddfba6c8c518d98c83453da969b416d83d48b94beb225bf0edce21 
/home/boop/bin/zig/zig build-lib mach-gpu-dawn/src/main.zig mach-gpu-dawn/zig-cache/o/70446f031a366564c81e68e477248ff5/libdawn.a -lc++ -lc -lX11 -lxcb -lXau -lXdmcp -lX11 -lX11 -lxcb -lXau -lXdmcp -lc -lX11 -lxcb -lXau -lXdmcp -lc -lX11 -lxcb -lXau -lXdmcp --cache-dir mach-gpu-dawn/zig-cache --global-cache-dir /home/boop/.cache/zig --name gpu -static -I mach-gpu-dawn/libs/dawn/out/Debug/gen/include -I mach-gpu-dawn/libs/dawn/include -I mach-gpu-dawn/src/dawn --enable-cache 
Zig attempted to find the path to native system libc headers by executing this command:
cc -E -Wp,-v -xc /dev/null
error: unable to create compilation: UnableToSpawnCCompiler
gpu...The following command exited with error code 1:
/home/boop/bin/zig/zig build-lib mach-gpu-dawn/src/main.zig mach-gpu-dawn/zig-cache/o/70446f031a366564c81e68e477248ff5/libdawn.a -lc++ -lc -lX11 -lxcb -lXau -lXdmcp -lX11 -lX11 -lxcb -lXau -lXdmcp -lc -lX11 -lxcb -lXau -lXdmcp -lc -lX11 -lxcb -lXau -lXdmcp --cache-dir mach-gpu-dawn/zig-cache --global-cache-dir /home/boop/.cache/zig --name gpu -static -I mach-gpu-dawn/libs/dawn/out/Debug/gen/include -I mach-gpu-dawn/libs/dawn/include -I mach-gpu-dawn/src/dawn --enable-cache 
error: the following build command failed with exit code 1:
mach-gpu-dawn/zig-cache/o/03dbbaeba02aba58123b8f98c0be9d0a/build /home/boop/bin/zig/zig mach-gpu-dawn mach-gpu-dawn/zig-cache /home/boop/.cache/zig -Ddawn-from-source=true --verbose

Which, I guess doesn't add anything new. Unless I am missing something.

This yields: ``` $ zig build -Ddawn-from-source=true --verbose /home/boop/bin/zig/zig build-lib mach-gpu-dawn/libs/mach-glfw/src/main.zig -cflags -D_GLFW_X11 -Imach-gpu-dawn/libs/mach-glfw/upstream/glfw/src -- mach-gpu-dawn/libs/mach-glfw/src/sources_linux.c mach-gpu-dawn/libs/mach-glfw/src/sources_linux_x11.c -lc -lX11 -lxcb -lXau -lXdmcp --cache-dir mach-gpu-dawn/zig-cache --global-cache-dir /home/boop/.cache/zig --name glfw -static -target native-native-gnu -mcpu skylake -I mach-gpu-dawn/libs/mach-glfw/upstream/glfw/include -I mach-gpu-dawn/libs/mach-glfw/upstream/vulkan_headers/include -isystem /home/boop/.local/share/hexops/sdk-linux-x86_64/root/usr/include -isystem /home/boop/.local/share/hexops/sdk-linux-x86_64/root/usr/share/wayland-generated -L /home/boop/.local/share/hexops/sdk-linux-x86_64/root/usr/lib/x86_64-linux-gnu --enable-cache /home/boop/bin/zig/zig build-lib mach-gpu-dawn/libs/mach-glfw/src/main.zig -cflags -D_GLFW_X11 -Imach-gpu-dawn/libs/mach-glfw/upstream/glfw/src -- mach-gpu-dawn/libs/mach-glfw/src/sources_linux.c mach-gpu-dawn/libs/mach-glfw/src/sources_linux_x11.c -lc -lX11 -lxcb -lXau -lXdmcp --cache-dir mach-gpu-dawn/zig-cache --global-cache-dir /home/boop/.cache/zig --name glfw -static -target native-native-gnu -mcpu skylake -I mach-gpu-dawn/libs/mach-glfw/upstream/glfw/include -I mach-gpu-dawn/libs/mach-glfw/upstream/vulkan_headers/include -isystem /home/boop/.local/share/hexops/sdk-linux-x86_64/root/usr/include -isystem /home/boop/.local/share/hexops/sdk-linux-x86_64/root/usr/share/wayland-generated -L /home/boop/.local/share/hexops/sdk-linux-x86_64/root/usr/lib/x86_64-linux-gnu --enable-cache /home/boop/bin/zig/zig build-lib @mach-gpu-dawn/zig-cache/args/8c789056aaddfba6c8c518d98c83453da969b416d83d48b94beb225bf0edce21 /home/boop/bin/zig/zig build-lib mach-gpu-dawn/src/main.zig mach-gpu-dawn/zig-cache/o/70446f031a366564c81e68e477248ff5/libdawn.a -lc++ -lc -lX11 -lxcb -lXau -lXdmcp -lX11 -lX11 -lxcb -lXau -lXdmcp -lc -lX11 -lxcb -lXau -lXdmcp -lc -lX11 -lxcb -lXau -lXdmcp --cache-dir mach-gpu-dawn/zig-cache --global-cache-dir /home/boop/.cache/zig --name gpu -static -I mach-gpu-dawn/libs/dawn/out/Debug/gen/include -I mach-gpu-dawn/libs/dawn/include -I mach-gpu-dawn/src/dawn --enable-cache Zig attempted to find the path to native system libc headers by executing this command: cc -E -Wp,-v -xc /dev/null error: unable to create compilation: UnableToSpawnCCompiler gpu...The following command exited with error code 1: /home/boop/bin/zig/zig build-lib mach-gpu-dawn/src/main.zig mach-gpu-dawn/zig-cache/o/70446f031a366564c81e68e477248ff5/libdawn.a -lc++ -lc -lX11 -lxcb -lXau -lXdmcp -lX11 -lX11 -lxcb -lXau -lXdmcp -lc -lX11 -lxcb -lXau -lXdmcp -lc -lX11 -lxcb -lXau -lXdmcp --cache-dir mach-gpu-dawn/zig-cache --global-cache-dir /home/boop/.cache/zig --name gpu -static -I mach-gpu-dawn/libs/dawn/out/Debug/gen/include -I mach-gpu-dawn/libs/dawn/include -I mach-gpu-dawn/src/dawn --enable-cache error: the following build command failed with exit code 1: mach-gpu-dawn/zig-cache/o/03dbbaeba02aba58123b8f98c0be9d0a/build /home/boop/bin/zig/zig mach-gpu-dawn mach-gpu-dawn/zig-cache /home/boop/.cache/zig -Ddawn-from-source=true --verbose ``` Which, I guess doesn't add anything new. Unless I am missing something.
iddev5 commented 2022-05-20 13:26:16 +00:00 (Migrated from github.com)

This is a Zig specific issue which I have faced before in other projects. It basically happens when trying to compile a C project in a system missing a C compiler. I dont know of any solution or as to what extend this is a real issue.

Maybe try passing the exact gnu/musl version in the triplet: zig build -Dtarget=x86_64-linux-gnu-2.34 ??

This is a Zig specific issue which I have faced before in other projects. It basically happens when trying to compile a C project in a system missing a C compiler. I dont know of any solution or as to what extend this is a real issue. Maybe try passing the exact gnu/musl version in the triplet: ``zig build -Dtarget=x86_64-linux-gnu-2.34`` ??
emidoots commented 2022-05-20 16:19:34 +00:00 (Migrated from github.com)

If you don't pass a cross-compilation target (-Dtarget=x86_64-linux), Zig will attempt to use your host toolchain in some cases (compiler, libc version, etc.)

Passing a cross-compilation target should fix the issue as @iddev5 mentioned. Let us know if not!

If you don't pass a cross-compilation target (`-Dtarget=x86_64-linux`), Zig will attempt to use your host toolchain in some cases (compiler, libc version, etc.) Passing a cross-compilation target should fix the issue as @iddev5 mentioned. Let us know if not!
ghost commented 2022-05-20 19:05:38 +00:00 (Migrated from github.com)

$ zig build -Ddawn-from-source=true -Dtarget=x86_64-linux

This seems to have done the trick. Thanks.

> $ zig build -Ddawn-from-source=true -Dtarget=x86_64-linux This seems to have done the trick. Thanks.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
hexops/mach#281
No description provided.