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

[REQUEST] Add LLVM support #490

Closed
imwints opened this issue Jan 3, 2023 · 5 comments · Fixed by #510
Closed

[REQUEST] Add LLVM support #490

imwints opened this issue Jan 3, 2023 · 5 comments · Fixed by #510
Assignees
Labels
enhancement New feature or request

Comments

@imwints
Copy link
Contributor

imwints commented Jan 3, 2023

Due to missing implementations in llvm btop didn't support llvm based compilation for some time.
It's now more or less possible to compile btop, with some tricks, with llvm and clang. I myself got a few llvm/musl system and I'd like to use btop on them aswell without a dependecy on gcc.

Ad support for llvm base compilation in the makefile.

When llvm's <ranges> implementation is complete we should rollback some workarounds.

Notes:
We need to use libc++ because clang cannot compile libstdc++'s <ranges> because it relies on concept which are not yet ready in clang.
We need to enable libc++'s experimental features for <ranges> to work properly.
We need to edit some flags passed to the compiler which are not known by clang.

If this gets accepted I can open a PR.

@imwints imwints added the enhancement New feature or request label Jan 3, 2023
@imwints
Copy link
Contributor Author

imwints commented Jan 3, 2023

I think you saw my previous PR which was a bit hasty. I've read your opinion on adding another build system to the mix. I'm pretty sure I've read in those comments that you want to wait for better <ranges> support by llvm and don't want to implement a ton of hacks to support llvm prematurely.

This is just for llvm support and I don't care a lot what build system is used, however as you saw in my other PR I used cmake to do prepare this. The build file is here for @jan-guenter and maybe you to have a look at. It doesn't check if a flag is supported but it adds flags based on the compiler in use with generator expressions. Neat feature. ;)

@aristocratos
Copy link
Owner

Yeah sure, go for it. 👍🏼

When llvm's implementation is complete we should rollback some workarounds.

I'm not sure I necessarily agree with this though, as far as I know only ranges::view is an issue right now, and it's very sparsely used in the code (isn't it just the Tools::ssplit() function?), so better to just replace those functions. As long as the replacement code is well written there shouldn't be any performance difference.

@imwints
Copy link
Contributor Author

imwints commented Jan 6, 2023

You're right, specifically it's just the rng::split function. The Libc++ Ranges Status page has info about the missing parts. I'll have a look at it over the next few months and then we can decide to roll back the changes or leave it as it is.

@imwints
Copy link
Contributor Author

imwints commented Jan 6, 2023

I've encountered two problems today on another machine:

  • Currently I can't compile with LLVM's compiler-rt and llvm-libunwind. The program segfaults on exit. (I've seen similar things with neovim and llvm-libunwind.
  • I can't statically link against glibc (I think glibc can't be compiled with LLVM at all).

I won't open a PR until I figured that out unless you want something like a work in progress PR.

@aristocratos
Copy link
Owner

@stwnt
There's no hurry really, probably gonna be a while before clang 15 is the default clang version in macos and the big linux distributions.
And by the time it is, fixes or workarounds for the issues you're experiencing have hopefully been found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants