Code Monkey home page Code Monkey logo

Comments (26)

cyjake avatar cyjake commented on June 16, 2024 2

@kdy1 It works perfectly both on my local docker container and our ci environment. Hooray!

from node-swc.

kdy1 avatar kdy1 commented on June 16, 2024 1

I've published v1.0.55

from node-swc.

cyjake avatar cyjake commented on June 16, 2024

@kdy1 Can you send me (leto.zju#hotmail.com) an invitation of https://swc-org.slack.com/ ?

from node-swc.

kdy1 avatar kdy1 commented on June 16, 2024

@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.

kdy1 avatar kdy1 commented on June 16, 2024

@cyjake Btw, please feel free to ping me on github or slack if you need any help using swc.

from node-swc.

cyjake avatar cyjake commented on June 16, 2024

@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.

kdy1 avatar kdy1 commented on June 16, 2024

@cyjake I got it. I'll publish a new version asap.

from node-swc.

kdy1 avatar kdy1 commented on June 16, 2024

@cyjake I published v1.0.54.
Can you check if the issue is solved?

from node-swc.

cyjake avatar cyjake commented on June 16, 2024

nope. I'll investigate

from node-swc.

kdy1 avatar kdy1 commented on June 16, 2024

@cyjake Although it's a rough guess, maybe an envrionment variable CC=gcc-4.8 is required

from node-swc.

cyjake avatar cyjake commented on June 16, 2024

@kdy1 Yeah, I was composing a comment about the same suspect :-)

from node-swc.

kdy1 avatar kdy1 commented on June 16, 2024

@cyjake I configured CC and CXX.

Can you check it? I don't have a linux machine.

Steps

  1. 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.

  1. git clone [email protected]:swc-project/node-swc.git

  2. cd node-swc

  3. Rename file downloaded on step 1 to native/index.node

  4. Run jest __tests__/import_test.js

from node-swc.

kdy1 avatar kdy1 commented on June 16, 2024

@cyjake If you are busy, I can test it tomorrow.

from node-swc.

cyjake avatar cyjake commented on June 16, 2024

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.

cyjake avatar cyjake commented on June 16, 2024
> 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.

kdy1 avatar kdy1 commented on June 16, 2024

I think gcc 4.8 is used.

node-swc/.travis.yml

Lines 4 to 10 in b7ebded

addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-4.8
- g++-4.8

export CC=gcc-4.8
export CXX=g++-4.8


But I'm not sure and I'll investigate further.

from node-swc.

cyjake avatar cyjake commented on June 16, 2024

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.

kdy1 avatar kdy1 commented on June 16, 2024

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.

cyjake avatar cyjake commented on June 16, 2024

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.

kdy1 avatar kdy1 commented on June 16, 2024

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.

cyjake avatar cyjake commented on June 16, 2024

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.

kdy1 avatar kdy1 commented on June 16, 2024

@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 support crate-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.

cyjake avatar cyjake commented on June 16, 2024

Great findings! yes we're using centos 7.

from node-swc.

cyjake avatar cyjake commented on June 16, 2024

Guess we can use travis docker service with the centos image from docker hub.

from node-swc.

kdy1 avatar kdy1 commented on June 16, 2024

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.

kdy1 avatar kdy1 commented on June 16, 2024

There's a validation script which successed to run on centos 7. Closing.

from node-swc.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.