-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Rust Applications built on Centos7 cannot run on Centos6 #67173
Comments
I'm pretty sure this is expected behavior. The build system's libc is used to link the executable. |
To achieve a real Backward Compatibility you would not require the newest Version but only this whose Functionality you really use.
|
Going even further to build a backward and foreward compatible software you would not use the newest available Feature of the newest Version to be backward compatible and delete old obsolete Features to be foreward compatible |
You are probably talking about rust/src/libstd/sys/unix/fast_thread_local.rs Lines 19 to 43 in d8bdb3f
It's used since Rust uses TLS during executable startup. This is duplicate of #36826 |
Closing as duplicate, then. |
I executed the Command documented at
The Function documented in Rather it shows that
so it is not duplicate but it goes against the affirmation of "Rust being compatible with EL6"
but it also provides the
It rather seems to have to do with the issue explained at: |
Interesting. It should still work when also building on CentOS 6 though, can you confirm this? |
As mentioned in the Backward Compatibility thread Rust is not shipped for Centos6 For this reason I build the Application on Centos7 but I need to run them on Centos6, too. |
#62516 (comment) implies that Rust should still work on older versions via
|
Rust probably won't work on CentOS 6 because the kernel is too old. Rust produces call to
You cannot count on it. If your code had Generally if you want to have your binaries working on older system you should build glibc matching the old system and link against it instead of system one. |
Rust definitely works in a CentOS 6 userspace with the standard rustup/etc toolchain - I build applications in a centos:6 docker image. |
@mati865 I don't think it's possible to just tell LLVM to target an older glibc. The older glibc needs to be actually available, either by building on an old distro (easiest!), by manually building an older glibc, or by using something like crosstool-ng. |
As documented in |
I was reviewing the Library Bindings of the Rust
As a comparison I did check the
The disassembly output of
So I'm really surprised that Rust But this actually explains why the Rust Executables are that huge and the startup is slower. |
Use the musl target if you want fully static binaries.
…On Wed, 4 Mar 2020, 12:01 Bodo (Hugo) Barwich, ***@***.***> wrote:
I was reviewing the Library Bindings of the Rust hello-world Executable
and found some Bindings that are actually very surprising:
$ ldd target/release/hello-world
linux-vdso.so.1 => (0x00007ffe11e2a000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fcf1e55d000)
librt.so.1 => /lib64/librt.so.1 (0x00007fcf1e355000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fcf1e139000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fcf1df23000)
libc.so.6 => /lib64/libc.so.6 (0x00007fcf1db56000)
/lib64/ld-linux-x86-64.so.2 (0x00007fcf1e992000)
As a comparison I did check the hello-world Executable generated with the
other Compiler which runs on Centos6 right out of the box:
$ ldd hello-world_fpc.run
no es un ejecutable dinámico
The disassembly output of hello-world_fpc.run shows that this Compiler
actually doesn't need any external Libraries to print a simple String "*Hello,
World!*" to STDOUT:
0x4002ab <DORUN+235> callq 0x41c650 <fpc_get_output>
0x4002b0 <DORUN+240> mov %rax,%rbx
0x4002b3 <DORUN+243> lea 0x83c76(%rip),%rdx # 0x483f30
0x4002ba <DORUN+250> mov %rbx,%rsi
0x4002bd <DORUN+253> mov $0x0,%edi
0x4002c2 <DORUN+258> callq 0x41c8f0 <fpc_write_text_shortstr>
0x4002c7 <DORUN+263> callq 0x4169d0 <fpc_iocheck>
0x4002cc <DORUN+268> mov %rbx,%rdi
0x4002cf <DORUN+271> callq 0x41c820 <fpc_writeln_end>
0x4002d4 <DORUN+276> callq 0x4169d0 <fpc_iocheck>
0x4002d9 <DORUN+281> mov -0x8(%rbp),%rdi
0x4002dd <DORUN+285> mov -0x8(%rbp),%rax
0x4002e1 <DORUN+289> mov (%rax),%rax
0x4002e4 <DORUN+292> callq *0x1f8(%rax)
0x4002ea <DORUN+298> callq 0x413c40 <fpc_popaddrstack>
0x4002ef <DORUN+303> lea -0x10(%rbp),%rdi
0x4002f3 <DORUN+307> callq 0x40ac60 <fpc_ansistr_decr_ref>
0x4002f8 <DORUN+312> mov -0x70(%rbp),%rax
0x4002fc <DORUN+316> test %rax,%rax
0x4002ff <DORUN+319> je 0x400306 <DORUN+326>
0x400301 <DORUN+321> callq 0x413dd0 <fpc_reraise>
0x400306 <DORUN+326> mov -0x78(%rbp),%rbx
0x40030a <DORUN+330> leaveq
0x40030b <DORUN+331> retq
So I'm really surprised that Rust hello-world would bind in so many
Libraries and even the libpthread.so.0 for threading to print a simple
String "*Hello, world!*" to STDOUT.
But this actually explains why the Rust Executables are that huge and the
startup is slower.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#67173?email_source=notifications&email_token=AAFFZURYJDAUHEICZLLQIODRFYRI7A5CNFSM4JYHWLH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENXEMOA#issuecomment-594429496>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFFZUTCH3OZ4QXFEMLAOMTRFYRI7ANCNFSM4JYHWLHQ>
.
|
Yes, this is expected behavior, as mentioned above. Closing. |
As all this discussion comes to show that it is the Binding of the Rust |
I just stumbled over another Use Case affected by this limitation:
For Publishers this is a quite weighty Draw-Back since it limits the Audience heavily or forces them to enlarge their Build Park with Build Hosts for any possible Distribution Version. Which will affect its actual usage for Cross Distribution Projects in Production |
It has some components written in Rust, but brave-core is written in C++, based on Chromium.
If Brave wants to support older systems, then they need to build on an older system to get compatible symbol versions. This is a consequence of how glibc and others manage ABI compatibility, not Rust itself. |
Since the Rust application compiles on Centos6 and Centos7 it indicates that the Rust Code can work with either Versions of the
So, when a Rust application build on Centos6 can run on Centos7, why can't you build on Centos7 an Rust application that can run on Centos6 ? And yes, this issue forces the DevOps Department to keep separate Centos6 and Centos7 Infrastructure in order to build the same application on Centos6 for Centos6 deploys and Centos7 build host for Centos7 deploys. In modern times of Microservices and Mulithost Distributed Systems this is not feasible. |
@domibay-hugo as said in #67173 (comment) there is probably no easy way to tell LLVM to link older symbol (though if you find it many people will be grateful). Rust does exactly the same thing as other compiler do. Take
|
@jonas-schievink
But now I am completely surprised about the Application Linkage
Because I see that the Rust Standard Library does NOT require Even more
So, where does this Requirement of |
Rust is currently built from CentOS 5:
That way it doesn't pull any too new symbols.
It comes from the system you are building on. |
@mati865
But then I found an interesting information at:
Now the Linkage is different:
Since
|
That is entirely expected, glibc is backwards compatible. It has no forward compatibility though so it won't run on CentOS 6 if you compiled it on CentOS 7.
As said before Rust creates call to |
or get rid of OS depending bindings by replacing it by own code ? ... |
Use a FWIW, the |
You are using clang, not musl. |
@afwn90cj93201nixr2e1re I suggest opening a thread in https://users.rust-lang.org/ with information you have. |
You know: Asking question is an art. Edit: I believe there are many community Rust projects using musl, such as tokei, ripgrep. |
Even having installed
|
According to this discussion the only viable Workaround is building on old CentOS6 Build Hosts |
Bruh, it's not gonna help you) It's still gonna use glibc as depend for |
Obviously maintaining and building on CentOS6 with get you into trouble of other types since all Centos6 SSL Packages are outdated and unusable. |
yep |
I found this Thread about Rust sopporting RHEL6
#62516
But I actually found that Applications built on Centos7 cannot run on Centos6 because of high
glibc
requirements.As documented in:
rust-lang/libc#1617
Reading that it would actually support EL6 makes me wonder why the highest available
glibc
Version is chosen on built time and not the actually requiredglibc
Version.The text was updated successfully, but these errors were encountered: