Comments (26)
@kdy1 It works perfectly both on my local docker container and our ci environment. Hooray!
from node-swc.
I've published v1.0.55
from node-swc.
@kdy1 Can you send me (leto.zju#hotmail.com) an invitation of https://swc-org.slack.com/ ?
from node-swc.
@cyjake https://swc-slackin.herokuapp.com/
swc provides prebuilt binary built with rustc, not clang. What does you mean by "use gcc 4.8"?
from node-swc.
@cyjake Btw, please feel free to ping me on github or slack if you need any help using swc.
from node-swc.
@kdy1 I believe the linux environment that runs rustc is default to gcc 5.4 https://github.com/swc-project/node-swc/blob/master/.travis.yml#L76 hence make the linked binary demanding cxxabi_1.3.9 (which is the abi version provided by gcc 5)
from node-swc.
@cyjake I got it. I'll publish a new version asap.
from node-swc.
@cyjake I published v1.0.54.
Can you check if the issue is solved?
from node-swc.
nope. I'll investigate
from node-swc.
@cyjake Although it's a rough guess, maybe an envrionment variable CC=gcc-4.8
is required
from node-swc.
@kdy1 Yeah, I was composing a comment about the same suspect :-)
from node-swc.
@cyjake I configured CC
and CXX
.
Can you check it? I don't have a linux machine.
Steps
- Download appropriate version of binary from
https://github.com/swc-project/node-swc/releases/tag/v1.0.55
57 is for node@8, 64 is for node@10, 67 is for node@11 and 72 is for node@12.
-
git clone [email protected]:swc-project/node-swc.git
-
cd node-swc
-
Rename file downloaded on step 1 to native/index.node
-
Run
jest __tests__/import_test.js
from node-swc.
@cyjake If you are busy, I can test it tomorrow.
from node-swc.
I tried with https://github.com/swc-project/node-swc/releases/download/v1.0.55/linux-x64-64.node
> require('./lib/index')
Thrown:
Error: /root/foo/node-swc/native/index.node: invalid ELF header
at Object.Module._extensions..node (internal/modules/cjs/loader.js:807:18)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
> process.version
'v10.16.3'
Now that's something new... false alarm, I was trying with incomplete binary data.
from node-swc.
> require('./lib/index')
Thrown:
Error: /lib64/libc.so.6: version `GLIBC_2.18' not found (required by /home/admin/node-swc/native/index.node)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:807:18)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
It works but out system uses glibc 2.17. Which version of gcc was used to compile, 4.8 or 4.9?
from node-swc.
I think gcc 4.8 is used.
Lines 4 to 10 in b7ebded
Lines 12 to 13 in b7ebded
But I'm not sure and I'll investigate further.
from node-swc.
I think gcc and glibc versions aren't that correlated https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Linux_compatibility_matrix
It seems I have to provide a specific prebuilt package for our environment by myself. There're just too many gcc glibc versions to support if all of them needs to be supported by you.
from node-swc.
Oh.. It is much more complicated than I thought.
I guess using musl-libc can solve the issue. Do you mind it?
from node-swc.
It could be. But preparing another package for our linux infrastructure is another pain (there's no musl package yet) I'd rather not go through. I've tried and succeeded to build node-swc on my local docker container with default gcc and glibc settings, hence I think I should go with a slightly forked mirror.
from node-swc.
Hmm.. Despite of the linux compatibility table, many linux binary work without any issue. (especially programs written in golang)
Clearly, there's a way to support multiple glibc version with single binary.
I'll investigate further when I go home. I don't have a linux machine now.
And if possible, I want to avoid the situation where user rebuilt swc on their machine because building swc takes long time.
from node-swc.
Agree and much appreciated. It could still work If we can build with gcc 4.8 and glibc 2.17. I'm trying to find ways to accomplish that.
from node-swc.
@cyjake I've investigated, but I failed. I'll investigate further.
There's a simple solution, but I need more information.
I configured docker based build system on travis, so I can easily change version of the linked glibc. I guess you are using centos 7, right? I'll try it.
Investigations
(for who tries to do simillar thing)
- proc macro crates requires dynamic linking.
-
Works without any problem with
linux-gnu
target -
Requires
-C target-feature=-crt-static
on musl target
As this flags is also passed to non-proc macro crates, this disables static linking of libc and musl-libc.so is required on runtime.
-
Related: neon-bindings/neon#360 (comment)
- rust uses feature from
GLIBC_2.18
Related: rust-lang/rust#57497. But linkage is weak, so we can build it with older version of glibc.
linux-musl
target does not supportcrate-type = cdylib
According to https://github.com/wangbj/rust-staticlib-linker, I can do it but it will crash because nodejs uses glibc,
from node-swc.
Great findings! yes we're using centos 7.
from node-swc.
Guess we can use travis docker service with the centos image from docker hub.
from node-swc.
There's prebuilt binaries built on centos 7. Can you test it?
https://github.com/swc-project/node-swc/releases/tag/v1.0.55
I verified that it works with newer version of glibc (ubuntu 18.04, all updated).
from node-swc.
There's a validation script which successed to run on centos 7. Closing.
from node-swc.
Related Issues (14)
- Use serde_json with JSON.parse
- Support npm_config_build_from_source in place of SKIP_SWC_BINARY_DOWNLOAD_FOR_CI HOT 3
- when using @swc/core as a module, "minify" option is ignored HOT 1
- Builds for darwin-x64-79? HOT 2
- `i686-pc-windows-msvc` target may not be installed HOT 2
- Smaller binary size HOT 4
- Calling async API from node worker threads results in errors HOT 4
- transformSync with an AST does not transform HOT 7
- Can't seem to install HOT 5
- v1.1.43 Release HOT 3
- node14.2.0 HOT 1
- Error on alpine: Missing linux_musl-x64-83.node HOT 6
- Windows builds are broken
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-swc.