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 llvm packages 15 #209536

Closed
wants to merge 8 commits into from
Closed

Add llvm packages 15 #209536

wants to merge 8 commits into from

Conversation

Et7f3
Copy link
Contributor

@Et7f3 Et7f3 commented Jan 7, 2023

Description of changes

I have taken example of primos pr #162104 if it is a command I put it in commit message otherwise I do it in a separate commit. so commit 2 and 4 are by hand. I also updated patch to fix line number

fix #191132

Things done
  • Built on platform(s)
    • x86_64-linux (no)
    • aarch64-linux (no presumably same failure than x86_64-linux)
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.05 Release Notes (or backporting 22.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

@nektro

@wegank
Copy link
Member

wegank commented Jan 7, 2023

Oh, we've got another #194634...

@Et7f3
Copy link
Contributor Author

Et7f3 commented Jan 7, 2023

Oh I only saw the closed PR. Should I close it ? The other PR seems to have bitrotted.

@wegank
Copy link
Member

wegank commented Jan 7, 2023

Should I close it ?

That's not for me to decide. To be honest, I also have PRs unclosed while better PRs are coming in. 😅

(Looks like this PR does not build on aarch64-linux, while the other one does.)

The other PR seems to have bitrotted.

I feel the same way you do. I'd rather see that PR merged NOW, and additional patches added gradually, so that other important PRs (GHC, Zig 0.10.0, etc) can come in. One out of 197 committers takes the step, the problem is solved, while the reality is not.

inherit (stdenvAdapters) overrideCC;
buildLlvmTools = buildPackages.llvmPackages_15.tools;
targetLlvmLibraries = targetPackages.llvmPackages_15.libraries or llvmPackages_15.libraries;
stdenv = llvmPackages_13.stdenv;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does it need stdenv from llvm 13?

Copy link
Contributor

Choose a reason for hiding this comment

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

Related: #184408

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They dropped support for clang12 and I tested on macos so stdenv is llvm)
Let me find the line with this info

Copy link
Contributor

Choose a reason for hiding this comment

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

It probably should be under isDarwin condition since gcc is used to build llvm on Linux.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

https://github.com/llvm/llvm-project/blob/llvmorg-14.0.6/libcxx/include/__config#L423-L424

These line are removed on llvmorg-15.0.6, I didn't find requirement in README or in documentation so I don't know minimal version of gcc. You are right I will add a guard.

Copy link
Contributor Author

@Et7f3 Et7f3 Jan 8, 2023

Choose a reason for hiding this comment

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

I think It is not the correct way to require a recent version of clang because it has reference to llvm11 (from darwin stdenv):

$ nix-store -qR $(nix-store -qd /nix/store/n58zxqjx4lz785swd6xxcxv03la5lhfv-libcxxabi-15.0.6) | grep llvm
/nix/store/yww9hd80ikq72zrvkdk36picpqgvsh8b-llvm-11.1.0.src.tar.xz.drv
/nix/store/6wv8acdd7bm7npixgr3rk86mf55fj47c-llvm-config-link-static.patch
/nix/store/2mkz2cmqwg45xv7xfsj9idsb39maipmr-llvm-11.1.0.drv
/nix/store/cpnly3bmw6blsryxfgp2hs8ig2jz2aaz-llvm-13.0.1.drv

EDIT: after using nix-store --tree -q I see no llvm11 as direct dependencies.

@Et7f3 Et7f3 force-pushed the add_llvmPackages_15 branch 2 times, most recently from 1fa1af9 to fb8668c Compare January 8, 2023 13:02
@misuzu
Copy link
Contributor

misuzu commented Jan 8, 2023

llvmPackages_15.compiler-rt-libc also fails to build

/build/compiler-rt-src-15.0.6/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp:180:10: fatal error: crypt.h: No such file or directory
  180 | #include <crypt.h>
      |          ^~~~~~~~~
compilation terminated.

@Et7f3
Copy link
Contributor Author

Et7f3 commented Jan 8, 2023

Just for those who want to see if it builds for your platform:

nix build .#llvmPackages_15.bintools .#llvmPackages_15.bintools-unwrapped .#llvmPackages_15.bintoolsNoLibc .#llvmPackages_15.clang .#llvmPackages_15.clang-manpages .#llvmPackages_15.clang-unwrapped .#llvmPackages_15.clangNoCompilerRt .#llvmPackages_15.clangNoCompilerRtWithLibc .#llvmPackages_15.clangNoLibc .#llvmPackages_15.clangNoLibcxx .#llvmPackages_15.clangUseLLVM .#llvmPackages_15.compiler-rt .#llvmPackages_15.compiler-rt-libc .#llvmPackages_15.compiler-rt-no-libc .#llvmPackages_15.libclang .#llvmPackages_15.libcxx .#llvmPackages_15.libcxxClang .#llvmPackages_15.libcxxStdenv .#llvmPackages_15.libcxxabi .#llvmPackages_15.libllvm .#llvmPackages_15.libstdcxxClang .#llvmPackages_15.libunwind .#llvmPackages_15.lld .#llvmPackages_15.llvm .#llvmPackages_15.llvm-manpages .#llvmPackages_15.openmp .#llvmPackages_15.stdenv

.#llvmPackages_15.lldb (not in the list upper) doesn't build on x86_64-darwin yet.

@strager
Copy link
Contributor

strager commented Jan 12, 2023

I tested this patch on Linux with Zig (a tool which uses libllvm and libclang), and it seemed to work well. (#210324)

@K900 K900 mentioned this pull request Jan 14, 2023
92 tasks
@strager
Copy link
Contributor

strager commented Jan 24, 2023

Is this PR ready to merge?

@wegank
Copy link
Member

wegank commented Jan 24, 2023

I don't think so, since it doesn't build under aarch64-linux.

@strager Would you please test if Zig 0.10.0 builds on top of #194634?

@Et7f3
Copy link
Contributor Author

Et7f3 commented Jan 24, 2023

since it doesn't build under aarch64-linux.

Really ? Can I have a build log or a way to build if I don't have arm machine.

@wegank
Copy link
Member

wegank commented Jan 24, 2023

since it doesn't build under aarch64-linux.

Really ? Can I have a build log or a way to build if I don't have arm machine.

Here is the build log on ofborg: https://logs.nix.ci/?key=nixos/nixpkgs.209536&attempt_id=a26d3c8f-3178-4417-917a-bea85254c8c9

@nektro
Copy link

nektro commented Jan 24, 2023

I don't think so, since it doesn't build under aarch64-linux.

then why does hydra have all the checks set to green?

edit: oh its the ones that are gray that didnt report a status back to github

@milahu
Copy link
Contributor

milahu commented Jan 24, 2023

i cherry-picked this into https://github.com/milahu/nixpkgs/tree/flutter-engine/init
and im getting internal compiler error: Segmentation fault

[ 74%] Building CXX object lib/Target/ARM/CMakeFiles/LLVMARMCodeGen.dir/ARMTargetObjectFile.cpp.o
In file included from /build/llvm-src-15.0.6/llvm/lib/Target/Mips/MipsPostLegalizerCombiner.cpp:38:
/build/llvm-src-15.0.6/llvm/build/lib/Target/Mips/MipsGenPostLegalizeGICombiner.inc:90:6: warning: 'bool {anonymous}::Mip>
   90 | bool MipsGenPostLegalizerCombinerHelperRuleConfig::isRuleDisabled(unsigned RuleID) const {
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ 74%] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/AMDGPUPromoteAlloca.cpp.o
[ 75%] Building CXX object lib/Target/ARM/CMakeFiles/LLVMARMCodeGen.dir/ARMTargetTransformInfo.cpp.o
In file included from /build/llvm-src-15.0.6/llvm/include/llvm/CodeGen/MachineOutliner.h:20,
                 from /build/llvm-src-15.0.6/llvm/include/llvm/CodeGen/TargetInstrInfo.h:27,
                 from /build/llvm-src-15.0.6/llvm/lib/Target/Mips/MipsInstrInfo.h:27,
                 from /build/llvm-src-15.0.6/llvm/lib/Target/Mips/MipsSEInstrInfo.h:16,
                 from /build/llvm-src-15.0.6/llvm/lib/Target/Mips/MipsSEInstrInfo.cpp:13:
/build/llvm-src-15.0.6/llvm/include/llvm/CodeGen/MachineRegisterInfo.h:112:3: internal compiler error: Segmentation fault
  112 |   }
      |   ^

gnp7zdjb5jfqdx1a4lxfmi1l1dxdn3c5-llvm-15.0.6.drv.log.gz

@Et7f3
Copy link
Contributor Author

Et7f3 commented Jan 27, 2023

It eval correctly on my machine so ofborg should be happy

@Et7f3
Copy link
Contributor Author

Et7f3 commented Jan 27, 2023

No new regression since 15.0.6 it did pass the same (disabled) tests on x86_64-darwin.

@nektro
Copy link

nektro commented Jan 27, 2023

still failing on darwin

@wegank
Copy link
Member

wegank commented Jan 27, 2023

still failing on darwin

If it is about ofborg, ofborg stops because LLVM always takes more than an hour to build on darwin. This is perfectly normal.

@misuzu
Copy link
Contributor

misuzu commented Jan 27, 2023

lldb is broken on x86_64-darwin:

$ nix log /nix/store/bz13zzf212apfkiahkz9h2klg6rqxz3c-lldb-15.0.7.drv
<............>
[ 10%] Built target lldbUtility
[ 10%] Building CXX object source/Host/macosx/objcxx/CMakeFiles/lldbHostMacOSXObjCXX.dir/Host.mm.o
[ 10%] Building CXX object source/Host/macosx/objcxx/CMakeFiles/lldbHostMacOSXObjCXX.dir/HostInfoMacOSX.mm.o
[ 10%] Building CXX object source/Host/macosx/objcxx/CMakeFiles/lldbHostMacOSXObjCXX.dir/HostThreadMacOSX.mm.o
[ 10%] Building CXX object source/Plugins/Platform/QemuUser/CMakeFiles/lldbPluginPlatformQemuUser.dir/PlatformQemuUser.cpp.o
/tmp/nix-build-lldb-15.0.7.drv-0/lldb-src-15.0.7/lldb/source/Host/macosx/objcxx/Host.mm:36:10: fatal error: 'bsm/audit_session.h' file not found
#include <bsm/audit_session.h>
         ^~~~~~~~~~~~~~~~~~~~~
[ 10%] Linking CXX executable ../../bin/lldb-instr
[ 10%] Built target lldb-instr
1 error generated.
make[2]: *** [source/Host/macosx/objcxx/CMakeFiles/lldbHostMacOSXObjCXX.dir/build.make:76: source/Host/macosx/objcxx/CMakeFiles/lldbHostMacOSXObjCXX.dir/Host.mm.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/tmp/nix-build-lldb-15.0.7.drv-0/lldb-src-15.0.7/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm:236:52: error: use of undeclared identifier 'CPU_SUBTYPE_ARM64E'
    if (cputype == CPU_TYPE_ARM64 && cpusubtype == CPU_SUBTYPE_ARM64E) {
                                                   ^
1 error generated.
make[2]: *** [source/Host/macosx/objcxx/CMakeFiles/lldbHostMacOSXObjCXX.dir/build.make:90: source/Host/macosx/objcxx/CMakeFiles/lldbHostMacOSXObjCXX.dir/HostInfoMacOSX.mm.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:3617: source/Host/macosx/objcxx/CMakeFiles/lldbHostMacOSXObjCXX.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 10%] Linking CXX static library ../../../../lib/liblldbPluginPlatformQemuUser.a
[ 10%] Built target lldbPluginPlatformQemuUser
make: *** [Makefile:136: all] Error 2

@strager
Copy link
Contributor

strager commented Jan 28, 2023

I tried building lldb on Darwin x86_64. I have patches which will likely fix the two issues mentioned in @misuzu's comment. They will take a while to build on my old laptop though. See attached:

EDIT: My Libsystem patch doesn't work yet. I'll continue working on it.

EDIT: The lldb patch doesn't work either. 🙈 I'll fix it.

@Et7f3
Copy link
Contributor Author

Et7f3 commented Jan 28, 2023

I tried building lldb on Darwin x86_64. I have patches which will likely fix the two issues mentioned in @misuzu's comment. They will take a while to build on my old laptop though. See attached:

EDIT: My Libsystem patch doesn't work yet. I'll continue working on it.

EDIT: The lldb patch doesn't work either. 🙈 I'll fix it.

I don't think lldb is blocking zig and I think I saw patch in the other PR to fix lldb on darwin (so I didn't investigated that build failure). Unless I am wrong what is blocking is test failure in main compiler.

@strager
Copy link
Contributor

strager commented Jan 28, 2023

I don't think lldb is blocking zig

I thought this PR (#209536) is for LLVM, not Zig.

Unless I am wrong what is blocking is test failure in main compiler.

Which platform and package? I built LLVM on Linux x86_64 and got no test failures.

@wegank
Copy link
Member

wegank commented Jan 28, 2023

I tried building lldb on Darwin x86_64. I have patches which will likely fix the two issues mentioned in @misuzu's comment. They will take a while to build on my old laptop though. See attached:

EDIT: My Libsystem patch doesn't work yet. I'll continue working on it.
EDIT: The lldb patch doesn't work either. 🙈 I'll fix it.

I don't think lldb is blocking zig and I think I saw patch in the other PR to fix lldb on darwin (so I didn't investigated that build failure). Unless I am wrong what is blocking is test failure in main compiler.

I tried building lldb on Darwin x86_64. I have patches which will likely fix the two issues mentioned in @misuzu's comment. They will take a while to build on my old laptop though. See attached:

EDIT: My Libsystem patch doesn't work yet. I'll continue working on it.

EDIT: The lldb patch doesn't work either. 🙈 I'll fix it.

We can just apply 1d3ca42 in the other PR.

@Et7f3
Copy link
Contributor Author

Et7f3 commented Jan 28, 2023

I don't think lldb is blocking zig

I thought this PR (#209536) is for LLVM, not Zig.

Unless I am wrong what is blocking is test failure in main compiler.

Which platform and package? I built LLVM on Linux x86_64 and got no test failures.

Yes this PR is only for LLVM. Zig need one PR that add llvm to be merged. Since you opened a PR for zig I supposed you main interest was to unlock the situation and have one PR merged.

Ah my bad I saw #209536 (comment)

if those are fixed upstream then pick what doesn't build sure.

@strager
Copy link
Contributor

strager commented Jan 28, 2023

What's the difference between PRs #209536 and #194634? Do they both do the same thing? Are both being maintained?

I originally built my Zig patch (#210324) on top of this PR (#209536) because this LLVM PR (#209536) was open and the other LLVM PR (#194634) was marked as a draft. But now the other one (#194634) is approved and seems to have some of the bug fixes already...? I'm confused.

Since you opened a PR for zig I supposed you main interest was to unlock the situation

Yes, I want my Zig patch in, and if that means getting your PR in (or another similar PR), I'd do whatever I can to help get that PR in too.

@wegank
Copy link
Member

wegank commented Jan 28, 2023

What's the difference between PRs #209536 and #194634? Do they both do the same thing? Are both being maintained?

I originally built my Zig patch (#210324) on top of this PR (#209536) because this LLVM PR (#209536) was open and the other LLVM PR (#194634) was marked as a draft. But now the other one (#194634) is approved and seems to have some of the bug fixes already...? I'm confused.

Yes, they do the same thing. That PR has been marked as a draft, mainly because it has higher goals, like targeting more platforms, enabling LLVM tests on macOS, so it took months before the author finally succeeded. Since I'm now a committer (aha!), I think I'll merge it if Zig builds on my (slow) aarch64-linux machine.

@wegank
Copy link
Member

wegank commented Jan 28, 2023

Closing in favor of #194634.

@Et7f3
Copy link
Contributor Author

Et7f3 commented Jan 30, 2023

i cherry-picked this into https://github.com/milahu/nixpkgs/tree/flutter-engine/init and im getting internal compiler error: Segmentation fault

[ 74%] Building CXX object lib/Target/ARM/CMakeFiles/LLVMARMCodeGen.dir/ARMTargetObjectFile.cpp.o
In file included from /build/llvm-src-15.0.6/llvm/lib/Target/Mips/MipsPostLegalizerCombiner.cpp:38:
/build/llvm-src-15.0.6/llvm/build/lib/Target/Mips/MipsGenPostLegalizeGICombiner.inc:90:6: warning: 'bool {anonymous}::Mip>
   90 | bool MipsGenPostLegalizerCombinerHelperRuleConfig::isRuleDisabled(unsigned RuleID) const {
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ 74%] Building CXX object lib/Target/AMDGPU/CMakeFiles/LLVMAMDGPUCodeGen.dir/AMDGPUPromoteAlloca.cpp.o
[ 75%] Building CXX object lib/Target/ARM/CMakeFiles/LLVMARMCodeGen.dir/ARMTargetTransformInfo.cpp.o
In file included from /build/llvm-src-15.0.6/llvm/include/llvm/CodeGen/MachineOutliner.h:20,
                 from /build/llvm-src-15.0.6/llvm/include/llvm/CodeGen/TargetInstrInfo.h:27,
                 from /build/llvm-src-15.0.6/llvm/lib/Target/Mips/MipsInstrInfo.h:27,
                 from /build/llvm-src-15.0.6/llvm/lib/Target/Mips/MipsSEInstrInfo.h:16,
                 from /build/llvm-src-15.0.6/llvm/lib/Target/Mips/MipsSEInstrInfo.cpp:13:
/build/llvm-src-15.0.6/llvm/include/llvm/CodeGen/MachineRegisterInfo.h:112:3: internal compiler error: Segmentation fault
  112 |   }
      |   ^

gnp7zdjb5jfqdx1a4lxfmi1l1dxdn3c5-llvm-15.0.6.drv.log.gz

Do you get it on master ? Even with one jobs at the time ? if yes open an issue please, so we don't loose it here.

@rrbutani rrbutani added the 6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related label May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: llvm/clang Issues related to llvmPackages, clangStdenv and related 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 11-100 10.rebuild-linux: 11-100
Projects
None yet
Development

Successfully merging this pull request may close these issues.

request: add llvmPackages_15
7 participants