next-theme / hexo-word-counter

⏱️ Word count and time to read of articles for Hexo, written in Rust
https://www.npmjs.com/package/hexo-word-counter
GNU Lesser General Public License v3.0
28 stars 3 forks source link

GLIBC requirement #50

Closed tisonkun closed 4 months ago

tisonkun commented 7 months ago

See https://github.com/tisonkun/blog/issues/105.

I wonder if we can use a musl static link distribution or we can upgrade/extend the GLIBC requirement.

stevenjoezhang commented 6 months ago

Thank you for the feedback. I've looked into possible solutions and found that the neon library we're using doesn't support generating static binaries (see https://github.com/neon-bindings/neon/issues/360). Actually, I used to build hexo-word-counter in a newer compilation environment with a higher libc version. However, some users are using Cloudflare Pages' build environment with an older libc version, which isn't compatible. So, I switched to use an older one, but unfortunately, it's incompatible with Vercel. I'm not sure what the best approach to resolving this issue would be. Do you have any suggestions?

stevenjoezhang commented 4 months ago

@tisonkun I've found that Cloudflare Pages has updated their deployment environment, and I have now also updated to GLIBC version 2.31 on Ubuntu 20.04 (tests show that it also works under Ubuntu 22.04). You can try again.

npm i hexo-word-counter@0.2.0
stevenjoezhang commented 4 months ago

Cloudflare Pages environment:

截屏2024-04-18 00 11 10

Netlify environment:

截屏2024-04-18 00 14 30

As of April 2024, both of them are using ubuntu 20.04

tisonkun commented 4 months ago
image

I have updated to 0.2.0 but it seems still try to find GLIBC 2.28?

tisonkun commented 4 months ago

https://github.com/tisonkun/blog/commit/fcdb768a5a6e789e08fc53aff14af47ad1bad4ac

stevenjoezhang commented 4 months ago

Are you using Vercel for CI? I compiled your blog's code on a Vercel machine, and it shows that it works perfectly fine here. You can check if your Vercel build environment is different from mine. I am using Node.js 20.12.2.

Update: I think I know the cause of the problem. Switching to Node.js version 18 reproduces the same error.

截屏2024-04-18 10 47 05 截屏2024-04-18 10 36 08 截屏2024-04-18 10 40 08
tisonkun commented 4 months ago

Upgrade vercel runtime to Node 20 solves the issue.

Thank you!

stevenjoezhang commented 4 months ago

This issue is very strange. Using this plugin with Node.js 18 doesn't work on Vercel, but it does work on Cloudflare Pages.

tisonkun commented 4 months ago

I don't think it's about Node version actually. Perhaps Vercel packages different GLIBC on their "node 18" env.

tisonkun commented 4 months ago

This is what I feel uncomfortable with @vercel:

I'm trying to get an info list about the details of env on their deployment, but none of their docs tell what version of GLIBC is available on a certain env.

stevenjoezhang commented 4 months ago

Yes, in comparison, GitHub has done a good job; they have published the detailed version information of the software pre-installed in their CI images: https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2004-Readme.md