lcalc: fix clang-19 build#370176
lcalc: fix clang-19 build#370176collares merged 1 commit intoNixOS:masterfrom paparodeo:lcalc-clang-19
Conversation
|
Scarily, the code includes a full copy of |
|
I believe the vendored one is getting used as just including with clang-19. probably be better to fix the errors and use |
|
Thanks for checking! While I agree that using |
for clang-19 I initially just added a compiler flag https://github.com/llvm/llvm-project/blob/main/libcxx/include/__fwd/complex.h |
|
Hmm, that's a good point! Does it build with |
|
this builds for both platforms: I could make the conditional on |
https://gitlab.com/sagemath/lcalc/-/issues/16 add -D_GLIBCXX_COMPLEX -D_LIBCPP_COMPLEX -D_LIBCPP___FWD_COMPLEX_H to prevent including system <complex> and use the vendored copy.
|
I don't think it needs to be set conditionally, leaving all is fine. Do you know if the third one is needed, given the second? Thanks so much for the workaround and for the upstream MR! |
|
I don't really mind having the third line, but just to be sure I know how to test Clang fixes: I replaced |
that just pulls in |
|
Got it, thanks! |
| "-D_LIBCPP_COMPLEX" | ||
| "-D_LIBCPP___FWD_COMPLEX_H" | ||
| ]; | ||
|
|
There was a problem hiding this comment.
so python3Packages.sagelib includes Lcomplex.h and fails to compile. so this isn't going to work for building sage with libcxx-19.
the original PR that used https://gitlab.com/sagemath/lcalc/-/issues/16 works tho.
(FWIW I've gotten sage to build on darwin now after a few more changes and some fixes to gcc darwin build)
There was a problem hiding this comment.
so can also just replace Lcomplex.h with <complex> and add operators with complex<double> and an int. nothing seems to be doing anything with a complex and a long or long long (I added operators with no definitions and didn't get a link errors.
inline Complex operator* (const Complex &l, int r) { return l * double(r); }
inline Complex operator/ (const Complex &l, int r) { return l / double(r); }
inline Complex operator+ (const Complex &l, int r) { return l + double(r); }
inline Complex operator- (const Complex &l, int r) { return l - double(r); }
inline bool operator==(const Complex &l, int r) { return l == double(r); }
inline bool operator!=(const Complex &l, int r) { return l != double(r); }
inline Complex operator*(int l, const Complex &r) { return r * l; }
inline Complex operator+(int l, const Complex &r) { return r + l; }
inline Complex operator/(int l, const Complex &r) { return double(l) / r; }
inline Complex operator-(int l, const Complex &r) { return double(l) - r; }There was a problem hiding this comment.
Ok, let's go with 166b3cd then. Sorry for not testing Sage!
There was a problem hiding this comment.
it only breaks with clang / libc++ so gcc / libstd++ is fine. will setup a PR in a little bit.
There was a problem hiding this comment.
Ah, good to know. If it's clang only I will wait for your PR instead of reverting now.
https://gitlab.com/sagemath/lcalc/-/issues/16
add -D_GLIBCXX_COMPLEX -D_LIBCPP_COMPLEX -D_LIBCPP___FWD_COMPLEX_H to prevent including system and use the vendored copy.
https://hydra.nixos.org/build/282766851
Things done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.