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

Add support for FreeBSD on PowerPC64 #57758

Closed
wants to merge 9 commits into from
Closed

Conversation

lenoil98
Copy link
Contributor

The changes add support for building rustc on freebsd powerpc64. Reference issue #57112

@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 @pnkfelix (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 Jan 19, 2019
@rust-highfive

This comment has been minimized.

@nagisa
Copy link
Member

nagisa commented Jan 19, 2019

r? @nagisa

@rust-highfive rust-highfive assigned nagisa and unassigned pnkfelix Jan 19, 2019
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.0 of your PR failed on Travis (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.
travis_time:end:09602bcb:start=1547914667750290587,finish=1547914737519412162,duration=69769121575
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-6.0
---
[00:23:40] 20  | fn main() {
[00:23:40]     |           - un-closed delimiter
[00:23:40] ...
[00:23:40] 269 |             } else {
[00:23:40]     |                    - this delimiter might not be properly closed...
[00:23:40] 270 |                 println!("cargo:rustc-link-lib={}", stdcppname);
[00:23:40] 271 |         }
[00:23:40]     |         - ...as it matches this but it has different indentation
[00:23:40] 281 | }
[00:23:40]     |   ^
[00:23:40] 
[00:23:40] error: aborting due to previous error
---
[00:23:40] travis_fold:start:stage0-rustc_codegen_llvm
travis_time:start:stage0-rustc_codegen_llvm
failed to run: /checkout/obj/build/bootstrap/debug/bootstrap build
[00:23:40] Build completed unsuccessfully in 0:20:26
[00:23:40] Makefile:18: recipe for target 'all' failed
[00:23:40] make: *** [all] Error 1
74508 ./.git/modules/src
73896 ./src/llvm/lib
69912 ./src/llvm-emscripten/lib
69124 ./src/test
---
travis_time:end:279e286c:start=1547916167888057307,finish=1547916167892783822,duration=4726515
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:049bd752
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:0aac56b1
travis_time:start:0aac56b1
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:0948518a
$ dmesg | grep -i kill

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 @TimNN. (Feature Requests)

@bors
Copy link
Contributor

bors commented Jan 21, 2019

☔ The latest upstream changes (presumably #57704) made this pull request unmergeable. Please resolve the merge conflicts.

println!("cargo:rustc-link-lib={}", stdcppname);
if target.contains("powerpc64-unknown-freebsd") {
println!("cargo:rustc-link-search=native=/usr/local/lib/gcc6");
println!("cargo:rustc-link-lib=static=stdc++");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This particular piece of code should perhaps be moved slightly up to where stdcppname variable is assigned.

@@ -263,7 +263,12 @@ fn main() {
} else if cxxflags.contains("stdlib=libc++") {
println!("cargo:rustc-link-lib=c++");
} else {
println!("cargo:rustc-link-lib={}", stdcppname);
if target.contains("powerpc64-unknown-freebsd") {
println!("cargo:rustc-link-search=native=/usr/local/lib/gcc6");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does llvm-config not print this path out? If I remember my freebsd correctly, this would mean that gcc would be required to build rustc then. Which is not that big of a deal, but still something to improve on.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FreeBSD on powerpc64 ships an old version of gcc (4.2.1) in the 'base' system, since it can't build llvm I had to use gcc7 from our 'ports tree'. For whatever reason the linker tried to link 'something' against libstdc++ from gcc-4.2.1 instead of libstdc++ from gcc7 and the link failed (I was not able to figure out how to pass -Wl,-rpath=/usr/local/lib/gcc7). Linking to a static version of libstdc++ made the problem go away.
This is just an ugly hack to fix a FreeBSD problem and should probably stays as a patch file in our 'ports tree'

@nagisa
Copy link
Member

nagisa commented Jan 21, 2019

The changes look good. Please squash the commits together into one or two and give these commits a description that makes it obvious what these changes are about (i.e. "Add support for powerpc64-unknown-freebsd target" instead of "Update file.rs"). You should also remove the merge commit as a part of the rebase process.

You can read about rebasing here (also here) and here about rewriting the commit (and its message).

@nagisa
Copy link
Member

nagisa commented Jan 21, 2019

Closing in favour of #57809. Thanks!

@nagisa nagisa closed this Jan 21, 2019
@@ -263,7 +263,12 @@ fn main() {
} else if cxxflags.contains("stdlib=libc++") {
println!("cargo:rustc-link-lib=c++");
} else {
println!("cargo:rustc-link-lib={}", stdcppname);
if target.contains("powerpc64-unknown-freebsd") {
println!("cargo:rustc-link-search=native=/usr/local/lib/gcc6");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you put gcc8, this is our default gcc version since a few weeks.

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.

5 participants