-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Pass LD and LDFLAGS to more dependencies #21764
Conversation
deps/tools/common.mk
Outdated
@@ -29,6 +31,7 @@ CMAKE_COMMON += -DCMAKE_CXX_COMPILER="$(CXX_BASE)" | |||
ifneq ($(strip $(CMAKE_CXX_ARG)),) | |||
CMAKE_COMMON += -DCMAKE_CXX_COMPILER_ARG1="$(CMAKE_CXX_ARG)" | |||
endif | |||
CMAKE_COMMON += -DCMAKE_LINKER="$$(which $(LD))" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you using which $(LD)
instead of just $(LD)
? Also, it's better to just say $(shell which $(LD))
instead of using the $$(...)
syntax.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was just copying the style used several lines up for CC
. I'll go with $(LD)
. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some versions of cmake were buggy if you didn't pass an absolute path for CC. not sure about LD, but should test that this doesn't cause any issues with cross compilation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I even left a comment # The call to which here is to work around https://cmake.org/Bug/view.php?id=14366
- that was fixed in cmake 3.0, we require 3.4.3 these days unless you're using system llvm
645164c
to
2bab4cf
Compare
shouldn't these pass through to submakes if defined and exported? |
LD yes, or at least I would have thought so, but I was seeing cases where the default override LD := /usr/local/bin/ld
export LD in my Make.user. |
which cases specifically? |
LLVM is all I can recall offhand, though there may have been others. (Verbose build output lost to terminal history.) |
probably CMAKE_COMMON is the only one that's not redundant then? |
There's a key difference between # Makefile
FOO=bar
export FOO
exported:
@$(MAKE) -C subdir
passed:
@$(MAKE) -C subdir FOO=$(FOO) # subdir/Makefile
FOO=qux
all:
@echo "FOO is $(FOO)" $ make exported
FOO is qux
$ make passed
FOO is bar |
Personally, I prefer the more explicit (passing) approach as it's easier for me to follow (just a personal preference) and it's more forceful, thereby dealing with a larger array of Makefile authorship styles. |
So is this reasonable? |
deps/mpfr.mk
Outdated
@@ -15,6 +15,7 @@ MPFR_OPTS += --disable-thread-safe CFLAGS="$(CFLAGS) -DNPRINTF_L -DNPRINTF_T -DN | |||
endif | |||
endif | |||
|
|||
MPFR_OPTS += LD="$(LD)" LDFLAGS="$(LDFLAGS)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should already be covered by CONFIGURE_COMMON
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can put it in CONFIGURE_COMMON
but it isn't there right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you're adding it there below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm an idiot.
needs to be tested that cmake doesn't have any issues in cross-compilation with the new flag |
How does one do that? Can you run it through the buildbots or something? |
If you just mention @jlbuild on a line on of its own in a comment, it'll take the state of this current PR and run it through the buildbots. It's got a few other interesting features such as running on a subset of the buildbots ( |
2bab4cf
to
0ad59d3
Compare
jlbuild isn't running windows yet, and we don't have linux-to-windows cross compile build bots. see README.windows.md, but if you have cross compilers installed then it should just be a matter of setting |
@@ -73,6 +73,7 @@ LLVM_FLAGS += --disable-bindings --disable-docs --disable-libedit --disable-term | |||
# LLVM has weird install prefixes (see llvm-$(LLVM_VER)/build_$(LLVM_BUILDTYPE)/Makefile.config for the full list) | |||
# We map them here to the "normal" ones, which means just prefixing "PROJ_" to the variable name. | |||
LLVM_MFLAGS := PROJ_libdir=$(build_libdir) PROJ_bindir=$(build_depsbindir) PROJ_includedir=$(build_includedir) | |||
LLVM_MFLAGS += LD="$(LD)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be redundant with setting it via cmake?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably, but I don't actually know, so I added it here just in case. Not sure how exactly to figure out whether it's in fact redundant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like we don't actually use LLVM_MFLAGS when building with cmake, so this is only relevant for llvm 3.7 or earlier
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, okay. So is this fine as is, then? There's also the LLVM_USE_CMAKE
flag (or something like that) but I don't know when one would actually want to use it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
usually to force old llvm versions to use cmake instead of defaulting to configure, which may have been useful once in a while
I don't :/ The ARMv7 failure is weird--could that be related? |
ARMv7 is broken at the moment, we found a subtle bug in Julia that Yichao is patching here |
Would someone familiar with cross-compilation be willing to test this? |
I did a bit of testing, I think it should be okay. Was hitting some unrelated errors, where googling led me to a comment in one of my own dockerfiles from many months ago. |
Great, thanks for testing. Is this good to go then? |
0ad59d3
to
1e90fde
Compare
I noticed that we don't pass the
LD
andLDFLAGS
Make variables to some dependencies. In particular, MPFR can pick up the wrong GMP without giving itLDFLAGS
. This PR adds Make and CMake options to various dependencies to ensure more dependencies see the user's choice of linker and linker flags.