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

rustc: host platform libraries missing when building cross-compiler #106712

Closed
lopsided98 opened this issue Dec 12, 2020 · 3 comments · Fixed by #106790
Closed

rustc: host platform libraries missing when building cross-compiler #106712

lopsided98 opened this issue Dec 12, 2020 · 3 comments · Fixed by #106790
Labels
0.kind: bug Something is broken 6.topic: cross-compilation Building packages on a different platform than they will be used on 6.topic: rust

Comments

@lopsided98
Copy link
Contributor

With the update to 1.48, rustc is missing some host platform libraries when built as a cross-compiler. Most notably, std is missing which causes cross-compiled packages with build.rs scripts to fail with the following error:

  configuring
  Running cd .
  Building build.rs (arrayvec)
  Running rustc --crate-name build_script_build build.rs --crate-type bin -C opt-level=3 -C codegen-units=2 --edition 2015 --out-dir target/build/arrayvec --emit=dep-info,link -L dependency=target/buildDeps --cap-lints allow --color always
  error[E0463]: can't find crate for `std`
  
  error: aborting due to previous error
  
  For more information about this error, try `rustc --explain E0463`.

The native (host == target) compiler is not affected. The diff between the native and cross lib/rustlib/x86_64-unknown-linux-gnu/lib directory is as follows:

@@ -1,2 +0,0 @@
-libaddr2line-fd0a11781cac1ae6.rlib
-libadler-37cb53a92bfc5f37.rlib
@@ -4 +1,0 @@
-liballoc-a19fe38287aa7b44.rlib
@@ -15 +11,0 @@
-libcfg_if-37ec6e35a57c4724.rlib
@@ -22,2 +17,0 @@
-libcompiler_builtins-12b2430788b08c11.rlib
-libcore-589330c3ebfd1b26.rlib
@@ -37 +30,0 @@
-libgetopts-91d871b325b54499.rlib
@@ -39,2 +31,0 @@
-libgimli-f906aedc6bbb423e.rlib
-libhashbrown-7db2809e2d4e5810.rlib
@@ -49 +39,0 @@
-liblibc-efefef0138314610.rlib
@@ -61 +50,0 @@
-libminiz_oxide-8013efd62c3d03e3.rlib
@@ -65 +53,0 @@
-libobject-737dda8c0fec8d45.rlib
@@ -67,2 +54,0 @@
-libpanic_abort-e5b513f46ea93372.rlib
-libpanic_unwind-893763619bc2225f.rlib
@@ -77,2 +62,0 @@
-libproc_macro-1bad6b8419dd53b0.rlib
-libprofiler_builtins-10268f4ed46fc3a0.rlib
@@ -101 +84,0 @@
-librustc_demangle-acce1e25cb491fdd.rlib
@@ -138,3 +120,0 @@
-librustc_std_workspace_alloc-7a2650f8bf27257e.rlib
-librustc_std_workspace_core-2f7b014fd614d1d2.rlib
-librustc_std_workspace_std-0b77cfa14afcf570.rlib
@@ -159,2 +138,0 @@
-libstd-1f9f29bebaffd5df.rlib
-libstd-1f9f29bebaffd5df.so
@@ -162 +139,0 @@
-libterm-d21a5a5896130801.rlib
@@ -165,2 +141,0 @@
-libtest-c2439ed74999a4f0.rlib
-libtest-c2439ed74999a4f0.so
@@ -182 +156,0 @@
-libunicode_width-d9340def170ced68.rlib
@@ -184 +157,0 @@
-libunwind-19130fdd94e76f94.rlib

This seems like an upstream regression. Interestingly, the list of missing libraries exactly matches the list of libraries installed in lib/rustlib/<target>/lib.

cc @Ericson2314 @petabyteboy

@lopsided98 lopsided98 added the 0.kind: bug Something is broken label Dec 12, 2020
@lopsided98
Copy link
Contributor Author

rust-lang/rust@4de836e looks kind of suspicious.

@lopsided98
Copy link
Contributor Author

Or actually rust-lang/rust#76415 looks like it would explain the issue. I think we need to add the host platform to targets as well.

@FRidh FRidh added 6.topic: cross-compilation Building packages on a different platform than they will be used on 6.topic: rust labels Dec 12, 2020
@Ericson2314
Copy link
Member

That makes sense to me and sounds like a good solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken 6.topic: cross-compilation Building packages on a different platform than they will be used on 6.topic: rust
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants