Homebrew / homebrew-core

🍻 Default formulae for the missing package manager for macOS (or Linux)
https://brew.sh
BSD 2-Clause "Simplified" License
13.72k stars 12.41k forks source link

create-api and other swift packages fail to build from source on Ubuntu 20.04.5 LTS GitHub runner with linker error: undefined reference to __libc_csu_fini #113313

Closed marcprux closed 2 years ago

marcprux commented 2 years ago

brew gist-logs <formula> link OR brew config AND brew doctor output

HOMEBREW_VERSION: 3.6.3
ORIGIN: https://github.com/Homebrew/brew
HEAD: d5b6b068c15a8df60f0f5e34a4ca80dcf82c48e3
Last commit: 3 weeks ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 2a020ee889129f007a642a77020edcab3ffc9f73
Core tap last commit: 2 weeks ago
Core tap branch: master
HOMEBREW_PREFIX: /home/linuxbrew/.linuxbrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS: 3650
HOMEBREW_COLOR: set
HOMEBREW_MAKE_JOBS: 2
HOMEBREW_NO_AUTO_UPDATE: set
Homebrew Ruby: 2.6.8 => /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.8_1/bin/ruby
CPU: dual-core 64-bit skylake
Clang: 11.0.0
Git: 2.37.3 => /bin/git
Curl: 7.68.0 => /bin/curl
Kernel: Linux 5.15.0-1020-azure x86_64 GNU/Linux
OS: Ubuntu 20.04.5 LTS (focal)
Host glibc: 2.31
/usr/bin/gcc: 9.4.0
/usr/bin/ruby: 2.7.0
glibc: 2.35_1
gcc@11: N/A
gcc@12: 12.2.0
xorg: N/A
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and which additional flags to use when
compiling and linking.

Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew-provided
script of the same name. We found the following "config" scripts:
  /opt/pipx_bin/ansible-config

Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected header files:
  /usr/local/include/node/cppgc/common.h
  /usr/local/include/node/js_native_api.h
  /usr/local/include/node/js_native_api_types.h
  /usr/local/include/node/libplatform/libplatform-export.h
  /usr/local/include/node/libplatform/libplatform.h
  /usr/local/include/node/libplatform/v8-tracing.h
  /usr/local/include/node/node.h
  /usr/local/include/node/node_api.h
  /usr/local/include/node/node_api_types.h
  /usr/local/include/node/node_buffer.h
  /usr/local/include/node/node_object_wrap.h
  /usr/local/include/node/node_version.h
  /usr/local/include/node/openssl/aes.h
  /usr/local/include/node/openssl/archs/BSD-x86/asm/crypto/buildinf.h
  /usr/local/include/node/openssl/archs/BSD-x86/asm/crypto/include/internal/bn_conf.h
  /usr/local/include/node/openssl/archs/BSD-x86/asm/crypto/include/internal/dso_conf.h
  /usr/local/include/node/openssl/archs/BSD-x86/asm/include/openssl/opensslconf.h
  /usr/local/include/node/openssl/archs/BSD-x86/asm/include/progs.h
  /usr/local/include/node/openssl/archs/BSD-x86/asm_avx2/crypto/buildinf.h
  /usr/local/include/node/openssl/archs/BSD-x86/asm_avx2/crypto/include/internal/bn_conf.h
  /usr/local/include/node/openssl/archs/BSD-x86/asm_avx2/crypto/include/internal/dso_conf.h
  /usr/local/include/node/openssl/archs/BSD-x86/asm_avx2/include/openssl/opensslconf.h
  /usr/local/include/node/openssl/archs/BSD-x86/asm_avx2/include/progs.h
  /usr/local/include/node/openssl/archs/BSD-x86/no-asm/crypto/buildinf.h
  /usr/local/include/node/openssl/archs/BSD-x86/no-asm/crypto/include/internal/bn_conf.h
  /usr/local/include/node/openssl/archs/BSD-x86/no-asm/crypto/include/internal/dso_conf.h
  /usr/local/include/node/openssl/archs/BSD-x86/no-asm/include/openssl/opensslconf.h
  /usr/local/include/node/openssl/archs/BSD-x86/no-asm/include/progs.h
  /usr/local/include/node/openssl/archs/BSD-x86_64/asm/crypto/buildinf.h
  /usr/local/include/node/openssl/archs/BSD-x86_64/asm/crypto/include/internal/bn_conf.h
  /usr/local/include/node/openssl/archs/BSD-x86_64/asm/crypto/include/internal/dso_conf.h
  /usr/local/include/node/openssl/archs/BSD-x86_64/asm/include/openssl/opensslconf.h
  /usr/local/include/node/openssl/archs/BSD-x86_64/asm/include/progs.h
  /usr/local/include/node/openssl/archs/BSD-x86_64/asm_avx2/crypto/buildinf.h
  /usr/local/include/node/openssl/archs/BSD-x86_64/asm_avx2/crypto/include/internal/bn_conf.h
  /usr/local/include/node/openssl/archs/BSD-x86_64/asm_avx2/crypto/include/internal/dso_conf.h
  /usr/local/include/node/openssl/archs/BSD-x86_64/asm_avx2/include/openssl/opensslconf.h
  /usr/local/include/node/openssl/archs/BSD-x86_64/asm_avx2/include/progs.h
  /usr/local/include/node/openssl/archs/BSD-x86_64/no-asm/crypto/buildinf.h
  /usr/local/include/node/openssl/archs/BSD-x86_64/no-asm/crypto/include/internal/bn_conf.h
  /usr/local/include/node/openssl/archs/BSD-x86_64/no-asm/crypto/include/internal/dso_conf.h
  /usr/local/include/node/openssl/archs/BSD-x86_64/no-asm/include/openssl/opensslconf.h
  /usr/local/include/node/openssl/archs/BSD-x86_64/no-asm/include/progs.h
  /usr/local/include/node/openssl/archs/VC-WIN32/asm/crypto/buildinf.h
  /usr/local/include/node/openssl/archs/VC-WIN32/asm/crypto/include/internal/bn_conf.h
  /usr/local/include/node/openssl/archs/VC-WIN32/asm/crypto/include/internal/dso_conf.h
  /usr/local/include/node/openssl/x509_no-asm.h
  /usr/local/include/node/openssl/x509_vfy.h
  /usr/local/include/node/openssl/x509_vfy_asm.h
  /usr/local/include/node/openssl/x509_vfy_no-asm.h
  /usr/local/include/node/openssl/x509err.h
  /usr/local/include/node/openssl/x509v3.h
  /usr/local/include/node/openssl/x509v3_asm.h
  /usr/local/include/node/openssl/x509v3_no-asm.h
  /usr/local/include/node/openssl/x509v3err.h
  /usr/local/include/node/uv.h
  /usr/local/include/node/uv/aix.h
  /usr/local/include/node/uv/android-ifaddrs.h
  /usr/local/include/node/uv/bsd.h
  /usr/local/include/node/uv/darwin.h
  /usr/local/include/node/uv/errno.h
  /usr/local/include/node/uv/linux.h
  /usr/local/include/node/uv/os390.h
  /usr/local/include/node/uv/posix.h
  /usr/local/include/node/uv/stdint-msvc2008.h
  /usr/local/include/node/uv/sunos.h
  /usr/local/include/node/uv/threadpool.h
  /usr/local/include/node/uv/tree.h
  /usr/local/include/node/uv/unix.h
  /usr/local/include/node/uv/version.h
  /usr/local/include/node/uv/win.h
  /usr/local/include/node/v8-internal.h
  /usr/local/include/node/v8-platform.h
  /usr/local/include/node/v8-profiler.h
  /usr/local/include/node/v8-version.h
  /usr/local/include/node/v8.h
  /usr/local/include/node/v8config.h
  /usr/local/include/node/zconf.h
  /usr/local/include/node/zlib.h
Error: Process completed with exit code 1.

Verification

What were you trying to do (and why)?

Install a swift package like create-api from source on Ubuntu 20.05.5 with: brew install -v --head create-api

This same error seems to occur for all the swift packages (such as swiftformat and publish). It started happening around the time GitHub updated their Ubuntu runners, making me suspect there was some change to the glibc version. The errors do pre-date the update to swift 5.7 (I had been hoping that the 5.7 update would magically fix the build failures, but it didn't).

What happened (include all command output)?

Full build log at https://github.com/marcprux/MemoZ/actions/runs/3266574514/jobs/5370502445

==> swift build --disable-sandbox --configuration release

'create-api-20221017-10631-1tagacl': error: invalidManifestFormat("error: link command failed with exit code 1 (use -v to see invocation)\n/lib/x86_64-linux-gnu/Scrt1.o:function _start: error: undefined reference to \'__libc_csu_fini\'\n/lib/x86_64-linux-gnu/Scrt1.o:function _start: error: undefined reference to \'__libc_csu_init\'\nclang-13: error: linker command failed with exit code 1 (use -v to see invocation)", diagnosticFile: nil)
[2107](https://github.com/marcprux/MemoZ/actions/runs/3266574514/jobs/5370502445#step:3:2108)

What did you expect to happen?

I expected create-api to be build and install like it used to.

Step-by-step reproduction instructions (by running brew commands)

eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
brew install -v --head create-api

In the GitHub runner environment, you can reproduce this with a workflow like the following (see the full workflow that results in the error at https://github.com/marcprux/MemoZ/blob/main/.github/workflows/ci.yml).

jobs:
  Linux:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Install create-api
        run: |
          eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
          brew install -v --head create-api
      - name: Test (Debug)
        run: swift test -v --configuration debug
      - name: Test (Release)
        run: swift test -v --configuration release -Xswiftc -enable-testing
marcprux commented 2 years ago

FTR, this started happening after https://github.com/actions/runner-images/issues/6283

carlocab commented 2 years ago

Sorry, but we don't provide support for source builds. This includes building from --HEAD. These can fail for a plethora of reasons and we don't have the resources to diagnose and fix them.

Is there any reason why you're not able to use the bottles? We provide them precisely so that users don't build from source.

marcprux commented 2 years ago

I understand that building from source it isn't supported in general, but I need to build bottles from my own packages that aren't yet in homebrew-core. Like the homebrew testbot, I build and deploy the bottles from an ubuntu runner. I've been doing this for a year with no issues until now.

Looking at https://github.com/Homebrew/homebrew-core/actions/runs/3239943658/jobs/5310019666 , it appears that the bottling process is now happening on an ubuntu-22.04 runner. I'll try switching my runner to 22.04 and see if it helps.

Bo98 commented 2 years ago

22.04 will help, yes. We require glibc 2.35+ and ship our own if it's too old. Looks like Swift unfortunately still picks up the old glibc.

I'll look into it but if you can switch to 22.04, please do as it'll fix your issues.