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

rustbuild failures for solaris target #39729

Closed
binarycrusader opened this issue Feb 10, 2017 · 3 comments
Closed

rustbuild failures for solaris target #39729

binarycrusader opened this issue Feb 10, 2017 · 3 comments

Comments

@binarycrusader
Copy link
Contributor

binarycrusader commented Feb 10, 2017

I've been using the (now obsolete) Makefile-based builds successfully for some time now while trying to get rust running on Solaris x86_64 (and from there sparcv9).

However, now that the rustbuild is the build system used for master, I've hit an unexpected regression:

Compiling error_index_generator v0.0.0 (file:///builds/srwalker/rsdev/rust.git/src/tools/error_index_generator)
Running /builds/srwalker/rsdev/rust.git/build/bootstrap/debug/rustc --crate-name error_index_generator src/tools/error_index_generator/main.rs --crate-type bin -C debug-assertions=off -C metada ta=55b3c2ceee213ac4 -C extra-filename=-55b3c2ceee213ac4 --out-dir /builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-tools/x86_64-sun-solaris/debug/deps --emit=dep-info,link --target x86 _64-sun-solaris -L dependency=/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-tools/x86_64-sun-solaris/debug/deps -L dependency=/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solari s/stage0-tools/debug/deps
error: linking with gcc failed: exit code: 1
|
= note: "gcc" "-m64" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-sysroot/lib/rustlib/x86_64-sun-solaris/lib" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stag
e0-tools/x86_64-sun-solaris/debug/deps/error_index_generator-55b3c2ceee213ac4.0.o" "-o" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-tools/x86_64-sun-solaris/debug/deps/error_index_generator-55b3c2ceee213ac4" "-Wl,-z" "-Wl,ignore" "-nodefaultlibs" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-tools/x86_64-sun-solaris/debug/deps" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-tools/debug/deps" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-sysroot/lib/rustlib/x86_64-sun-solaris/lib" "-Wl,-Bstatic" "-Wl,-Bdynamic" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-sysroot/lib/rustlib/x86_64-sun-solaris/lib" "-l" "rustdoc-dc29c94abd4dcd0b" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-sysroot/lib/rustlib/x86_64-sun-solaris/lib" "-l" "rustc_driver-ad92d3e67e903774" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-sysroot/lib/rustlib/x86_64-sun-solaris/lib" "-l" "rustc_typeck-35a3b54b6cdf97b8" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-sysroot/lib/rustlib/x86_64-sun-solaris/lib" "-l" "rustc_save_analysis-cfdfe8acd6869272" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-sysroot/lib/rustlib/x86_64-sun-solaris/lib" "-l" "rustc_privacy-024a67cf6bc3e709" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-sysroot/lib/rustlib/x86_64-sun-solaris/lib" "-l" "rustc_plugin-8ac1ae7e5776eac0" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-sysroot/lib/rustlib/x86_64-sun-solaris/lib" "-l" "rustc_metadata-ec7dd07248e52e75" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-sysroot/lib/rustlib/x86_64-sun-solaris/lib" "-l" "rustc_passes-364f38216d6c9424" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-sysroot/lib/rustlib/x86_64-sun-solaris/lib" "-l" "rustc_trans-cdd243fe1e68012f" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-sysroot/lib/rustlib/x86_64-sun-solaris/lib" "-l" "rustc_platform_intrinsics-3f47cab9ef631fa8" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-sysroot/lib/rustlib/x86_64-sun-solaris/lib" "-l" "flate-0fd3b1a0a223499d" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-sysroot/lib/rustlib/x86_64-sun-solaris/lib" "-l" "rustc_incremental-0716a51558e38db4" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-sysroot/lib/rustlib/x86_64-sun-solaris/lib" "-l" "rustc_borrowck-e00e0fa179bdb736" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-sysroot/lib/rustlib/x86_64-sun-solaris/lib" "-l" "rustc_mir-e476d98505ff4a5a" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-sysroot/lib/rustlib/x86_64-sun-solaris/lib" "-l" "rustc_lint-0ca5fe89f646b285" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-sysroot/lib/rustlib/x86_64-sun-solaris/lib" "-l" "rustc_const_eval-1bae27148c7bc577" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-sysroot/lib/rustlib/x86_64-sun-solaris/lib" "-l" "syntax_ext-0fe5527df8de6a12" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-sysroot/lib/rustlib/x86_64-sun-solaris/lib" "-l" "proc_macro-2ff07fc394454e4c" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-sysroot/lib/rustlib/x86_64-sun-solaris/lib" "-l" "rustc_resolve-14ff019444b0925d" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-sysroot/lib/rustlib/x86_64-sun-solaris/lib" "-l" "rustc-371900ccc5089862" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-sysroot/lib/rustlib/x86_64-sun-solaris/lib" "-l" "rustc_const_math-5c402b785333d9c5" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-sysroot/lib/rustlib/x86_64-sun-solaris/lib" "-l" "rustc_back-593a5bc33c0bbc74" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-sysroot/lib/rustlib/x86_64-sun-solaris/lib" "-l" "rustc_llvm-3fc564fdb05f532d" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-sysroot/lib/rustlib/x86_64-sun-solaris/lib" "-l" "graphviz-7372a6bd3115d725" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-sysroot/lib/rustlib/x86_64-sun-solaris/lib" "-l" "fmt_macros-aa72d845f9be82d4" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-sysroot/lib/rustlib/x86_64-sun-solaris/lib" "-l" "arena-c02259e246615414" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-sysroot/lib/rustlib/x86_64-sun-solaris/lib" "-l" "syntax-dd0d5972ba1c7927" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-sysroot/lib/rustlib/x86_64-sun-solaris/lib" "-l" "rustc_data_structures-08cfb1bce6556e99" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-sysroot/lib/rustlib/x86_64-sun-solaris/lib" "-l" "rustc_errors-3d314e34a93ae9c9" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-sysroot/lib/rustlib/x86_64-sun-solaris/lib" "-l" "syntax_pos-a88c23d3e25f8736" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-sysroot/lib/rustlib/x86_64-sun-solaris/lib" "-l" "serialize-54827eda001a7e78" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-sysroot/lib/rustlib/x86_64-sun-solaris/lib" "-l" "log-151dae97b40a2eed" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-sysroot/lib/rustlib/x86_64-sun-solaris/lib" "-l" "test-21372d30bc4f4052" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-sysroot/lib/rustlib/x86_64-sun-solaris/lib" "-l" "term-911c66b6f4f7c84b" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-sysroot/lib/rustlib/x86_64-sun-solaris/lib" "-l" "getopts-a50dc22aef8e3c26" "-L" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-sysroot/lib/rustlib/x86_64-sun-solaris/lib" "-l" "std-68576f367c0b7ff2" "/builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-sysroot/lib/rustlib/x86_64-sun-solaris/lib/libcompiler_builtins-7791545be2c71751.rlib" "-l" "rt" "-l" "dl" "-l" "m" "-l" "stdc++" "-l" "c" "-l" "m" "-l" "rt" "-Wl,-rpath,$ORIGIN/../lib"
= note: Undefined first referenced
symbol in file
_Unwind_Resume /builds/srwalker/rsdev/rust.git/build/x86_64-sun-solaris/stage0-tools/x86_64-sun-solaris/debug/deps/error_index_generator-55b3c2ceee213ac4.0.o (symbol belongs to implicit dependency /usr/gcc/5/lib/gcc/x86_64-pc-solaris2.12/5.4.0/../../../amd64/libgcc_s.so.1)
ld: fatal: symbol referencing errors
collect2: error: ld returned 1 exit status

error: aborting due to previous error

Initially, I thought this would be simple enough to workaround by altering librustc_back/target/solaris_base.rs:

diff --git a/src/librustc_back/target/solaris_base.rs b/src/librustc_back/target/solaris_base.rs
index 41323c9..cac0a02 100644
--- a/src/librustc_back/target/solaris_base.rs
+++ b/src/librustc_back/target/solaris_base.rs
@@ -19,6 +19,9 @@ pub fn opts() -> TargetOptions {
         target_family: Some("unix".to_string()),
         is_like_solaris: true,
         exe_allocation_crate: super::maybe_jemalloc(),
+        late_link_args: vec![
+            "-lgcc".to_string(), // needed for _Unwind_Resume, etc.
+        ],
 
         .. Default::default()
     }

However, after making that change and rebuilding, I still hit the issue.

So I have questions:

  1. where is the right place to ensure -lgcc is used for linking here?
  2. do I need to apply this fix to the beta snapshot I'm using to build master first or just to master itself before building?
  3. shouldn't rust explicitly specifying -lgcc automatically? The gcc documentation appears to imply that libgcc is still needed in most cases, notably when using -nostdlibs (of which -nodefaultlibs appears to be a superset?)

The Solaris linker fails (as expected) here since there's an implicit dependency that's known, but wasn't explicitly named.

@alexcrichton
Copy link
Member

Perhaps a solaris block just needs to be added here?

(that's where we add our unwinding runtime dependencies)

@binarycrusader
Copy link
Contributor Author

binarycrusader commented Feb 11, 2017

@alexcrichton almost, that and one other place needed fixing; I'll send a pull request tomorrow that will fix all of the rustbuild issues I encountered. Thanks!

/cc @dhduvall

@alexcrichton
Copy link
Member

Awesome, thanks @binarycrusader!

@binarycrusader binarycrusader changed the title rustbuild fails linking for error_index_generator and subsequent commands rustbuild failures for solaris target Feb 11, 2017
binarycrusader added a commit to binarycrusader/rust that referenced this issue Feb 12, 2017
Add cputype recognition for Solaris

Fixes rust-lang#39729
frewsxcv added a commit to frewsxcv/rust that referenced this issue Feb 13, 2017
add solaris rustbuild support

Add Solaris as recognized ostype
Add cputype recognition for Solaris

Fixes rust-lang#39729

A future pull request will discriminate between the commercial release and older opensource derivatives to account for divergence, for now, this is compatible with both.
bors added a commit that referenced this issue Feb 13, 2017
add solaris rustbuild support

Add Solaris as recognized ostype
Add cputype recognition for Solaris

Fixes #39729

A future pull request will discriminate between the commercial release and older opensource derivatives to account for divergence, for now, this is compatible with both.
frewsxcv added a commit to frewsxcv/rust that referenced this issue Feb 13, 2017
add solaris rustbuild support

Add Solaris as recognized ostype
Add cputype recognition for Solaris

Fixes rust-lang#39729

A future pull request will discriminate between the commercial release and older opensource derivatives to account for divergence, for now, this is compatible with both.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants