Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

llvm: enable clang and rtti by default, simplifying deps #48462

Closed
wants to merge 1 commit into from
Closed

llvm: enable clang and rtti by default, simplifying deps #48462

wants to merge 1 commit into from

Conversation

apjanke
Copy link
Contributor

@apjanke apjanke commented Jan 25, 2016

This allows all core dependencies on llvm to be on the default llvm, instead of using 'with-rtti' or 'with-clang', which cause a 1-hour+ build from source and timeouts on the CI. Follows discussion in #47269.

Affected formulae:

[/usr/local/Library/Formula on ⇄ master]
$ grep llvm * | grep depends_on | grep 'clang\|rtti'
creduce.rb:  depends_on "llvm" => "with-clang"
doxygen.rb:  depends_on "llvm" => "with-clang" if build.with? "libclang"
emacs-clang-complete-async.rb:  depends_on "llvm" => "with-clang"
ponyc.rb:  depends_on "llvm" => "with-rtti"
rtags.rb:  depends_on "llvm" => "with-clang"

I'm omitting emacs-clang-complete-async from this PR because it lacks a test do and will cause the audit checks to fail, and I'd like this to go green. I'll fix it up separately if and when this is merged.

I don't think this requires a revision bump to any of the dependent formulae, because they use llvm as an external command and don't require a rebuild. (Except maybe doxygen?)

@apjanke
Copy link
Contributor Author

apjanke commented Jan 26, 2016

9 tests failed? <iostream> not found? What?!?

        Testing llvm
==> Using the sandbox
/usr/bin/sandbox-exec -f /tmp/homebrew20160125-62368-1ifikcv.sb /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -W0 -I /usr/local/Library/Homebrew -- /usr/local/Library/Homebrew/test.rb /usr/local/Library/Formula/llvm.rb --verbose
==> /usr/local/Cellar/llvm/3.6.2_1/bin/llvm-config --prefix
==> /usr/local/Cellar/llvm/3.6.2_1/bin/clang++ test.cpp -o test
test.cpp:1:10: fatal error: 'iostream' file not found
#include <iostream>
         ^
1 error generated.
Error: llvm: failed
Failed executing: /usr/local/Cellar/llvm/3.6.2_1/bin/clang++ test.cpp -o test

Is this because --with-libcxx is not enabled by default, and clang++ wants to draw <iostream> from its own C++ library? i.e. this C++ "Hello world" test is conditioned on build.with? "clang", but it really wants build.with? "clang" && build.with? "libcxx"?

  test do
    ...

    if build.with? "clang"
      (testpath/"test.cpp").write <<-EOS.undent
     ...
      EOS
      system "#{bin}/clang++", "test.cpp", "-o", "test"
      system "./test"
    end

If so, thoughts on making --with-libcxx the default? Given how much C++ there is out there, seems like one would want it by default if you're going to build clang in the first place. The clang++ built with --with-clang --without-libcxx seems effectively broken. Or is there a way to point it at a different C++ library (without requiring the user to fiddle with it at invocation time)?

@MikeMcQuaid
Copy link
Member

If so, thoughts on making --with-libcxx the default? Given how much C++ there is out there, seems like one would want it by default if you're going to build clang in the first place. The clang++ built with --with-clang --without-libcxx seems effectively broken.

Seems fine 👍

@apjanke
Copy link
Contributor Author

apjanke commented Jan 26, 2016

Amended to make --with-libcxx the default, so the test can run overnight. Still open to feedback from other maintainers on this.

@apjanke
Copy link
Contributor Author

apjanke commented Jan 26, 2016

Failures again. The CI is a timeout, but Jenkins has real failures.

ponyc failed to build. From the el cap failure:

Undefined symbols for architecture x86_64:
  "std::terminate()", referenced from:
      ___clang_call_terminate in libponyc.a(genopt.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [build/release/ponyc] Error 1

The rtags failure is just a download failure, looks unrelated.

failed: brew fetch --retry rtags --build-bottle --force

Stacktrace

        ==> Cloning https://github.com/Andersbakken/rtags.git
Cloning into '/Library/Caches/Homebrew/rtags--git'...
warning: Could not find remote branch v2.0 to clone.
fatal: Remote branch v2.0 not found in upstream origin
==> Retrying download

I'll look in to them.

@apjanke
Copy link
Contributor Author

apjanke commented Jan 26, 2016

The rtags failure looks like it's just that upstream removed the tag for that release, and no longer has any named releases. See #42045 and upstream Andersbakken/rtags#582. Maybe a boneyard candidate if they don't do releases.

This was referenced Jan 27, 2016
@apjanke
Copy link
Contributor Author

apjanke commented Jan 29, 2016

Could be the issue is that the ponyc formula, or brew's build process, isn't detecting all the C++ switches it needs to do with llvm.

From the llvm formula's caveats:

==> Caveats
LLVM executables are installed in /usr/local/opt/llvm/bin.
Extra tools are installed in /usr/local/opt/llvm/share/llvm.
To use the bundled libc++ please add the following LDFLAGS:
  LDFLAGS="-L/usr/local/opt/llvm/lib -lc++abi"

Looks like this is a known issue: #47149, #47858. Going to read through those and see if I can understand it better.

Related, putting in a PR to enable verbose builds for ponyc so we can see the compiler commands, #48578.

This allows all core dependencies on llvm to be on the default llvm, instead
of using 'with-rtti' or 'with-clang', which cause a 1-hour+ build from source.
@apjanke
Copy link
Contributor Author

apjanke commented Mar 14, 2016

Closing this out as a rejection/withdrawal. Seems to me that there are some nontrivial issues here with the C++ standards support and C++ library builds here, which need someone who's really familiar with them to sort out.

And that's not me: even if I could get everything to build here, working on this PR has given me enough familiarity with LLVM and C++ libs to know that I'm not qualified to give a thumbs-up on a change like this.

@apjanke apjanke closed this Mar 14, 2016
@apjanke
Copy link
Contributor Author

apjanke commented Mar 19, 2016

Looks like this might be the default in formula for newer versions of llvm, based on the homebrew-versions formulae for 3.7 (Homebrew/homebrew-versions#955) and 3.8 (Homebrew/homebrew-versions#1183).

The core PR for 3.8 leaves them as options though: #47824

@apjanke apjanke mentioned this pull request May 31, 2016
4 tasks
@Homebrew Homebrew locked and limited conversation to collaborators Jul 10, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants