Skip to content

Commit 1fa0c00

Browse files
committed
target musl platforms
1 parent 8f24ab4 commit 1fa0c00

3 files changed

Lines changed: 116 additions & 2 deletions

File tree

.github/workflows/build.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,11 @@ jobs:
4141
min-node-version: 18
4242
rust: true
4343
only: darwin-arm64,darwin-x64,linux-arm64,linux-x64
44-
# Need this, now that libdatadog packages libunwind as a submodule
45-
prebuild: '(command -v apk >/dev/null && apk add autoconf automake libtool) || (command -v apt-get >/dev/null && apt-get update && apt-get install -y autoconf automake libtool) || true'
44+
# autoconf/automake/libtool: needed for libunwind submodule build.
45+
# gcc upgrade: the Docker builder images ship GCC 12 (Alpine 3.17) whose
46+
# crtbeginS.o produces .eh_frame registration code incompatible with
47+
# GCC 14+/15+ libgcc_s.so.1 at runtime, causing SIGSEGV on dlopen.
48+
prebuild: '(command -v apk >/dev/null && apk add autoconf automake libtool && echo "https://dl-cdn.alpinelinux.org/alpine/latest-stable/main" >> /etc/apk/repositories && apk update && apk upgrade gcc) || (command -v apt-get >/dev/null && apt-get update && apt-get install -y autoconf automake libtool) || true'
4649

4750
package-size:
4851
runs-on: ubuntu-latest

.github/workflows/release.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ jobs:
2929
min-node-version: 18
3030
rust: true
3131
only: darwin-arm64,darwin-x64,linux-arm64,linux-x64
32+
# autoconf/automake/libtool: needed for libunwind submodule build.
33+
# gcc upgrade: the Docker builder images ship GCC 12 (Alpine 3.17) whose
34+
# crtbeginS.o produces .eh_frame registration code incompatible with
35+
# GCC 14+/15+ libgcc_s.so.1 at runtime, causing SIGSEGV on dlopen.
36+
prebuild: '(command -v apk >/dev/null && apk add autoconf automake libtool && echo "https://dl-cdn.alpinelinux.org/alpine/latest-stable/main" >> /etc/apk/repositories && apk update && apk upgrade gcc) || (command -v apt-get >/dev/null && apt-get update && apt-get install -y autoconf automake libtool) || true'
3237

3338
publish:
3439
runs-on: ubuntu-latest

compare-local-vs-official.sh

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
echo "🚀 Local Build vs Official Package Comparison"
6+
echo "============================================="
7+
echo ""
8+
9+
# Colors for output
10+
GREEN='\033[0;32m'
11+
RED='\033[0;31m'
12+
YELLOW='\033[1;33m'
13+
NC='\033[0m' # No Color
14+
15+
echo "System Info:"
16+
echo " Alpine: $(cat /etc/alpine-release 2>/dev/null || echo 'N/A')"
17+
echo " Node.js: $(node --version)"
18+
echo " Arch: $(uname -m)"
19+
echo ""
20+
21+
# Test 1: Local Build
22+
echo -e "${YELLOW}📦 TEST 1: LOCAL BUILD${NC}"
23+
echo "================================"
24+
25+
echo "Testing local build..."
26+
LOCAL_RESULT=$(timeout 5s node -e "
27+
try {
28+
const lib = require('.');
29+
const ct = lib.load('crashtracker');
30+
31+
ct.init({
32+
additional_files: [], create_alt_stack: true, use_alt_stack: true,
33+
endpoint: { url: { scheme: 'http', authority: 'localhost:8126', path_and_query: '' }, timeout_ms: 3000 },
34+
timeout: { secs: 5, nanos: 0 }, demangle_names: true, signals: [],
35+
resolve_frames: 'EnabledWithSymbolsInReceiver', wait_for_receiver: false
36+
}, {
37+
args: [], env: [],
38+
path_to_receiver_binary: lib.find('crashtracker-receiver', true),
39+
stderr_filename: null, stdout_filename: null
40+
}, {
41+
library_name: 'local-test', library_version: '1.0.0',
42+
family: 'javascript', tags: ['local']
43+
});
44+
45+
console.log('SUCCESS');
46+
} catch (e) {
47+
console.log('ERROR: ' + e.message);
48+
}
49+
" 2>/dev/null || echo "SEGFAULT")
50+
51+
if [ "$LOCAL_RESULT" = "SUCCESS" ]; then
52+
echo -e "Result: ${GREEN}✅ SUCCESS - Local build works!${NC}"
53+
else
54+
echo -e "Result: ${RED}❌ FAILED - $LOCAL_RESULT${NC}"
55+
fi
56+
57+
echo ""
58+
59+
# Test 2: Official Package
60+
echo -e "${YELLOW}📦 TEST 2: OFFICIAL @datadog/libdatadog@0.9.2${NC}"
61+
echo "=================================================="
62+
63+
TEMP_DIR="./test-official-$$"
64+
echo "Setting up test environment in $TEMP_DIR..."
65+
66+
mkdir -p "$TEMP_DIR"
67+
cd "$TEMP_DIR"
68+
69+
echo "Installing official package..."
70+
npm init -y >/dev/null 2>&1
71+
npm install @datadog/libdatadog@0.9.2 >/dev/null 2>&1
72+
73+
echo "Testing official package..."
74+
OFFICIAL_RESULT=$(timeout 5s node -e "
75+
try {
76+
const lib = require('@datadog/libdatadog');
77+
const ct = lib.load('crashtracker');
78+
79+
ct.init({
80+
additional_files: [], create_alt_stack: true, use_alt_stack: true,
81+
endpoint: { url: { scheme: 'http', authority: 'localhost:8126', path_and_query: '' }, timeout_ms: 3000 },
82+
timeout: { secs: 5, nanos: 0 }, demangle_names: true, signals: [],
83+
resolve_frames: 'EnabledWithSymbolsInReceiver', wait_for_receiver: false
84+
}, {
85+
args: [], env: [],
86+
path_to_receiver_binary: lib.find('crashtracker-receiver', true),
87+
stderr_filename: null, stdout_filename: null
88+
}, {
89+
library_name: 'official-test', library_version: '0.9.2',
90+
family: 'javascript', tags: ['official']
91+
});
92+
93+
console.log('SUCCESS');
94+
} catch (e) {
95+
console.log('ERROR: ' + e.message);
96+
}
97+
" 2>/dev/null || echo "SEGFAULT")
98+
99+
cd ..
100+
rm -rf "$TEMP_DIR"
101+
102+
if [ "$OFFICIAL_RESULT" = "SUCCESS" ]; then
103+
echo -e "Result: ${GREEN}✅ SUCCESS - Official package works!${NC}"
104+
else
105+
echo -e "Result: ${RED}❌ FAILED - $OFFICIAL_RESULT${NC}"
106+
fi

0 commit comments

Comments
 (0)