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

Better support for --llvm-root. #27937

Merged
merged 1 commit into from
Dec 14, 2015

Conversation

DiamondLovesYou
Copy link
Contributor

This handles cases when the LLVM used isn't configured will the 'usual' targets. Also, cases where LLVM is shared are also handled (ie with LD_LIBRARY_PATH etc).

@rust-highfive
Copy link
Collaborator

r? @brson

(rust_highfive has picked a reviewer for you, use r? to override)

$$(S)
$$(S) \
"$$(LLVM_LIBDIR_RUSTFLAGS_$(3))" \
"$$(shell $$(LLVM_CONFIG_$(3)) --components)"
Copy link
Member

Choose a reason for hiding this comment

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

Can this output be cached in a variable to prevent re-running it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@alexcrichton
Copy link
Member

The travis failures here look like they may not be benign

@DiamondLovesYou DiamondLovesYou force-pushed the llvm-root-and-shared branch 3 times, most recently from 8bfc6cd to 320cc47 Compare August 25, 2015 04:46
@alexcrichton
Copy link
Member

Can this hold off on the changes to tests/maketest for now? The changes to compiletest are only needed if tests are linking to the compiler (e.g. fulldeps), but for most targets with custom LLVM builds we probably don't need the compiler itself working there just yet, so fixes like this can come later if absolutely necessary. Same with the changes to run-make as I believe run-make isn't run for target-only targets (as opposed to host+target targets).

I continue to be very wary of landing all these changes as it's quite a deal of difficult logic that isn't tested in any way, so I prefer to minimize the impact as much as possible.

@DiamondLovesYou
Copy link
Contributor Author

@alexcrichton They were due to variable expansions happening before llvm-config was built (ie not an issue if make all is run before tidy or check, thus I never caught it locally). Anyway, fixed.

DiamondLovesYou added a commit to DiamondLovesYou/rust that referenced this pull request Aug 26, 2015
…mode.

This is a change needed for rust-lang#27937, so that `-L $(llvm-config --libdir)` is only
added to RUSTFLAGS for fulldeps based compiletest modes.
@brson
Copy link
Contributor

brson commented Aug 27, 2015

Looks like good cleanup. I agree that the additional complexity in compiletest is unwarranted for now. Maybe we can fix this problem some other way and I'm happy to ignore all fulldeps tests on the web for a while.

@DiamondLovesYou
Copy link
Contributor Author

@brson I'm not sure I understand what you mean by "I'm happy to ignore all fulldeps tests on the web for a while". Could you explain exactly what you mean?

Also, surely the benefit of the fulldep tests outweighs the pretty minimal additional complexity in compiletest (from calling llvm-config)? I mean I have no problem just disabling the fulldeps if that's way you'd like to go. I can file an issue and then comment out the fulldep test modes in tests.mk (assuming this is what you meant from above).

@alexcrichton
Copy link
Member

Currently running the fulldeps tests means that the entire compiler has to be built for the target platform, and in this case that probably isn't necessary. I believe @brson means that in the interest of keeping this minimal (e.g. only running the run-pass tests for things like PNaCl) the changes to compiletest shouldn't be necessary because none of those link to LLVM.

Unfortunately "minimal complexity" ends up being bitrotted very quickly without being exercised which ends up porting it forward for a few years or so only to be painfully deleted at some point.

@wthrowe
Copy link
Contributor

wthrowe commented Sep 10, 2015

Following up on some discussion on #28327: The current patch does not work for my use case, and I don't think the LLVM patch mentioned in the #28327 discussion is going to help, because I don't have a libLLVM.so or libLLVM-${VERSION}.so, so the current llvm-config logic will still apply. My system has all of the individual LLVM libraries installed as separate shared objects, so llvm-config is correctly reporting a long list of linker arguments for shared libraries.

@DiamondLovesYou
Copy link
Contributor Author

Is your system's LLVM built with CMake && BUILD_SHARED_LIBS ON? CMake
will build separate shared objects for each component in that case.

I'll have to add an extra flag to llvm-config to fix that.

On Thu, Sep 10, 2015 at 12:14 PM, wthrowe notifications@github.com wrote:

Following up on some discussion on #28327
#28327: The current patch does
not work for my use case, and I don't think the LLVM patch mentioned in the
#28327 #28327 discussion is going
to help, because I don't have a libLLVM.so or libLLVM-${VERSION}.so, so
the current llvm-config logic will still apply. My system has all of the
individual LLVM libraries installed as separate shared objects, so
llvm-config is correctly reporting a long list of linker arguments for
shared libraries.


Reply to this email directly or view it on GitHub
#27937 (comment).

@wthrowe
Copy link
Contributor

wthrowe commented Sep 10, 2015

Yes, it looks like it uses CMake with -DBUILD_SHARED_LIBS=ON. (This is Gentoo's official llvm-3.7.0 package.)

@bors
Copy link
Contributor

bors commented Sep 17, 2015

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

@jauhien
Copy link
Contributor

jauhien commented Sep 21, 2015

Just fyi: we in Gentoo are interested in the possibility to link Rust to separated LLVM shared libraries, otherwise we can't use the system wide LLVM which is quite sad from the point of view of the overall build time.

jauhien added a commit to jauhien/gentoo-rust that referenced this pull request Sep 23, 2015
LLVM in Gentoo is shipped as static libs only now,
until Rust upstream fixies linking using system wide LLVM is impossible
see rust-lang/rust#27937

-Werror during Rust building was disabled
@DiamondLovesYou
Copy link
Contributor Author

@jauhien I've just created this patch. It fixes llvm-config for cmake && BUILD_SHARED_LIBS.

@brson brson mentioned this pull request Nov 4, 2015
@DiamondLovesYou DiamondLovesYou force-pushed the llvm-root-and-shared branch 3 times, most recently from 95e6097 to f8e9e86 Compare November 14, 2015 03:05
@DiamondLovesYou
Copy link
Contributor Author

Ready to go.

$$(LLVM_CONFIG_$(1)) "$(CFG_STDCPP_NAME)"
$(Q)$(CFG_PYTHON) "$$<" "$$@" "$(filter $(shell \
$(CFG_LLVM_ROOT)/bin/llvm-config$(X_$(CFG_BUILD)) \
--components), \
Copy link
Member

Choose a reason for hiding this comment

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

Can this be replaced with a variable defined below to avoid re-invoking llvm-config?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, because we don't want to link unused LLVM components into rustc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I mean, I don't have a problem with just linking everything, I just thought you guys might not like it.

@alexcrichton
Copy link
Member

I have a feeling that this is likely to break over time (as there's no CI and this looks pretty brittle as so many build system things are), but it seems fine as it should be easy to get back up to speed in the future.

@bors
Copy link
Contributor

bors commented Dec 2, 2015

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

@alexcrichton
Copy link
Member

Ok, the point about re-invoking llvm-config sounds good to me, can these commits be squashed into one as well? Other than that r=me

@DiamondLovesYou
Copy link
Contributor Author

Done!

@alexcrichton
Copy link
Member

@bors: r+ abc6e7ae8be975119ad92814fe815059aeea18e7

@bors
Copy link
Contributor

bors commented Dec 13, 2015

⌛ Testing commit abc6e7a with merge 3b5e8bf...

@bors
Copy link
Contributor

bors commented Dec 13, 2015

💔 Test failed - auto-mac-64-nopt-t

This handles cases when the LLVM used isn't configured will the 'usual'
targets. Also, cases where LLVM is shared are also handled (ie with
`LD_LIBRARY_PATH` etc).
@DiamondLovesYou
Copy link
Contributor Author

Whoops, I forgot to push a change to llvm.mk.

@alexcrichton
Copy link
Member

@bors: r+ 7bd69f2

@bors
Copy link
Contributor

bors commented Dec 14, 2015

⌛ Testing commit 7bd69f2 with merge f150c17...

bors added a commit that referenced this pull request Dec 14, 2015
…ichton

This handles cases when the LLVM used isn't configured will the 'usual' targets. Also, cases where LLVM is shared are also handled (ie with `LD_LIBRARY_PATH` etc).
@bors bors merged commit 7bd69f2 into rust-lang:master Dec 14, 2015
alexcrichton added a commit to alexcrichton/rust that referenced this pull request Dec 16, 2015
It looks like rust-lang#27937 accidentally switched the llvmdeps file from the target to
the host by accident, so be sure to use the right llvmdeps file which is built
for the target when building rustc_llvm
bors added a commit that referenced this pull request Dec 18, 2015
It looks like #27937 accidentally switched the llvmdeps file from the target to
the host by accident, so be sure to use the right llvmdeps file which is built
for the target when building rustc_llvm
vivo75 pushed a commit to vivo75/vivovl that referenced this pull request Sep 6, 2017
LLVM in Gentoo is shipped as static libs only now,
until Rust upstream fixies linking using system wide LLVM is impossible
see rust-lang/rust#27937

-Werror during Rust building was disabled
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

Successfully merging this pull request may close these issues.

7 participants