Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot build, no rule to make target 'libdxcompiler.so'. #98

Closed
TheEmeraldFalcon opened this issue Jan 31, 2025 · 2 comments
Closed

Cannot build, no rule to make target 'libdxcompiler.so'. #98

TheEmeraldFalcon opened this issue Jan 31, 2025 · 2 comments

Comments

@TheEmeraldFalcon
Copy link

I have cloned the project and its submodules completely. I run the following cmake command:

cmake -S . -B build -DSDLSHADERCROSS_DXC=ON -DDirectXShaderCompiler_INCLUDE_PATH=external/DirectXShaderCompiler/include -DDirectXShaderCompiler_dxcompiler_LIBRARY=external/DirectXShaderCompiler/lib/libdxcompiler.so -DDirectXShaderCompiler_dxil_LIBRARY=external/DirectXShaderCompiler/lib/libdxil.so -Dspirv_cross_c_shared_DIR=~/vulkansdk/1.4.304.0/x86_64/share/spirv_cross_c_shared/cmake

This executes without errors. When I go to build the project, however, using either cmake --build build --parallel $(nproc) or cd build && make, I receive the following error(s):

[ 50%] Built target SDL3_shadercross-static
make[2]: *** No rule to make target 'external/DirectXShaderCompiler/lib/libdxcompiler.so', needed by 'shadercross'.  Stop.
make[1]: *** [CMakeFiles/Makefile2:111: CMakeFiles/shadercross.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

Contents of the generated makefile build/Makefile:

# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.30

# Default target executed when no arguments are given to make.
default_target: all
.PHONY : default_target

# Allow only one "make -f Makefile2" at a time, but pass parallelism.
.NOTPARALLEL:

#=============================================================================
# Special targets provided by cmake.

# Disable implicit rules so canonical targets will work.
.SUFFIXES:

# Disable VCS-based implicit rules.
% : %,v

# Disable VCS-based implicit rules.
% : RCS/%

# Disable VCS-based implicit rules.
% : RCS/%,v

# Disable VCS-based implicit rules.
% : SCCS/s.%

# Disable VCS-based implicit rules.
% : s.%

.SUFFIXES: .hpux_make_needs_suffix_list

# Command-line flag to silence nested $(MAKE).
$(VERBOSE)MAKESILENT = -s

#Suppress display of executed commands.
$(VERBOSE).SILENT:

# A target that is always out of date.
cmake_force:
.PHONY : cmake_force

#=============================================================================
# Set environment variables for the build.

# The shell in which to execute make rules.
SHELL = /bin/sh

# The CMake executable.
CMAKE_COMMAND = /usr/bin/cmake

# The command to remove a file.
RM = /usr/bin/cmake -E rm -f

# Escaping for special characters.
EQUALS = =

# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /home/dev-xorg/SDL_shadercross

# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /home/dev-xorg/SDL_shadercross/build

#=============================================================================
# Targets provided globally by CMake.

# Special rule for the target edit_cache
edit_cache:
	@$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Running CMake cache editor..."
	/usr/bin/ccmake -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : edit_cache

# Special rule for the target edit_cache
edit_cache/fast: edit_cache
.PHONY : edit_cache/fast

# Special rule for the target rebuild_cache
rebuild_cache:
	@$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Running CMake to regenerate build system..."
	/usr/bin/cmake --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : rebuild_cache

# Special rule for the target rebuild_cache
rebuild_cache/fast: rebuild_cache
.PHONY : rebuild_cache/fast

# The main all target
all: cmake_check_build_system
	$(CMAKE_COMMAND) -E cmake_progress_start /home/dev-xorg/SDL_shadercross/build/CMakeFiles /home/dev-xorg/SDL_shadercross/build//CMakeFiles/progress.marks
	$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 all
	$(CMAKE_COMMAND) -E cmake_progress_start /home/dev-xorg/SDL_shadercross/build/CMakeFiles 0
.PHONY : all

# The main clean target
clean:
	$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 clean
.PHONY : clean

# The main clean target
clean/fast: clean
.PHONY : clean/fast

# Prepare targets for installation.
preinstall: all
	$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall

# Prepare targets for installation.
preinstall/fast:
	$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall/fast

# clear depends
depend:
	$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
.PHONY : depend

#=============================================================================
# Target rules for targets named SDL3_shadercross-static

# Build rule for target.
SDL3_shadercross-static: cmake_check_build_system
	$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 SDL3_shadercross-static
.PHONY : SDL3_shadercross-static

# fast build rule for target.
SDL3_shadercross-static/fast:
	$(MAKE) $(MAKESILENT) -f CMakeFiles/SDL3_shadercross-static.dir/build.make CMakeFiles/SDL3_shadercross-static.dir/build
.PHONY : SDL3_shadercross-static/fast

#=============================================================================
# Target rules for targets named shadercross

# Build rule for target.
shadercross: cmake_check_build_system
	$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 shadercross
.PHONY : shadercross

# fast build rule for target.
shadercross/fast:
	$(MAKE) $(MAKESILENT) -f CMakeFiles/shadercross.dir/build.make CMakeFiles/shadercross.dir/build
.PHONY : shadercross/fast

src/SDL_shadercross.o: src/SDL_shadercross.c.o
.PHONY : src/SDL_shadercross.o

# target to build an object file
src/SDL_shadercross.c.o:
	$(MAKE) $(MAKESILENT) -f CMakeFiles/SDL3_shadercross-static.dir/build.make CMakeFiles/SDL3_shadercross-static.dir/src/SDL_shadercross.c.o
.PHONY : src/SDL_shadercross.c.o

src/SDL_shadercross.i: src/SDL_shadercross.c.i
.PHONY : src/SDL_shadercross.i

# target to preprocess a source file
src/SDL_shadercross.c.i:
	$(MAKE) $(MAKESILENT) -f CMakeFiles/SDL3_shadercross-static.dir/build.make CMakeFiles/SDL3_shadercross-static.dir/src/SDL_shadercross.c.i
.PHONY : src/SDL_shadercross.c.i

src/SDL_shadercross.s: src/SDL_shadercross.c.s
.PHONY : src/SDL_shadercross.s

# target to generate assembly for a file
src/SDL_shadercross.c.s:
	$(MAKE) $(MAKESILENT) -f CMakeFiles/SDL3_shadercross-static.dir/build.make CMakeFiles/SDL3_shadercross-static.dir/src/SDL_shadercross.c.s
.PHONY : src/SDL_shadercross.c.s

src/cli.o: src/cli.c.o
.PHONY : src/cli.o

# target to build an object file
src/cli.c.o:
	$(MAKE) $(MAKESILENT) -f CMakeFiles/shadercross.dir/build.make CMakeFiles/shadercross.dir/src/cli.c.o
.PHONY : src/cli.c.o

src/cli.i: src/cli.c.i
.PHONY : src/cli.i

# target to preprocess a source file
src/cli.c.i:
	$(MAKE) $(MAKESILENT) -f CMakeFiles/shadercross.dir/build.make CMakeFiles/shadercross.dir/src/cli.c.i
.PHONY : src/cli.c.i

src/cli.s: src/cli.c.s
.PHONY : src/cli.s

# target to generate assembly for a file
src/cli.c.s:
	$(MAKE) $(MAKESILENT) -f CMakeFiles/shadercross.dir/build.make CMakeFiles/shadercross.dir/src/cli.c.s
.PHONY : src/cli.c.s

# Help Target
help:
	@echo "The following are some of the valid targets for this Makefile:"
	@echo "... all (the default if no target is provided)"
	@echo "... clean"
	@echo "... depend"
	@echo "... edit_cache"
	@echo "... rebuild_cache"
	@echo "... SDL3_shadercross-static"
	@echo "... shadercross"
	@echo "... src/SDL_shadercross.o"
	@echo "... src/SDL_shadercross.i"
	@echo "... src/SDL_shadercross.s"
	@echo "... src/cli.o"
	@echo "... src/cli.i"
	@echo "... src/cli.s"
.PHONY : help



#=============================================================================
# Special targets to cleanup operation of make.

# Special rule to run CMake to check the build system integrity.
# No rule that depends on this can have commands that come from listfiles
# because they might be regenerated.
cmake_check_build_system:
	$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
.PHONY : cmake_check_build_system

Basic observation, the Makefile lacks any reference to anything related to DirectX in any way, perhaps I haven't set everything up correctly? The given directories exist, but libdxcompiler.so hasn't been compiled yet (the missing rule). I apologize if I'm missing something really obvious, I'm new to CMake so a simple error on my part wouldn't surprise me.

@madebr
Copy link
Contributor

madebr commented Jan 31, 2025

I have cloned the project and its submodules completely. I run the following cmake command:

cmake -S . -B build -DSDLSHADERCROSS_DXC=ON -DDirectXShaderCompiler_INCLUDE_PATH=external/DirectXShaderCompiler/include -DDirectXShaderCompiler_dxcompiler_LIBRARY=external/DirectXShaderCompiler/lib/libdxcompiler.so -DDirectXShaderCompiler_dxil_LIBRARY=external/DirectXShaderCompiler/lib/libdxil.so -Dspirv_cross_c_shared_DIR=~/vulkansdk/1.4.304.0/x86_64/share/spirv_cross_c_shared/cmake

It looks like you passed paths to for the dxcompiler because CMake configuration failed for you.
*_INCLUDE_PATH and *_PATH variables needs paths to existing directories and/or files.

Run cmake -P build-scripts/download-prebuilt-DirectXShaderCompiler.cmake to download prebuilt directxcompiler binaries from microsoft/DirectXShaderCompiler, and configure with -DCMAKE_PREFIX_PATH=external/DirectXShaderCompiler-binaries

Alternatively, build everything yourself by configuring with -DSDLSHADERCROSS_VENDORED=TRUE. Then you don't need to download any pre-built binaries, don't need to configure with -DCMAKE_PREFIX_PATH etc.

@madebr madebr closed this as not planned Won't fix, can't repro, duplicate, stale Jan 31, 2025
@TheEmeraldFalcon
Copy link
Author

Thank you! DirectXShaderCompiler-binaries contained the missing library, I changed all of the path directories to reference the new binaries directory and it worked. CMake command (larger than necessary, just trying to cover every base) for anyone who's interested:

cmake -S . -B build -DSDLSHADERCROSS_DXC=ON -DDirectXShaderCompiler_INCLUDE_PATH=external/DirectXShaderCompiler-binaries/linux/include/ -DDirectXShaderCompiler_dxcompiler_LIBRARY=external/DirectXShaderCompiler-binaries/linux/lib/libdxcompiler.so -DDirectXShaderCompiler_dxil_LIBRARY=external/DirectXShaderCompiler-binaries/linux/lib/libdxil.so -Dspirv_cross_c_shared_DIR=~/vulkansdk/1.4.304.0/x86_64/share/spirv_cross_c_shared/cmake -DCMAKE_PREFIX_PATH=external/DirectXShaderCompiler-binaries/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants