Skip to content

"next build" fails in environments with glibc < 2.18 #33854

@nana4gonta

Description

@nana4gonta

Run next info (available from version 12.0.8 and up)

    Operating System:
      Platform: linux
      Arch: x64
      Version: #1 SMP Sat Jul 3 21:51:47 UTC 2021
    Binaries:
      Node: 16.13.2
      npm: 8.1.2
      Yarn: 1.22.17
      pnpm: N/A
    Relevant packages:
      next: 12.0.10-canary.2
      react: 17.0.2
      react-dom: 17.0.2

What version of Next.js are you using?

12.0.10

What version of Node.js are you using?

16.13.2

What browser are you using?

none

What operating system are you using?

Linux (Docker image based on CentOS 7)

How are you deploying your application?

Other

Describe the Bug

When I run next build, I get the error "/lib64/libc.so.6: version `GLIBC_2.18' not found" and cannot build.
It seems to have been fixed in swc (swc-project/swc#3314), so I would like to see it taken into the @next/swc package if possible.

$ # yarn run build
yarn run v1.22.17
$ next build
Attention: Next.js now collects completely anonymous telemetry regarding usage.
This information is used to shape Next.js' roadmap and prioritize features.
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
https://nextjs.org/telemetry

info  - Checking validity of types  
info  - Attempted to load @next/swc-linux-x64-gnu, but an error occurred: /lib64/libc.so.6: version `GLIBC_2.18' not found (required by /src/app/node_modules/@next/swc-linux-x64-gnu/next-swc.linux-x64-gnu.node)
info  - Attempted to load @next/swc-linux-x64-gnux32, but it was not installed
info  - Attempted to load @next/swc-linux-x64-musl, but an error occurred: libc.musl-x86_64.so.1: cannot open shared object file: No such file or directory
error - Failed to load SWC binary for linux/x64, see more info here: https://nextjs.org/docs/messages/failed-loading-swc
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
$ cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)

$ yum list installed | grep glibc
glibc.x86_64                            2.17-325.el7_9               @updates   
glibc-common.x86_64                     2.17-325.el7_9               @updates   
glibc-devel.x86_64                      2.17-325.el7_9               @updates   
glibc-headers.x86_64                    2.17-325.el7_9               @updates

Expected Behavior

Execution of next build succeeds even if GLIBC < 2.18.

To Reproduce

Run next build on CentOS 7 Docker image

in host OS

$ docker pull centos:7
$ docker run --rm -it centos:7 /bin/bash

in docker

# yum install gcc
# yum update
# curl -fsSL https://rpm.nodesource.com/setup_16.x | bash -
# yum install -y nodejs
# npx create-next-app@latest --typescript
# npm run build

Metadata

Metadata

Assignees

No one assigned

    Labels

    SWCRelated to minification/transpilation in Next.js.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions