Problem with installing on Mac
First, I had to add add_compile_options(-Wno-c++11-narrowing) into CMakeLists.txt to get rid of this error:
error: non-constant-expression cannot be narrowed from type 'value_type' (aka 'int') to 'unsigned long long' in initializer list [-Wc++11-narrowing]
auto eigTens = P_inv.at({0, maxIdx}) * qs[0];
But I still have the following error while installing:
error: implicit conversion from '_Complex double' to 'double' is not permitted in C++
od[0] *= (cytnx_complex128)_Rin[i * N + i];
I use clang as a compiler.
The first one can be resolved by explicit casting.
error: implicit conversion from '_Complex double' to 'double' is not permitted in C++
od[0] *= (cytnx_complex128)_Rin[i * N + i];
Can you tell me where it occurs?
Here is a related fix https://github.com/tfhe/tfhe/issues/213
Here are the whole error messages:
/Cytnx/src/backend/linalg_internal_cpu/Det_internal.cpp:31:36: error: implicit conversion from '_Complex double' to 'double' is not permitted in C++
od[0] *= (cytnx_complex128)_Rin[i * N + i];
~ ^~~~~~~~~~~~~~~
/Cytnx/src/backend/linalg_internal_cpu/Det_internal.cpp:55:35: error: implicit conversion from '_Complex float' to 'float' is not permitted in C++
od[0] *= (cytnx_complex64)_Rin[i * N + i];
#455 fixed the no-c++11-narrowing problem. For the implicit conversion, I can't reproduce the error while using clang++. @josephinius, does the error still happen?
with commit 0be640dcb08dcfd4de8ed9a2f7da73dec7ddfaf2 and clang version: -- The CXX compiler identification is AppleClang 15.0.0.15000309 -- The C compiler identification is AppleClang 15.0.0.15000309
I still encounter this
[ 83%] Building CXX object CMakeFiles/cytnx.dir/src/backend/linalg_internal_cpu/Ger_internal.cpp.o
/Users/pcchen/github/Cytnx/src/backend/linalg_internal_cpu/Det_internal.cpp:31:36: error: implicit conversion from '_Complex double' to 'double' is not permitted in C++
od[0] *= (cytnx_complex128)_Rin[i * N + i];
~ ^~~~~~~~~~~~~~~
/Users/pcchen/github/Cytnx/src/backend/linalg_internal_cpu/Det_internal.cpp:55:35: error: implicit conversion from '_Complex float' to 'float' is not permitted in C++
od[0] *= (cytnx_complex64)_Rin[i * N + i];
~ ^~~~~~~~~~~~~~~
2 errors generated.
A solution was given in #461. I am not sure if the change really suppress the error of invalid conversion because I cannot reproduce on CentOS with clang and the online clang compiler either.
Someone who has Mac can try to build the code below with clang++ and see if it can be successfully compiled. If it is not passed, there may be a bug in Mac's clang.
#include <complex.h>
#include <iostream>
#include <complex>
int main() {
double _Complex c_type_right = 123.4 + 45435.1I;
std::complex<double> cpp_type_right{23, 23};
std::complex<double> left{43.4, 2532.1};
left *= (std::complex<double>)c_type_right;
left *= (std::complex<double>)cpp_type_right;
std::cout << std::complex<float>{c_type_right} << std::endl;
}
@IvanaGyro I tried to compile the code
#include <complex.h>
#include <iostream>
#include <complex>
int main() {
double _Complex c_type_right = 123.4 + 45435.1I;
std::complex<double> cpp_type_right{23, 23};
std::complex<double> left{43.4, 2532.1};
left *= (std::complex<double>)c_type_right;
left *= (std::complex<double>)cpp_type_right;
std::cout << std::complex<float>{c_type_right} << std::endl;
}
using Apple clang version 15.0.0 (clang-1500.3.9.4); I got the error:
complex_example.cpp:10:35: error: implicit conversion from '_Complex double' to 'double' is not permitted in C++
left *= (std::complex
It seems that #461 has resolve this issue. Apple Clang missed some features. We may consider not to support Apple Clang.
Which c++ version are we targeting? I would suggest target C++24 (don't use anything that is too new)
And If to possible please write the code that could cover most of the compilers ( specifically clang has more restrictions compared to g++, so I suggest to target clang when developing).
Also. Apple's clang (Apple clang) is different from the typical clang. The behavior is different from the clang one installs on Mac via homebrew.......
I wanted to bring this up since it seems there is a workaround: Installing a different version of clang that follows the standards. Could someone comment on this or give a brief howto? This could also be added as a comment in the user guide for Mac users.
Maybe refer to this post: https://apple.stackexchange.com/questions/245891/installed-gcc-with-homebrew-now-how-to-use-that-gcc-instead-of-clang It seems using homebrew is a simple way to install the compiler like GCC or Clang.
#616 is one of PR of the milestone to release and build Cytnx for Mac.
Can also do conan2.
On Tue, Jun 24, 2025, 05:46 Ivana @.***> wrote:
IvanaGyro left a comment (Cytnx-dev/Cytnx#449) https://github.com/Cytnx-dev/Cytnx/issues/449#issuecomment-2999594067
#616 https://github.com/Cytnx-dev/Cytnx/pull/616 is one of PR of the milestone to release and build Cytnx for Mac.
— Reply to this email directly, view it on GitHub https://github.com/Cytnx-dev/Cytnx/issues/449#issuecomment-2999594067, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFCX3SL5QD3AYQH66OEPOJD3FENBHAVCNFSM6AAAAAB4OBHUZ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDSOJZGU4TIMBWG4 . You are receiving this because you commented.Message ID: @.***>
This should be fixed by PR #639 @josephinius could you check it is working?