Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
19 changes: 18 additions & 1 deletion .github/workflows/apt-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ permissions:

jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down Expand Up @@ -83,6 +83,23 @@ jobs:

- name: Set up repository structure
run: |
# Create .nojekyll file to disable Jekyll processing
touch .nojekyll

# Create .gitignore for gh-pages branch to ignore problematic files
cat > .gitignore << 'GITEOF'
# Bazel artifacts (symlinks that cause Jekyll issues)
bazel-*

# Temporary files
*.tmp
*.log

# IDE files
.vscode/
.idea/
GITEOF

# Create the setup script inline (self-contained)
cat > setup-apt-repo.sh << 'EOF'
#!/usr/bin/env bash
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobs
jobs:
build-and-test:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v4
Expand All @@ -38,7 +38,7 @@ jobs:
run: bazel test //src:all //src/quipper:all

test-deb-build:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down Expand Up @@ -94,7 +94,7 @@ jobs:
retention-days: 7

test-apt-scripts:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
needs: test-deb-build
steps:
- name: Checkout code
Expand Down
16 changes: 15 additions & 1 deletion scripts/build-deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ mkdir -p "$OUTDIR"

# Build the project with Bazel (with static linking for better compatibility)
echo "Building perf_to_profile with Bazel..."
bazel build --config=opt --linkopt=-static-libgcc --linkopt=-static-libstdc++ //src:perf_to_profile
bazel build \
--compilation_mode=opt \
--linkopt=-static-libgcc \
--linkopt=-static-libstdc++ \
//src:perf_to_profile

# Install FPM (skip if FPM_SKIP_INSTALL is set, e.g., in CI)
if [[ "${FPM_SKIP_INSTALL:-}" != "1" ]]; then
Expand All @@ -28,8 +32,18 @@ mkdir -p "$BIN_DIR"

# Copy the Bazel-built binary to the temporary directory
cp bazel-bin/src/perf_to_profile "$BIN_DIR/"

# Make sure the binary is writable and executable before stripping
chmod u+w "$BIN_DIR/perf_to_profile"
chmod +x "$BIN_DIR/perf_to_profile"

# Strip the binary to reduce size and remove debug symbols
strip "$BIN_DIR/perf_to_profile" || echo "Warning: Could not strip binary (not critical)"

# Check binary dependencies for debugging
echo "Binary dependencies:"
ldd "$BIN_DIR/perf_to_profile" || echo "Static binary (no dynamic dependencies)"

# Create the .deb package using FPM
fpm -s dir -t deb \
-n perf-data-converter \
Expand Down
70 changes: 70 additions & 0 deletions scripts/check-binary-compatibility.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/usr/bin/env bash
set -euo pipefail

# Script to check binary compatibility and suggest fixes
# Usage: ./scripts/check-binary-compatibility.sh [binary_path]

BINARY_PATH="${1:-/usr/local/bin/perf_to_profile}"

echo "🔍 Checking binary compatibility for: $BINARY_PATH"

if [[ ! -f "$BINARY_PATH" ]]; then
echo "❌ Binary not found: $BINARY_PATH"
exit 1
fi

echo ""
echo "📋 Binary information:"
file "$BINARY_PATH"

echo ""
echo "🔗 Dynamic library dependencies:"
if ldd "$BINARY_PATH" 2>/dev/null; then
echo ""
echo "📊 Checking for problematic dependencies..."

# Check for newer glibc requirements
if ldd "$BINARY_PATH" | grep -q "GLIBC_2.3[0-9]"; then
echo "⚠️ Warning: Binary requires newer GLIBC (2.30+)"
echo " This may not work on older systems like Ubuntu 18.04 or CentOS 7"
fi

# Check for newer libstdc++ requirements
if ldd "$BINARY_PATH" | grep -q "GLIBCXX_3.4.3[0-9]"; then
echo "⚠️ Warning: Binary requires newer GLIBCXX (3.4.30+)"
echo " This may not work on older systems"
fi

# Check if libraries are statically linked
if ldd "$BINARY_PATH" | grep -q "libstdc++"; then
echo "⚠️ Warning: libstdc++ is dynamically linked"
echo " Consider using --linkopt=-static-libstdc++ for better compatibility"
fi

if ldd "$BINARY_PATH" | grep -q "libgcc"; then
echo "⚠️ Warning: libgcc is dynamically linked"
echo " Consider using --linkopt=-static-libgcc for better compatibility"
fi

else
echo "✅ Static binary (no dynamic dependencies) - excellent compatibility!"
fi

echo ""
echo "🧪 Testing basic functionality:"
if "$BINARY_PATH" --help >/dev/null 2>&1; then
echo "✅ Binary executes successfully"
else
echo "❌ Binary failed to execute"
echo ""
echo "🔧 Troubleshooting steps:"
echo "1. Check if you're on a compatible system:"
echo " ldd --version"
echo "2. Install missing dependencies:"
echo " sudo apt-get install libc6 libstdc++6 libgcc-s1"
echo "3. Try running with verbose error output:"
echo " LD_DEBUG=libs $BINARY_PATH --help"
fi

echo ""
echo "🏁 Compatibility check complete!"
3 changes: 3 additions & 0 deletions scripts/setup-apt-repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ echo "Setting up APT repository structure..."
# Create directories if they don't exist
mkdir -p conf pool/main/p/perf-data-converter dists

# Create .nojekyll file to disable Jekyll processing on GitHub Pages
touch .nojekyll

echo "Creating reprepro configuration..."

# Create reprepro configuration with separate distribution blocks
Expand Down
3 changes: 3 additions & 0 deletions scripts/setup-gh-pages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ git rm -rf . 2>/dev/null || true
echo "Creating APT repository structure..."
mkdir -p conf pool/main/p/perf-data-converter dists

# Create .nojekyll file to disable Jekyll processing
touch .nojekyll

# Create initial reprepro configuration
cat > conf/distributions << 'EOF'
Origin: perf_data_converter
Expand Down