Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
5ffc936
Fix Linux build for alternative architectures (riscv64, ppc64le, loon…
Nov 28, 2025
fa9d606
Fix Linux build dependency errors
Nov 30, 2025
0a2e9a5
Remove vscode files - they belong in cortexide repo, not builder repo
Nov 30, 2025
e64d972
Add patch to fix Linux build dependency errors
Nov 30, 2025
22eea1b
Fix TypeScript compilation errors for grok-2 model in xAI provider
Dec 2, 2025
9ee607f
Add grok-2 model definition to xAIModelOptions
Dec 2, 2025
fa104b0
Fix get_repo.sh: Remove vscode directory before cloning
Dec 2, 2025
fdbbe7e
Fix armhf sysroot download by removing VSCODE_SYSROOT_PREFIX override
Dec 2, 2025
1d29eb2
Fix Windows reh node download and add build helpers
Dec 4, 2025
146fb3f
Fix Windows REH node download by patching fetch.js event-stream usage
Dec 4, 2025
26f87f8
Fix fetch.ts event-stream import for Windows REH build
Dec 4, 2025
bf29462
Fix Windows REH fetch.js event-stream usage via patch
Dec 4, 2025
ff5d786
Fix both event-stream and ansi-colors imports in fetch.js for Windows…
Dec 4, 2025
56613e1
Add direct fetch.js import fix to build.sh for Windows REH compatibility
Dec 4, 2025
4ee7c12
Add fetch.js import fix to all REH build scripts (Windows, Linux, Alp…
Dec 5, 2025
8e4b307
create patch for ansi colors
Dec 5, 2025
17d6889
create patch for ansi colors
Dec 5, 2025
0b3b033
more patches
Dec 5, 2025
c4c16c1
fix: Add patch for custom Electron repository support in riscv64 builds
Dec 5, 2025
9c79c3f
fix: Make dependency check optional for architectures without referen…
Dec 5, 2025
dba159f
fix: Update electron-custom-repo patch with correct context
Dec 5, 2025
ae36c40
fix: Improve electron-custom-repo patch context specificity
Dec 5, 2025
1c1948b
fix: Remove darwin rename change from electron-custom-repo patch
Dec 5, 2025
266927a
fix: Make electron-custom-repo patch idempotent to prevent duplicate …
Dec 5, 2025
5fbeaf6
fix: Use let instead of const for electronOverride to allow redeclara…
Dec 5, 2025
093ba0c
fix: Make electron-custom-repo patch safe for multiple applications
Dec 5, 2025
1d0c7b5
fix: Use var with self-initialization to prevent duplicate declaratio…
Dec 5, 2025
73cbeef
add patch to fix linux build
Dec 5, 2025
4fa0841
wip
Dec 5, 2025
7c5d90a
fix dependency
Dec 5, 2025
a3c172a
wip
Dec 5, 2025
0386134
Fix dependency validation and Electron repository override patches
Dec 5, 2025
fb48836
Fix patch formatting: use \n instead of literal newlines
Dec 6, 2025
81b41a7
Regenerate patch from cortexide repo to fix application issues
Dec 6, 2025
bfa7b3f
Fix patch: correct insertion point for dependency check code
Dec 6, 2025
54fe133
Add trailing newline to patch file
Dec 6, 2025
1c6dd71
Regenerate patch using git diff for proper format
Dec 6, 2025
251c5e6
Fix Linux build inconsistencies and improve cross-platform consistency
Dec 6, 2025
d555254
Fix: Compile build directory TypeScript before gulp tasks
Dec 6, 2025
034e574
Fix rimraf import issue in build/lib/util.ts
Dec 6, 2025
352b53e
Fix rimraf import: use require() for CommonJS rimraf 2.2.8
Dec 6, 2025
e83d397
Update Linux build patches for VS Code 1.106 compatibility
Dec 6, 2025
50a5ae3
Fix rimraf import patch formatting for proper application
Dec 6, 2025
f9d3d3a
Make electron-custom-repo patch idempotent to prevent duplicate decla…
Dec 6, 2025
ca0686f
Fix electron-custom-repo patch: place code before method chain
Dec 6, 2025
9f2c4b8
Update documentation and patches for electronOverride fix
Dec 6, 2025
9e755e4
Remove LINUX_BUILD_FIX_SUMMARY.md documentation file
Dec 6, 2025
93c8eda
Fix Node.js version replacement for alternative architectures in pack…
Dec 6, 2025
27748f4
Add s390x to architectures that skip postinstall scripts
Dec 6, 2025
66eea5f
Update riscv64 to use Electron 37.10.3 with correct checksums
Dec 6, 2025
0dd0521
fix linux build
Dec 7, 2025
320e316
fix linux build
Dec 7, 2025
20a29db
fix build
Dec 7, 2025
67c57c5
fix build
Dec 7, 2025
3490286
fix last build issue
Dec 7, 2025
da6d770
Update the fix to match the patch
Dec 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions .github/workflows/stable-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
ref: ${{ env.GITHUB_BRANCH }}

- name: Switch to relevant branch
env:
Expand All @@ -83,6 +81,18 @@ jobs:
CHECK_ALL: 'yes'
run: ./check_tags.sh

- name: Set job outputs
id: set-outputs
run: |
echo "MS_COMMIT=${MS_COMMIT:-}" >> "$GITHUB_OUTPUT"
echo "MS_TAG=${MS_TAG:-}" >> "$GITHUB_OUTPUT"
echo "RELEASE_VERSION=${RELEASE_VERSION:-}" >> "$GITHUB_OUTPUT"
echo "SHOULD_BUILD=${SHOULD_BUILD:-no}" >> "$GITHUB_OUTPUT"
echo "SHOULD_DEPLOY=${SHOULD_DEPLOY:-no}" >> "$GITHUB_OUTPUT"
echo "SHOULD_BUILD_REH=${SHOULD_BUILD_REH:-no}" >> "$GITHUB_OUTPUT"
echo "SHOULD_BUILD_REH_WEB=${SHOULD_BUILD_REH_WEB:-no}" >> "$GITHUB_OUTPUT"
echo "SHOULD_BUILD_REH_ALPINE=${SHOULD_BUILD_REH_ALPINE:-no}" >> "$GITHUB_OUTPUT"

compile:
needs:
- check
Expand Down Expand Up @@ -263,9 +273,12 @@ jobs:

- name: Build
env:
CI_BUILD: 'yes'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
npm_config_arch: ${{ matrix.npm_arch }}
NODE_OPTIONS: "--max-old-space-size=12288"
OS_NAME: linux
VSCODE_PLATFORM: linux
run: |
echo "Packaging CortexIDE for Linux ${VSCODE_ARCH}..."
echo "Using pre-compiled artifacts and building platform-specific binaries"
Expand Down Expand Up @@ -399,8 +412,11 @@ jobs:

- name: Build
env:
CI_BUILD: 'yes'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
npm_config_arch: ${{ matrix.npm_arch }}
OS_NAME: linux
VSCODE_PLATFORM: linux
run: ./build/linux/package_reh.sh
if: env.DISABLED != 'yes' && (env.SHOULD_BUILD_REH != 'no' || env.SHOULD_BUILD_REH_WEB != 'no' || github.event.inputs.generate_assets == 'true')

Expand Down
291 changes: 291 additions & 0 deletions BUILD.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,291 @@
# CortexIDE Builder - Linux Build Guide

## Linux Build Prerequisites

### System Dependencies

Install the following packages on Ubuntu/Debian-based systems:

```bash
sudo apt-get update
sudo apt-get install -y \
build-essential \
libkrb5-dev \
libnss3-dev \
libatk-bridge2.0-dev \
libdrm2 \
libxkbcommon-dev \
libxcomposite-dev \
libxdamage-dev \
libxrandr-dev \
libgbm-dev \
libxss1 \
libasound2-dev \
python3 \
python3-pip \
git \
curl \
wget
```

For cross-compilation (ARM64, ARMHF, etc.), also install:

```bash
# For ARM64
sudo apt-get install -y \
gcc-aarch64-linux-gnu \
g++-aarch64-linux-gnu \
crossbuild-essential-arm64

# For ARMHF
sudo apt-get install -y \
gcc-arm-linux-gnueabihf \
g++-arm-linux-gnueabihf \
crossbuild-essential-armhf
```

### Node.js and Rust

- **Node.js**: v22.15.1 (matches CI)
- **Rust**: Latest stable (installed via rustup)
- **Python**: 3.11+

Install Node.js:
```bash
# Using nvm (recommended)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
nvm install 22.15.1
nvm use 22.15.1

# Or download from nodejs.org
```

Install Rust:
```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
```

### Memory Requirements

- **Minimum**: 16GB RAM
- **Recommended**: 32GB RAM
- Node.js will use up to 12GB during build (configured via `NODE_OPTIONS`)

## Local Linux Build

### Quick Start

```bash
# Set environment variables
export APP_NAME="CortexIDE"
export BINARY_NAME="cortexide"
export VSCODE_QUALITY="stable"
export CI_BUILD="no" # For local builds
export SHOULD_BUILD="yes"
export OS_NAME="linux"
export VSCODE_ARCH="x64" # or "arm64", "armhf", etc.

# Run the build
./build.sh

# Output will be in: ../VSCode-linux-${VSCODE_ARCH}/
# Binary: ../VSCode-linux-${VSCODE_ARCH}/bin/cortexide
```

### Build Process

The Linux build follows these steps:

1. **Source Preparation**: Fetches CortexIDE source code
2. **Dependency Installation**: Installs npm packages
3. **TypeScript Compilation**: Compiles the codebase
4. **React Build**: Builds CortexIDE's React components
5. **Extension Compilation**: Compiles built-in extensions
6. **Minification**: Bundles and minifies the application
7. **Packaging**: Creates Linux binaries and packages

### Architecture-Specific Builds

#### x64 (Intel/AMD 64-bit)
```bash
export VSCODE_ARCH="x64"
./build.sh
```

#### ARM64
```bash
export VSCODE_ARCH="arm64"
# Ensure cross-compilation tools are installed
./build.sh
```

#### ARMHF (32-bit ARM)
```bash
export VSCODE_ARCH="armhf"
# Ensure cross-compilation tools are installed
./build.sh
```

## CI Build Process

The GitHub Actions workflow (`.github/workflows/stable-linux.yml`) uses a two-stage build:

### Stage 1: Compile Job
- Compiles TypeScript and React components once
- Creates a tarball artifact (`vscode.tar.gz`)
- Runs on `ubuntu-22.04`

### Stage 2: Build Jobs (Matrix)
- Downloads the compiled artifact
- Packages for each architecture in parallel
- Uses Docker containers for cross-compilation
- Creates `.deb`, `.rpm`, `.tar.gz`, and optionally `.AppImage` packages

### CI Environment Variables

The workflow automatically sets:
- `CI_BUILD=yes`
- `OS_NAME=linux`
- `VSCODE_PLATFORM=linux`
- `VSCODE_ARCH` (per matrix job: x64, arm64, armhf, etc.)
- `NODE_OPTIONS=--max-old-space-size=12288`

## Building Packages

After a successful build, create distribution packages:

```bash
# Set packaging options
export SHOULD_BUILD_DEB="yes" # Create .deb package
export SHOULD_BUILD_RPM="yes" # Create .rpm package
export SHOULD_BUILD_TAR="yes" # Create .tar.gz archive
export SHOULD_BUILD_APPIMAGE="yes" # Create AppImage (x64 only)

# Run packaging
./prepare_assets.sh

# Outputs will be in: assets/
# - cortexide-${VERSION}-${ARCH}.deb
# - cortexide-${VERSION}-${ARCH}.rpm
# - cortexide-linux-${ARCH}-${VERSION}.tar.gz
# - cortexide-${VERSION}-${ARCH}.AppImage (if enabled)
```

## Troubleshooting

### Build Fails with "utils.sh not found"

**Issue**: Script can't find `utils.sh`
**Solution**: Ensure you're running scripts from the builder root directory, or the scripts have been updated to use absolute paths (fixed in recent updates).

### Build Fails with "CI_BUILD is no"

**Issue**: Script exits because `CI_BUILD` is set to "no"
**Solution**: For local builds, set `CI_BUILD="no"` and use `./build.sh` instead of `./build/linux/package_bin.sh`. The `package_bin.sh` script is CI-only.

### Out of Memory Errors

**Issue**: Node.js runs out of memory during build
**Solution**: Increase memory limit:
```bash
export NODE_OPTIONS="--max-old-space-size=16384" # 16GB
# Or for 32GB systems:
export NODE_OPTIONS="--max-old-space-size=24576" # 24GB
```

### Cross-Compilation Fails

**Issue**: ARM builds fail with linker errors
**Solution**: Ensure cross-compilation toolchain is installed:
```bash
# For ARM64
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu

# For ARMHF
sudo apt-get install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
```

### Electron Binary Download Fails

**Issue**: Alternative architectures (riscv64, ppc64le, loong64) can't download Electron
**Solution**: These architectures use custom Electron repositories. The build scripts automatically handle this via environment variables:
- `VSCODE_ELECTRON_REPOSITORY`: Custom repository
- `VSCODE_ELECTRON_TAG`: Specific Electron version

### React Build Fails

**Issue**: `npm run buildreact` fails
**Solution**: Clean and rebuild:
```bash
cd vscode
rm -rf src/vs/workbench/contrib/*/browser/react/out
npm run buildreact
```

## Build Scripts Reference

### Main Scripts

- **`build.sh`**: Main build script (for local builds)
- **`build/linux/package_bin.sh`**: CI packaging script (requires `CI_BUILD=yes`)
- **`build/linux/package_reh.sh`**: Remote Extension Host packaging
- **`build/linux/deps.sh`**: Installs system dependencies
- **`prepare_assets.sh`**: Creates distribution packages

### Environment Variables

| Variable | Description | Default |
|----------|-------------|---------|
| `APP_NAME` | Application name | `CortexIDE` |
| `BINARY_NAME` | Binary executable name | `cortexide` |
| `VSCODE_ARCH` | Target architecture | `x64` |
| `VSCODE_QUALITY` | Build quality | `stable` |
| `CI_BUILD` | CI mode flag | `no` (local) / `yes` (CI) |
| `OS_NAME` | Operating system | `linux` |
| `VSCODE_PLATFORM` | Platform identifier | `linux` |
| `NODE_OPTIONS` | Node.js options | `--max-old-space-size=12288` |

## Testing Your Build

### Quick Test
```bash
# Run the built binary
../VSCode-linux-${VSCODE_ARCH}/bin/cortexide --version

# Or launch the full application
../VSCode-linux-${VSCODE_ARCH}/bin/cortexide
```

### Install and Test .deb Package
```bash
sudo dpkg -i assets/cortexide-${VERSION}-${ARCH}.deb
sudo apt-get install -f # Fix dependencies if needed
cortexide --version
```

### Install and Test .rpm Package
```bash
sudo rpm -i assets/cortexide-${VERSION}-${ARCH}.rpm
cortexide --version
```

## Known Limitations

- **AppImage**: Only supported for x64 architecture
- **Alternative Architectures**: riscv64, ppc64le, loong64 require custom Electron builds
- **Snap Package**: Currently disabled in CI (commented out in workflow)
- **Local Builds**: Some alternative architectures may not work locally without proper cross-compilation setup

## Next Steps

1. **Test Local Build**: Follow "Quick Start" section
2. **Test CI Build**: Push to GitHub and check Actions
3. **Create Release**: Use `./release.sh` after successful build
4. **Report Issues**: Check build logs and report any problems

## Additional Resources

- **General Build Instructions**: See `BUILD_INSTRUCTIONS.md`
- **Migration Notes**: See `MIGRATION_SUMMARY.md`
- **CI Workflows**: See `.github/workflows/stable-linux.yml`
Loading