Update Vulkan dependencies: add glslc package

- build.sh: Update package list to include glslc, glslang-tools, glslang-dev
- README.md: Update installation instructions with correct package names
- Add better guidance for finding glslc in non-standard locations
parent bd5b87b5
......@@ -84,7 +84,7 @@ Requires:
**Install Vulkan drivers and tools:**
```bash
# Debian/Ubuntu
sudo apt install libvulkan-dev vulkan-tools mesa-vulkan-drivers glslang-tools
sudo apt install libvulkan-dev vulkan-tools mesa-vulkan-drivers glslc glslang-tools glslang-dev
# Fedora
sudo dnf install vulkan-loader-devel vulkan-tools mesa-vulkan-drivers glslang
......@@ -93,7 +93,18 @@ sudo dnf install vulkan-loader-devel vulkan-tools mesa-vulkan-drivers glslang
sudo pacman -S vulkan-headers vulkan-icd-loader vulkan-radeon glslang
```
**Note:** The `glslang-tools` (Debian/Ubuntu) or `glslang` (Fedora/Arch) package provides `glslc`, the Vulkan shader compiler required to build llama-cpp-python with Vulkan support.
**Note:** The shader compiler `glslc` is required to build llama-cpp-python with Vulkan support. On Debian/Ubuntu, it's provided by the `glslc` package. If `glslc` is not found after installing, try:
```bash
# Check if glslc exists somewhere
find /usr -name "glslc" 2>/dev/null
# If found in a non-standard location, add to PATH
export PATH=$PATH:/usr/lib/shaderc/bin
# Or create a symlink if glslangValidator exists
sudo ln -s $(which glslangValidator) /usr/local/bin/glslc
```
Models: GGUF format (from HuggingFace or local files)
......@@ -622,7 +633,14 @@ python coderai --model TheBloke/Llama-2-7B-GGUF --backend vulkan
sudo dnf install vulkan-loader-devel vulkan-tools mesa-vulkan-drivers glslang
```
**Note:** `glslc` is required to compile llama-cpp-python with Vulkan support. If you see "Could NOT find Vulkan (missing: glslc)", install the `glslang-tools` (Debian/Ubuntu) or `glslang` (Fedora/Arch) package.
**Note:** `glslc` is required to compile llama-cpp-python with Vulkan support. If you see "Could NOT find Vulkan (missing: glslc)", install the `glslc` package:
```bash
sudo apt install glslc glslang-tools glslang-dev
# If glslc still not found, check location and symlink:
find /usr -name "glslc" 2>/dev/null
sudo ln -s /usr/lib/shaderc/bin/glslc /usr/local/bin/glslc 2>/dev/null || sudo ln -s $(which glslangValidator) /usr/local/bin/glslc 2>/dev/null || echo "glslc not found, please install glslc package"
```
2. **Reinstall llama-cpp-python with Vulkan:**
```bash
......
......@@ -97,21 +97,45 @@ elif [ "$BACKEND" = "vulkan" ]; then
fi
# Check for glslc (Vulkan shader compiler) which is required for building
if ! command -v glslc &> /dev/null; then
echo -e "${YELLOW}Warning: glslc (Vulkan shader compiler) not found${NC}"
echo -e "${YELLOW}You need to install the shader compiler:${NC}"
echo " Debian/Ubuntu: sudo apt install glslang-tools"
# Note: glslc might also be named glslangValidator on some systems
GLSLC_CMD=""
if command -v glslc &> /dev/null; then
GLSLC_CMD="glslc"
elif command -v glslangValidator &> /dev/null; then
GLSLC_CMD="glslangValidator"
fi
if [ -z "$GLSLC_CMD" ]; then
echo -e "${YELLOW}Warning: glslc/glslangValidator (Vulkan shader compiler) not found in PATH${NC}"
echo -e "${YELLOW}You may need to install the shader compiler:${NC}"
echo " Debian/Ubuntu: sudo apt install glslc glslang-tools glslang-dev"
echo " Fedora: sudo dnf install glslang"
echo " Arch: sudo pacman -S glslang"
echo ""
echo -e "${RED}Error: Cannot build llama-cpp-python with Vulkan without glslc${NC}"
exit 1
echo -e "${YELLOW}Attempting build anyway - CMake may find it in a non-standard location...${NC}"
echo ""
else
echo -e "${GREEN}✓ Found Vulkan shader compiler: $GLSLC_CMD${NC}"
fi
# Install llama-cpp-python with Vulkan support
# CMAKE_ARGS is used to enable Vulkan during compilation
echo -e "${YELLOW}Building llama-cpp-python with Vulkan support (this may take a few minutes)...${NC}"
CMAKE_ARGS="-DGGML_VULKAN=ON" pip install llama-cpp-python --no-cache-dir
echo -e "${YELLOW}Building llama-cpp-python with Vulkan support (this may take several minutes)...${NC}"
echo -e "${YELLOW}If this fails with 'Could NOT find Vulkan (missing: glslc)', install:${NC}"
echo -e "${YELLOW} sudo apt install glslc glslang-tools glslang-dev${NC}"
echo ""
CMAKE_ARGS="-DGGML_VULKAN=ON" pip install llama-cpp-python --no-cache-dir || {
echo ""
echo -e "${RED}Build failed!${NC}"
echo -e "${YELLOW}If the error mentions 'missing: glslc', install the shader compiler:${NC}"
echo " sudo apt install glslc glslang-tools glslang-dev"
echo ""
echo -e "${YELLOW}If glslc is already installed but not in PATH, you may need to:${NC}"
echo " export PATH=\$PATH:/usr/lib/shaderc/bin"
echo " or"
echo " sudo ln -s /usr/bin/glslangValidator /usr/local/bin/glslc"
exit 1
}
echo -e "${YELLOW}Installing Vulkan-specific requirements...${NC}"
pip install -r requirements-vulkan.txt
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment