- 
                Notifications
    
You must be signed in to change notification settings  - Fork 13.5k
 
ci: add Linux cross-compile build #12428
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
          
     Merged
      
      
    
  
     Merged
                    Changes from 26 commits
      Commits
    
    
            Show all changes
          
          
            27 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      b437b30
              
                Add build-linux-cross to CI
              
              
                bandoti 6a447e1
              
                Install mesa drivers before vulkan sdk
              
              
                bandoti ddd7b2f
              
                Install vulkan drivers before vulkan sdk
              
              
                bandoti d14edbb
              
                Only install glslang-tools (not full vulkan sdk)
              
              
                bandoti 10edb6e
              
                Search for GLSLC program outside find-root-path
              
              
                bandoti 344bda5
              
                Merge branch 'master' into ci-build-cross
              
              
                bandoti ce5285a
              
                Do not specify Vulkan components
              
              
                bandoti ce6e549
              
                Install shaderc
              
              
                bandoti b52bb4d
              
                Set project name for vulkan-shaders-gen
              
              
                bandoti 829bca0
              
                Set minimum cmake project ver.
              
              
                bandoti d2ac204
              
                Use ubuntu latest
              
              
                bandoti d8d3ba5
              
                Add cpu-only build
              
              
                bandoti 7e276bc
              
                Use Noble glslc instead of LunarG
              
              
                bandoti ef7376e
              
                Revert change to ggml/src/ggml-vulkan/CMakeLists.txt
              
              
                bandoti 05bfb76
              
                Merge branch 'master' into ci-build-cross
              
              
                bandoti 2ec6ef0
              
                Temp. applied patch from #12272 to test compile fix
              
              
                bandoti bb93531
              
                Fix indent
              
              
                bandoti 6140bc0
              
                Merge branch 'master' into ci-build-cross
              
              
                bandoti 16aef52
              
                Add arm64 build
              
              
                bandoti ee51858
              
                Revert temp. applied patch from #12272 to test compile fix
              
              
                bandoti f92353d
              
                Merge branch 'master' into ci-build-cross
              
              
                bandoti 9c4cef4
              
                Merge branch 'master' into ci-build-cross
              
              
                bandoti 5ad6133
              
                Re-Activate RISCV builds
              
              
                bandoti 610dda1
              
                Use gcc/g++ 14 instead of default in crossbuild-essentials
              
              
                bandoti ed65c64
              
                Use gcc/g++ 14 instead of crossbuild-essential
              
              
                bandoti 67dde0b
              
                Update build-linux-cross.yml
              
              
                bandoti 78fa6a5
              
                Use cmake switch for position-independent code
              
              
                bandoti File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,124 @@ | ||
| name: Build on Linux using cross-compiler | ||
| on: | ||
| workflow_dispatch: | ||
| workflow_call: | ||
| 
     | 
||
| jobs: | ||
| ubuntu-latest-riscv64-cpu-cross: | ||
| runs-on: ubuntu-latest | ||
| 
     | 
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Setup Riscv | ||
| run: | | ||
| sudo dpkg --add-architecture riscv64 | ||
| sudo sed -i 's|http://azure.archive.ubuntu.com/ubuntu|http://ports.ubuntu.com/ubuntu-ports|g' \ | ||
| /etc/apt/sources.list /etc/apt/apt-mirrors.txt | ||
| sudo apt-get clean | ||
| sudo apt-get update | ||
| sudo apt-get install -y --no-install-recommends \ | ||
| build-essential \ | ||
| gcc-14-riscv64-linux-gnu \ | ||
| g++-14-riscv64-linux-gnu | ||
| 
     | 
||
| - name: Build | ||
| run: | | ||
| cmake -B build -DCMAKE_BUILD_TYPE=Release \ | ||
| -DGGML_OPENMP=OFF \ | ||
| -DLLAMA_BUILD_EXAMPLES=ON \ | ||
| -DLLAMA_BUILD_TESTS=OFF \ | ||
| -DCMAKE_SYSTEM_NAME=Linux \ | ||
| -DCMAKE_SYSTEM_PROCESSOR=riscv64 \ | ||
| -DCMAKE_C_COMPILER=riscv64-linux-gnu-gcc-14 \ | ||
| -DCMAKE_CXX_COMPILER=riscv64-linux-gnu-g++-14 \ | ||
| -DCMAKE_C_FLAGS_INIT='-fPIC' \ | ||
| -DCMAKE_CXX_FLAGS_INIT='-fPIC' \ | ||
| -DCMAKE_FIND_ROOT_PATH=/usr/lib/riscv64-linux-gnu \ | ||
| -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \ | ||
| -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \ | ||
| -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH | ||
| 
     | 
||
| cmake --build build --config Release -j $(nproc) | ||
| 
     | 
||
| ubuntu-latest-riscv64-vulkan-cross: | ||
| runs-on: ubuntu-latest | ||
| 
     | 
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| 
     | 
||
| - name: Setup Riscv | ||
| run: | | ||
| sudo dpkg --add-architecture riscv64 | ||
| sudo sed -i 's|http://azure.archive.ubuntu.com/ubuntu|http://ports.ubuntu.com/ubuntu-ports|g' \ | ||
| /etc/apt/sources.list /etc/apt/apt-mirrors.txt | ||
| sudo apt-get clean | ||
| sudo apt-get update | ||
| sudo apt-get install -y --no-install-recommends \ | ||
| build-essential \ | ||
| glslc \ | ||
| gcc-14-riscv64-linux-gnu \ | ||
| g++-14-riscv64-linux-gnu \ | ||
| libvulkan-dev:riscv64 | ||
| 
     | 
||
| - name: Build | ||
| run: | | ||
| cmake -B build -DCMAKE_BUILD_TYPE=Release \ | ||
| -DGGML_VULKAN=ON \ | ||
| -DGGML_OPENMP=OFF \ | ||
| -DLLAMA_BUILD_EXAMPLES=ON \ | ||
| -DLLAMA_BUILD_TESTS=OFF \ | ||
| -DCMAKE_SYSTEM_NAME=Linux \ | ||
| -DCMAKE_SYSTEM_PROCESSOR=riscv64 \ | ||
| -DCMAKE_C_COMPILER=riscv64-linux-gnu-gcc-14 \ | ||
| -DCMAKE_CXX_COMPILER=riscv64-linux-gnu-g++-14 \ | ||
| -DCMAKE_C_FLAGS_INIT='-fPIC' \ | ||
| -DCMAKE_CXX_FLAGS_INIT='-fPIC' \ | ||
| -DCMAKE_FIND_ROOT_PATH=/usr/lib/riscv64-linux-gnu \ | ||
| -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \ | ||
| -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \ | ||
| -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH | ||
| 
     | 
||
| cmake --build build --config Release -j $(nproc) | ||
| 
     | 
||
| ubuntu-latest-arm64-vulkan-cross: | ||
| runs-on: ubuntu-latest | ||
| 
     | 
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| 
     | 
||
| - name: Setup Arm64 | ||
| run: | | ||
| sudo dpkg --add-architecture arm64 | ||
| sudo sed -i 's|http://azure.archive.ubuntu.com/ubuntu|http://ports.ubuntu.com/ubuntu-ports|g' \ | ||
| /etc/apt/sources.list /etc/apt/apt-mirrors.txt | ||
| sudo apt-get clean | ||
| sudo apt-get update | ||
| sudo apt-get install -y --no-install-recommends \ | ||
| build-essential \ | ||
| glslc \ | ||
| crossbuild-essential-arm64 \ | ||
| libvulkan-dev:arm64 | ||
| 
     | 
||
| - name: Build | ||
| run: | | ||
| cmake -B build -DCMAKE_BUILD_TYPE=Release \ | ||
| -DGGML_VULKAN=ON \ | ||
| -DGGML_OPENMP=OFF \ | ||
| -DLLAMA_BUILD_EXAMPLES=ON \ | ||
| -DLLAMA_BUILD_TESTS=OFF \ | ||
| -DCMAKE_SYSTEM_NAME=Linux \ | ||
| -DCMAKE_SYSTEM_PROCESSOR=aarch64 \ | ||
| -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc \ | ||
| -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ \ | ||
| -DCMAKE_C_FLAGS_INIT='-fPIC' \ | ||
| -DCMAKE_CXX_FLAGS_INIT='-fPIC' \ | ||
| -DCMAKE_FIND_ROOT_PATH=/usr/lib/aarch64-linux-gnu \ | ||
| -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \ | ||
| -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \ | ||
| -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH | ||
| 
     | 
||
| cmake --build build --config Release -j $(nproc) | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.