Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linux: Linker error for remote_server when using script/install-linux #24880

Open
mosenturm opened this issue Feb 14, 2025 · 10 comments
Open

linux: Linker error for remote_server when using script/install-linux #24880

mosenturm opened this issue Feb 14, 2025 · 10 comments
Labels

Comments

@mosenturm
Copy link

Summary

linux: Linker error for remote_server when using script/install-linux

Steps to trigger the problem:
After fresh git pull

  1. run script/linux
  2. run script/install-linux
  3. linker error at the end of the script for remote_server
error: linking with `cc` failed: exit status: 1 ... 
= note: /usr/bin/ld: /tmp/rustcISMaod/libaws_lc_sys-79f08eb6d32e546e.rlib(f8e4fd781484bd36-bcm.o): in function `aws_lc_0_25_0_handle_cpu_env':
          /aws-lc/crypto/fipsmodule/cpucap/cpu_intel.c:(.text.aws_lc_0_25_0_handle_cpu_env+0x63): undefined reference to `__isoc23_sscanf'
          /usr/bin/ld: /tmp/rustcISMaod/libaws_lc_sys-79f08eb6d32e546e.rlib(f8e4fd781484bd36-bcm.o): in function `pkey_rsa_ctrl_str':
          /aws-lc/crypto/fipsmodule/evp/p_rsa.c:741:(.text.pkey_rsa_ctrl_str+0x20d): undefined reference to `__isoc23_strtol'
          /usr/bin/ld: /aws-lc/crypto/fipsmodule/evp/p_rsa.c:752:(.text.pkey_rsa_ctrl_str+0x258): undefined reference to `__isoc23_strtol'
          collect2: error: ld returned 1 exit status

  = note: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
  = note: use the `-l` flag to specify native libraries to link
  = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-link-lib)

error: could not compile `remote_server` (bin "remote_server") due to 1 previous error

Actual Behavior:
Linker errors: look at https://discord.com/channels/869392257814519848/1204679850208657418/1339566403497365596

Expected Behavior:
no linker errors

Zed Version and System Specs

Ubuntu 24.04.01

$ apt list --installed | grep musl
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
musl-dev/noble,now 1.2.4-2 amd64  [installiert]
musl-tools/noble,now 1.2.4-2 amd64  [installiert]
musl/noble,now 1.2.4-2 amd64  [Installiert,automatisch]
@ConradIrwin
Copy link
Member

Looks like a failure to build aws-lc-sys (which is an absolute pain to build to be fair). https://aws.github.io/aws-lc-rs/requirements/linux.html has the dependencies it needs.

What's missing from your system so we can add it to ./script/linux

@kaplan-michael
Copy link

I have the same issue and I have made sure to install all zed deps & aws-lc-rs deps, and it still fails,

my suspicion is the musl C library as when I compile it with the gnu C lib(by forcing the target)
export REMOTE_SERVER_TARGET=x86_64-unknown-linux-gnu; script/install-linux
it goes fine(same for independent compilation on aws-lc-rd)

@mosenturm
Copy link
Author

I have the same issue and I have made sure to install all zed deps & aws-lc-rs deps, and it still fails,

my suspicion is the musl C library as when I compile it with the gnu C lib(by forcing the target) export REMOTE_SERVER_TARGET=x86_64-unknown-linux-gnu; script/install-linux it goes fine(same for independent compilation on aws-lc-rd)

I have tried the same with export REMOTE_SERVER_TARGET=x86_64-unknown-linux-gnu; script/install-linux and everythings works fine.

@ConradIrwin
Copy link
Member

Weird. We were able to get it compiling for our CI with export CC=$(which clang), maybe it's the combination of musl + gcc ?

@jansol
Copy link
Contributor

jansol commented Feb 19, 2025

Hmm, I got it to build on Kubuntu 24.10 by... installing golang. Which tbf is listed as a dependency in the aws-lc documentation if the fips feature is enabled. Apparently that is the case here.

@mosenturm
Copy link
Author

Hmm, I got it to build on Kubuntu 24.10 by... installing golang. Which tbf is listed as a dependency in the aws-lc documentation if the fips feature is enabled. Apparently that is the case here.

Go is installed. (btw. it's my main language)

@jansol
Copy link
Contributor

jansol commented Feb 19, 2025

FWIW

$ go version
go version go1.23.2 linux/amd64

$ apt list --installed | grep musl
musl-dev/oracular,now 1.2.5-1 amd64 [installed,automatic]
musl-tools/oracular,now 1.2.5-1 amd64 [installed]
musl/oracular,now 1.2.5-1 amd64 [installed,automatic]

$ gcc --version
gcc (Ubuntu 14.2.0-4ubuntu2) 14.2.0

$ clang --version
Ubuntu clang version 19.1.1 (1ubuntu1)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm-19/bin

@jansol
Copy link
Contributor

jansol commented Feb 20, 2025

Hm, now it again didn't work. Maybe I just forgot to clear out target/ after canceling a REMOTE_SERVER_TARGET=x86_64-unknown-linux-gnu script/install-linux build halfway through. CC=$(which clang) didn't work either.

@kaplan-michael
Copy link

Weird. We were able to get it compiling for our CI with export CC=$(which clang), maybe it's the combination of musl + gcc ?

yeah it looks like it, (GCC =>14 specifically)

It seems to me, that it could be caused by this bug in aws-lc-rs FIPS fails to build with GCC >= 14 & GCC-14 - build failure for FIPS module

I have gcc version 14.2.1 20250110 (Red Hat 14.2.1-7) (GCC) and it fails on that(without the target change)

now looking at the aws-lc-rs it seems we can override the CC only for that, if we use gcc-13/clang(haven't fully tested, but should work too) with export AWS_LC_FIPS_SYS_CC=gcc-13; script/install-linux it also compiles fine.

@ConradIrwin
Copy link
Member

ConradIrwin commented Feb 21, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants