From 1d573c09c9c48ab2bcb27583d054fe069b98c9e6 Mon Sep 17 00:00:00 2001 From: peefy Date: Tue, 25 Jun 2024 16:19:09 +0800 Subject: [PATCH] zzz: linux Signed-off-by: peefy --- .github/workflows/build-test-centos7.yaml | 38 ++++++++++++++++++++ .github/workflows/build-test-linux-arm64.yml | 30 ++-------------- Makefile | 2 +- kclvm/compiler/src/codegen/llvm/context.rs | 3 -- kclvm/compiler/src/codegen/llvm/metadata.rs | 30 +--------------- 5 files changed, 43 insertions(+), 60 deletions(-) create mode 100644 .github/workflows/build-test-centos7.yaml diff --git a/.github/workflows/build-test-centos7.yaml b/.github/workflows/build-test-centos7.yaml new file mode 100644 index 000000000..ea02cff9b --- /dev/null +++ b/.github/workflows/build-test-centos7.yaml @@ -0,0 +1,38 @@ +name: Build and Test on centos7 amd64 + +on: ["push", "pull_request"] + +jobs: + build-and-test-arm64: + name: Build and Test on Linux ARM64 + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v3 + with: + submodules: "true" + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + with: + platforms: linux/amd64 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Pull custom ARM64 Docker image + run: | + docker pull kcllang/kcl-builder:centos7 + + - name: Run custom ARM64 Docker image + run: | + docker run --rm --platform linux/arm64 \ + -v ${{ github.workspace }}:/workspace -w /workspace \ + kcllang/kcl-builder:centos7 \ + source ~/bash_profile && export PATH=$PATH:/opt/build/bin && sed -i '' 's/llvm12/llvm7/g' kclvm/compiler/Cargo.toml && make && make release + + - name: Upload Artifact + uses: actions/upload-artifact@v3 + with: + name: kcl-centos7-amd64 + path: _build/dist/centos/kclvm diff --git a/.github/workflows/build-test-linux-arm64.yml b/.github/workflows/build-test-linux-arm64.yml index 7f74d3fd6..e29df46ae 100644 --- a/.github/workflows/build-test-linux-arm64.yml +++ b/.github/workflows/build-test-linux-arm64.yml @@ -1,12 +1,6 @@ name: Build and Test on Linux ARCH64 -on: - push: - branches: - - main - pull_request: - branches: - - main +on: ["push", "pull_request"] jobs: build-and-test-arm64: @@ -17,33 +11,15 @@ jobs: uses: actions/checkout@v3 with: submodules: "true" - - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: 1.21 - - - name: Install prerequisites - run: | - sudo apt-get update - sudo apt-get install -y git wget curl make python3 python3-pip clang-12 lld-12 - sudo ln -sf /usr/bin/clang-12 /usr/bin/clang - - name: Install rust nightly toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.76 - override: true - components: clippy, rustfmt - - name: Set up QEMU uses: docker/setup-qemu-action@v2 with: platforms: linux/amd64,linux/arm64 - + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - + - name: Pull custom ARM64 Docker image run: | docker pull --platform linux/arm64 kcllang/kcl-builder-arm64 diff --git a/Makefile b/Makefile index d3f59142e..029402218 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ PROJECT_NAME = KCLVM PWD:=$(shell pwd) VERSION := $(shell cat VERSION) -BUILD_IMAGE:=kcllang/kcl-builder +BUILD_IMAGE:=kcllang/kcl-builder:centos7 # export DOCKER_DEFAULT_PLATFORM=linux/amd64 # or diff --git a/kclvm/compiler/src/codegen/llvm/context.rs b/kclvm/compiler/src/codegen/llvm/context.rs index 663fe01b9..dd1077aeb 100644 --- a/kclvm/compiler/src/codegen/llvm/context.rs +++ b/kclvm/compiler/src/codegen/llvm/context.rs @@ -4,7 +4,6 @@ use indexmap::{IndexMap, IndexSet}; use inkwell::basic_block::BasicBlock; use inkwell::builder::Builder; use inkwell::context::Context; -use inkwell::debug_info::{DICompileUnit, DebugInfoBuilder}; use inkwell::memory_buffer::MemoryBuffer; use inkwell::module::{Linkage, Module}; use inkwell::support::LLVMString; @@ -137,8 +136,6 @@ pub struct LLVMCodeGenContext<'ctx> { /// LLVM module with debug info builder and compile unit. pub struct DebugModule<'ctx> { pub inner: Module<'ctx>, - pub dibuilder: DebugInfoBuilder<'ctx>, - pub compile_unit: DICompileUnit<'ctx>, } impl<'ctx> CodeGenObject for BasicValueEnum<'ctx> {} diff --git a/kclvm/compiler/src/codegen/llvm/metadata.rs b/kclvm/compiler/src/codegen/llvm/metadata.rs index 82a2bda5d..1aadda9ed 100644 --- a/kclvm/compiler/src/codegen/llvm/metadata.rs +++ b/kclvm/compiler/src/codegen/llvm/metadata.rs @@ -1,38 +1,10 @@ // Copyright The KCL Authors. All rights reserved. use super::context::{DebugModule, LLVMCodeGenContext}; -use crate::codegen::traits::ProgramCodeGen; use inkwell::module::Module; impl<'ctx> LLVMCodeGenContext<'ctx> { pub(crate) fn create_debug_module(&self, module: Module<'ctx>) -> DebugModule<'ctx> { - let (dibuilder, compile_unit) = module.create_debug_info_builder( - true, - /* language */ inkwell::debug_info::DWARFSourceLanguage::C, - /* filename */ &self.current_pkgpath(), - /* directory */ ".", - /* producer */ "kcl", - /* is_optimized */ false, - /* compiler command line flags */ "", - /* runtime_ver */ 0, - /* split_name */ "", - /* kind */ inkwell::debug_info::DWARFEmissionKind::Full, - /* dwo_id */ 0, - /* split_debug_inling */ false, - /* debug_info_for_profiling */ false, - /* sys_root */ ".", - "", - ); - let debug_metadata_version = self.context.i32_type().const_int(3, false); - module.add_basic_value_flag( - "Debug Info Version", - inkwell::module::FlagBehavior::Warning, - debug_metadata_version, - ); - DebugModule { - inner: module, - dibuilder, - compile_unit, - } + DebugModule { inner: module } } }