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

WARN rustc_codegen_ssa::back::link Linker does not support -static-pie command line option #109855

Closed
iquanxin opened this issue Apr 2, 2023 · 5 comments
Labels
A-linkage Area: linking into static, shared libraries and binaries C-discussion Category: Discussion or questions that doesn't represent real issues. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@iquanxin
Copy link

iquanxin commented Apr 2, 2023

Why does this warning appear? How should I remove it?

Code

fn main() {
    println!("Hello, world!");
}

Meta

rustc --version --verbose:

rustc 1.68.2 (9eb3afe9e 2023-03-27)
binary: rustc
commit-hash: 9eb3afe9ebe9c7d2b84b71002d44f4a0edac95e0
commit-date: 2023-03-27
host: x86_64-unknown-linux-gnu
release: 1.68.2
LLVM version: 15.0.6

Error output

[root@7700K less1]# cargo build --target=x86_64-unknown-linux-musl && file target/x86_64-unknown-linux-musl/release/less1 && target/x86_64-unknown-linux-musl/release/less1
WARN rustc_codegen_ssa::back::link Linker does not support -static-pie command line option. Retrying with -static instead.
    Finished dev [unoptimized + debuginfo] target(s) in 0.00s
target/x86_64-unknown-linux-musl/release/less1: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, BuildID[sha1]=cbe92f394971a715cab10ab360b28e03bfaa825e, not stripped
Hello, world!
[root@7700K less1]#
Backtrace

<backtrace>

@iquanxin iquanxin added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 2, 2023
@Nilstrieb
Copy link
Member

What's your operating system/distro/version?

@iquanxin
Copy link
Author

iquanxin commented Apr 3, 2023

你的操作系统/发行版/版本是什么?

[root@ecs-328561 ~]# uname -a
Linux ecs-328561 3.10.0-1160.53.1.el7.x86_64 #1 SMP Fri Jan 14 13:59:45 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
[root@ecs-328561 ~]# lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.9.2009 (Core)
Release: 7.9.2009
Codename: Core
[root@ecs-328561 ~]#

@iquanxin
Copy link
Author

iquanxin commented Apr 3, 2023

你的操作系统/发行版/版本是什么?

[root@7700K ~]# uname -a
Linux 7700K 4.4.0-19041-Microsoft #1237-Microsoft Sat Sep 11 14:32:00 PST 2021 x86_64 x86_64 x86_64 GNU/Linux
[root@7700K ~]# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
[root@7700K ~]#

@jyn514 jyn514 changed the title WARN rustc_codegen_ssa::back::link Linker does not support -static-pie command line optionLinker does not support -static-pie command line option WARN rustc_codegen_ssa::back::link Linker does not support -static-pie command line optionLinker does not support -static-pie command line option Apr 4, 2023
@jyn514 jyn514 changed the title WARN rustc_codegen_ssa::back::link Linker does not support -static-pie command line optionLinker does not support -static-pie command line option WARN rustc_codegen_ssa::back::link Linker does not support -static-pie command line option Apr 4, 2023
@jyn514 jyn514 added A-linkage Area: linking into static, shared libraries and binaries C-discussion Category: Discussion or questions that doesn't represent real issues. and removed I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ C-bug Category: This is a bug. labels Apr 4, 2023
@jyn514
Copy link
Member

jyn514 commented Apr 4, 2023

CentOS 7 is ancient, it was released in 2014. This is probably a real incompatibility with the command line we generate to pass to the linker.

That said, it looks like -static worked correctly as a fallback, so maybe we should downgrade this to an INFO level log?

cc @cuviper

@cuviper
Copy link
Member

cuviper commented Apr 4, 2023

This is probably a real incompatibility with the command line we generate to pass to the linker.

Yes, and the fallback is intentionally in place to deal with that: #72708

Also, note that CentOS 7 does have newer tools available on the side. First yum install centos-release-scl, and then you can install devtoolset-11-gcc. Start a command with that PATH like scl enable devtoolset-11 -- bash, or add it to your existing shell with source scl_source enable devtoolset-11.

maybe we should downgrade this to an INFO level log?

I would agree with that, at least when the PIE part is getting enabled implicitly.
(If it was explicitly requested by -Crelocation-model, one might argue it shouldn't fallback at all.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linkage Area: linking into static, shared libraries and binaries C-discussion Category: Discussion or questions that doesn't represent real issues. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants