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

libunwind: also build with C++ compiler on musl #69277

Closed
wants to merge 1 commit into from
Closed

libunwind: also build with C++ compiler on musl #69277

wants to merge 1 commit into from

Conversation

konimex
Copy link

@konimex konimex commented Feb 19, 2020

Clang 9 (the C compiler) errors out and refuses to build anything if -stdlib=c++11 is set. This ensures that libunwind will be built with the C++ compiler just like on glibc.

Closes #69222.

Clang-9 (the C compiler) errors out and refuses to build anything
if -stdlib=c++11 is set. This ensures that libunwind will be built
with the C++ compiler just like on glibc.
@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nikomatsakis (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 19, 2020
@Mark-Simulacrum
Copy link
Member

Hm, I suspect that the comment here may be relevant, have you checked that at least some of the musl builders are still working locally? (e.g., via src/ci/docker/run.sh image-name)

If not, then we can probably configure one of those as a try builder to test things out, by copying from src/ci/azure-pipelines/auto.yml to try.yml a builder that builds for musl. Or we can just throw this at CI, I guess, if you don't want to do that...

@bors rollup=never

@Mark-Simulacrum Mark-Simulacrum added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 19, 2020
@konimex
Copy link
Author

konimex commented Feb 19, 2020

Tried the container, but make prepare failed. See https://termbin.com/c1xl for details.

@Mark-Simulacrum
Copy link
Member

Hm, that error looks like you haven't run git submodule update --init, try that?

@konimex
Copy link
Author

konimex commented Feb 19, 2020

Alright, it's building now, and will report later of any results. By the way, is the docker instance there building for master/latest release or my PR?

@Mark-Simulacrum
Copy link
Member

Whichever commit you have checked out currently in your repository.

@konimex
Copy link
Author

konimex commented Feb 24, 2020

Apologies for the late response, had to find a suitable machine in uni and I can't remote in to that machine.

Here's the last few logs I can gather from tmux: https://termbin.com/f5zw looks like it successfully built the rustc compiler.

Also got this warning when I tried to run the docker command again:

Finished release [optimized] target(s) in 0.17s
Installing libLLVM.so to stage 0 (x86_64-unknown-linux-musl)
Copying stage0 rustc from stage0 (x86_64-unknown-linux-musl -> x86_64-unknown-linux-musl / x86_64-unknown-linux-musl)
[TIMING] Rustc { target: "x86_64-unknown-linux-musl", compiler: Compiler { stage: 0, host: "x86_64-unknown-linux-musl" } } -- 0.211
Assembling stage1 compiler (x86_64-unknown-linux-musl)
Building stage1 std artifacts (x86_64-unknown-linux-musl -> x86_64-unknown-linux-musl)
[RUSTC-TIMING] core test:false 24.190
[RUSTC-TIMING] build_script_build test:false 1.349
[RUSTC-TIMING] build_script_build test:false 1.735
[RUSTC-TIMING] rustc_std_workspace_core test:false 0.042
warning: cc1plus: warning: command line option '-std=c99' is valid for C/ObjC but not for C++
warning: cc1plus: warning: command line option '-std=c99' is valid for C/ObjC but not for C++
warning: cc1: warning: command line option '-nostdinc++' is valid for C++/ObjC++ but not for C
warning: cc1: warning: command line option '-std=c++11' is valid for C++/ObjC++ but not for C
warning: cc1: warning: command line option '-fno-rtti' is valid for C++/ObjC++ but not for C
warning: cc1: warning: command line option '-nostdinc++' is valid for C++/ObjC++ but not for C
warning: cc1: warning: command line option '-std=c++11' is valid for C++/ObjC++ but not for C
warning: cc1: warning: command line option '-fno-rtti' is valid for C++/ObjC++ but not for C
warning: cc1: warning: command line option '-nostdinc++' is valid for C++/ObjC++ but not for C
warning: cc1: warning: command line option '-std=c++11' is valid for C++/ObjC++ but not for C
warning: cc1: warning: command line option '-fno-rtti' is valid for C++/ObjC++ but not for C
warning: cc1plus: warning: command line option '-std=c99' is valid for C/ObjC but not for C++
[RUSTC-TIMING] alloc test:false 3.522
[RUSTC-TIMING] rustc_std_workspace_alloc test:false 0.031
[RUSTC-TIMING] panic_abort test:false 0.047

I figured rustc still use GCC since it's cc1plus instead of clang-9.

(EDIT: Here's the last few logs from the new docker run: https://termbin.com/9hd1)

@JohnCSimon
Copy link
Member

Ping from triage:
@konimex - this has been idle for the last two weeks, can you please post your status or reach out if you need help?
Thanks.

@konimex
Copy link
Author

konimex commented Mar 9, 2020

@JohnCSimon: I'm not sure what to add, I've given my status update with logs as asked in #69277 (comment). I was waiting for further replies.

@Mark-Simulacrum
Copy link
Member

@bors r+ rollup=never

It's my impression that we were previously relying on gcc being more lenient and accepting C++ input; clang (version 9, at least) is less lenient. Let's see if this works -- if not, we will likely have to mess around a bit with various environment variables to make sure we have a C++ compiler around on the builders that break.

@bors
Copy link
Contributor

bors commented Mar 13, 2020

📌 Commit 5258390 has been approved by Mark-Simulacrum

@bors
Copy link
Contributor

bors commented Mar 13, 2020

🌲 The tree is currently closed for pull requests below priority 1000, this pull request will be tested once the tree is reopened

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 13, 2020
@Dylan-DPC-zz
Copy link

@bors p=1

@bors
Copy link
Contributor

bors commented Mar 14, 2020

⌛ Testing commit 5258390 with merge ce6e71049c17a85a09a3e43ae6867ef0e949980c...

@rust-highfive
Copy link
Collaborator

The job dist-i586-gnu-i586-i686-musl of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2020-03-14T08:24:34.1631363Z    Compiling unwind v0.0.0 (/checkout/src/libunwind)
2020-03-14T08:24:34.1682653Z error: failed to run custom build command for `unwind v0.0.0 (/checkout/src/libunwind)`
2020-03-14T08:24:34.1686078Z 
2020-03-14T08:24:34.1686342Z Caused by:
2020-03-14T08:24:34.1692648Z   process didn't exit successfully: `/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/release/build/unwind-50f41811f813e479/build-script-build` (exit code: 1)
2020-03-14T08:24:34.1693330Z --- stdout
2020-03-14T08:24:34.1693956Z cargo:rerun-if-changed=build.rs
2020-03-14T08:24:34.1695373Z cargo:rustc-link-search=native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/i686-unknown-linux-musl/release/build/unwind-c6f588d77e17ec07/out
2020-03-14T08:24:34.1697858Z running: "musl-g++" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m32" "-static" "-march=i686" "-Wl,-melf_i386" "-I" "../llvm-project/libunwind/include" "-std=c99" "-std=c++11" "-nostdinc++" "-fno-exceptions" "-fno-rtti" "-fstrict-aliasing" "-funwind-tables" "-D__LITTLE_ENDIAN__=1" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-std/i686-unknown-linux-musl/release/build/unwind-c6f588d77e17ec07/out/../llvm-project/libunwind/src/Unwind-EHABI.o" "-c" "../llvm-project/libunwind/src/Unwind-EHABI.cpp"
2020-03-14T08:24:34.1699861Z --- stderr
2020-03-14T08:24:34.1700223Z 
2020-03-14T08:24:34.1700539Z 
2020-03-14T08:24:34.1700539Z 
2020-03-14T08:24:34.1701221Z error occurred: Failed to find tool. Is `musl-g++` installed?
2020-03-14T08:24:34.1702005Z 
2020-03-14T08:24:34.1710824Z 
2020-03-14T08:24:34.1712220Z warning: build failed, waiting for other jobs to finish...
2020-03-14T08:24:54.2262376Z [RUSTC-TIMING] core test:false 25.348
---
2020-03-14T08:24:54.2458364Z   local time: Sat Mar 14 08:24:54 UTC 2020
2020-03-14T08:24:54.5320093Z   network time: Sat, 14 Mar 2020 08:24:54 GMT
2020-03-14T08:24:54.5324254Z == end clock drift check ==
2020-03-14T08:24:55.6709357Z 
2020-03-14T08:24:55.6791579Z ##[error]Bash exited with code '1'.
2020-03-14T08:24:55.6869974Z ##[section]Starting: Checkout rust-lang/rust@auto to s
2020-03-14T08:24:55.6878355Z ==============================================================================
2020-03-14T08:24:55.6878913Z Task         : Get sources
2020-03-14T08:24:55.6879391Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @rust-lang/infra. (Feature Requests)

@bors
Copy link
Contributor

bors commented Mar 14, 2020

💔 Test failed - checks-azure

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 14, 2020
@konimex
Copy link
Author

konimex commented Mar 14, 2020

Hmm, so the commit errors in i586 (probably the reason for using cc in the first place), but why isn't there a C++ compiler for musl on that architecture?

EDIT: Actually, nevermind. There are no musl-g++ since, if I'm not wrong, C++ compiler doesn't "contact" the C library, just libstdc++.

@12101111
Copy link
Contributor

llvm-libunwind is writing in c++ but don't need libc++ or libstdc++ ( because it's a dependence of libc++)

@konimex
Copy link
Author

konimex commented Mar 28, 2020

I'm closing this PR for the time being, I haven't got time to focus on tackling the CI issue without effectively separating dist-i586-gnu, dist-i586-musl, and dist-i686-musl, but I'm afraid one of the solutions I got so far is to separate the three (since I think GCC proper with C++ support would need a native musl toolchain instead of a musl-gcc wrapper).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Building rustc in Clang 9.0 error: invalid argument '-std=c++11' not allowed with 'C'
8 participants