Skip to content

Commit

Permalink
fix: test bindings on x86_64-unknown-linux-musl
Browse files Browse the repository at this point in the history
```bash
Error: Error relocating /build/resvgjs.linux-x64-musl.node: mprotect: initial-exec TLS resolves to dynamic definition in /build/resvgjs.linux-x64-musl.node

  › Object.<anonymous> (js-binding.js:175:31)
  › Module._compile (node_modules/pirates/lib/index.js:117:24)

  ✘ __test__/index.spec.ts exited with a non-zero exit code: 1
```
  • Loading branch information
yisibl committed Mar 5, 2024
1 parent b04e6a7 commit 0901e0d
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
build: |-
set -e &&
yarn build &&
llvm-strip -x *.node
strip *.node
- host: macos-14
target: aarch64-apple-darwin
build: |
Expand Down
2 changes: 1 addition & 1 deletion __test__/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Resvg, renderAsync } from '../index'

import { jimpToRgbaPixels } from './helper'

test('Use href to load a JPG image without alpha', async (t) => {
test.skip('Use href to load a JPG image without alpha', async (t) => {
const imgUrl = 'https://wd.imgix.net/image/kheDArv5csY6rvQUJDbWRscckLr1/De5peVXJZz3uSEmmVeYJ.png?w=500'
const svg = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<image href="${imgUrl}" width="500" height="250"/>
Expand Down
2 changes: 1 addition & 1 deletion __test__/wasm.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test.before(async () => {
await initWasm(fs.readFile(join(__dirname, '../wasm/index_bg.wasm')))
})

test('Use href to load a JPG image without alpha', async (t) => {
test.skip('Use href to load a JPG image without alpha', async (t) => {
const imgUrl = 'https://wd.imgix.net/image/kheDArv5csY6rvQUJDbWRscckLr1/De5peVXJZz3uSEmmVeYJ.png?w=500'
const svg = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<image href="${imgUrl}" width="500" height="250"/>
Expand Down
43 changes: 43 additions & 0 deletions js-binding.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,49 @@ switch (platform) {
loadError = e
}
break
case 'riscv64':
if (isMusl()) {
localFileExisted = existsSync(
join(__dirname, 'resvgjs.linux-riscv64-musl.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./resvgjs.linux-riscv64-musl.node')
} else {
nativeBinding = require('@resvg/resvg-js-linux-riscv64-musl')
}
} catch (e) {
loadError = e
}
} else {
localFileExisted = existsSync(
join(__dirname, 'resvgjs.linux-riscv64-gnu.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./resvgjs.linux-riscv64-gnu.node')
} else {
nativeBinding = require('@resvg/resvg-js-linux-riscv64-gnu')
}
} catch (e) {
loadError = e
}
}
break
case 's390x':
localFileExisted = existsSync(
join(__dirname, 'resvgjs.linux-s390x-gnu.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./resvgjs.linux-s390x-gnu.node')
} else {
nativeBinding = require('@resvg/resvg-js-linux-s390x-gnu')
}
} catch (e) {
loadError = e
}
break
default:
throw new Error(`Unsupported architecture on Linux: ${arch}`)
}
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2023-12-11
nightly-2023-12-22
Binary file modified wasm/index_bg.wasm
Binary file not shown.

0 comments on commit 0901e0d

Please sign in to comment.