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

Improved build documentation when building dependencies #47631

Open
smartalecH opened this issue Nov 18, 2022 · 4 comments
Open

Improved build documentation when building dependencies #47631

smartalecH opened this issue Nov 18, 2022 · 4 comments
Labels
building Build system, or building Julia or its dependencies docs This change adds or pertains to documentation

Comments

@smartalecH
Copy link

I've been working on building Julia (release 1.8.2) on some rather complicated internal infrastructure. Throughout my journey (discussed a bit in this discourse thread), I've realized there are some important details missing in the build documentation that would probably help others. For example...

  1. patchelf effectively clobbers the user-specified LDFLAGS, and instead uses CXXLDFLAGS:

$(dir $<)/configure $(CONFIGURE_COMMON) LDFLAGS="$(CXXLDFLAGS)" CPPFLAGS="$(CPPFLAGS)"

  1. Some libraries, like gmp, effectively ignore LDFLAGS altogether, and instead expect the user to pass important parameters, like runtime paths, to the CFLAGS and CXXFLAGS (as discussed here).
  2. Perhaps the most difficult issue to navigate is the infamous libstdc++ loading problem (discussed here). While there was a recent fix intended to help mitigate this issue (Probe and dlopen() the correct libstdc++ #46976) it's not clear to what extent it does. Furthermore, it appears that PR wasn't percolated to the recent 1.8.3 release, or even the 1.9-alpha release. While a minimum gcc version is documented, there is no maximum version documented for any of the releases.

I'm still trying to work through issue 3 myself. When I build LLVM, it uses my compiler's libstdc++. When the build script moves to building Julia (and loads some LLVM libraries), the linker references Julia's libstdc++ rather than the version LLVM was built with. I'm assuming this is only a problem because my compiler's version is newer (a recently patched version of gcc11.2) but I'm still working through this...

I'm happy to add a PR that describes these details more thoroughly, but I want to make sure I'm not missing something obvious first.

Thanks!

@vtjnash
Copy link
Sponsor Member

vtjnash commented Nov 18, 2022

The minimum gcc is better autodetected on newer versions of julia already. But we are not going to backport it to all versions. A more reliable solution can be to set USE_BINARYBUILDER=0 when you know that binaries are not available from there. And while we try to do some regularization of all the possible CFLAGS, eventually that becomes too big of a problem and you have to do your own digging to figure out what each specific library expects.

The patchelf binary may be special, in being compiled for the host architecture, instead of the target? Apparently it was just thought to be a C++ binary though, so was expected at some point to use the alternate flags:
44e36da

@smartalecH
Copy link
Author

Thanks, @vtjnash for your quick reply!

The minimum gcc is better autodetected on newer versions of julia already. But we are not going to backport it to all versions.

Sorry, are you talking about maximum gcc version? That's the issue I was referring to.

And I understand if you don't want to backport to all versions. But 1.8.3 was just released last week, right?

A more reliable solution can be to set USE_BINARYBUILDER=0 when you know that binaries are not available from there.

Yes, all the issues I'm describing above are when USE_BINARYBUILDER=0... perhaps I'm misunderstanding something?

And while we try to do some regularization of all the possible CFLAGS,

I actually don't think you need to regularize all the flags (unless they start clashing). Rather, just adding a few hints about this in the docs would be useful. Or even something like "be warned, each dependency may require careful consideration when setting the appropriate compiler flags".

It's a little odd that the docs spend significant time describing how to add the binary to the PATH ( something straightforward) but don't describe any of the caveats with respect to building the dependencies themselves.

@vtjnash
Copy link
Sponsor Member

vtjnash commented Nov 18, 2022

yeah, I was thinking of the minimum for the maximum, so really just the maximum.

I tagged that PR for backport, so we will see how that goes (I was mixing this up with #47629, which I was attempting to answer at the same time–about v1.3 rather than v1.8.3)

That would probably be a good note for the docs/src/devdocs/build/build.md file! Would you be willing to write something there, especially given your experience now?

@smartalecH
Copy link
Author

That would probably be a good note for the docs/src/devdocs/build/build.md file! Would you be willing to write something there, especially given your experience now?

Sure, I'd be happy to 😀

@brenhinkeller brenhinkeller added docs This change adds or pertains to documentation building Build system, or building Julia or its dependencies labels Nov 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
building Build system, or building Julia or its dependencies docs This change adds or pertains to documentation
Projects
None yet
Development

No branches or pull requests

3 participants