mlx-swift icon indicating copy to clipboard operation
mlx-swift copied to clipboard

The cxxLanguageStandard: .gnucxx17 used in this project is not compatible with my ios project

Open lalavany-microsoft-com opened this issue 5 months ago • 4 comments

In my iOS project we are using c++23 as the clang language standard and using gnucxx17 with mlx-swift might cause runtime inconsistencies. When I change this to c++23 in this project, getting below errors. Can you please change clang language to c++23 & fix below errors.

/Cmlx/mlx/mlx/backend/cpu/simd/base_simd.h:108:29: error: use of undeclared identifier 'typeof' 108 | return Simd<T, 1>{T{((typeof(x))(0.5)) * std::log1p(r), theta}}; | ^

/Cmlx/mlx/mlx/3rdparty/pocketfft.h:796:22: error: variable has incomplete type 'std::exception_ptr' 796 | std::exception_ptr ex;

/Cmlx/mlx/mlx/3rdparty/pocketfft.h:808:14: error: calling 'current_exception' with incomplete return type 'exception_ptr' 808 | ex = std::current_exception();

lalavany-microsoft-com avatar Jul 15 '25 09:07 lalavany-microsoft-com

@awni this might be an issue for mlx (core) -- is the C++ standard something that is going to move to c++23?

davidkoski avatar Jul 16 '25 20:07 davidkoski

We're not planning to change to C++23 anytime soon. We do intend to bump to C++20 soon though (maybe in the next week or so).

Is it the case that downstream apps have to use the same C++ version as MLX core? That seems like the more important bit to fix.. if possible?

awni avatar Jul 16 '25 20:07 awni

We're not planning to change to C++23 anytime soon. We do intend to bump to C++20 soon though (maybe in the next week or so).

Is it the case that downstream apps have to use the same C++ version as MLX core? That seems like the more important bit to fix.. if possible?

Mixing binaries compiled with different C++ compilers is generally not recommended due to potential Application Binary Interface (ABI) incompatibilities. So this will need a fix

lalavany-microsoft-com avatar Jul 17 '25 13:07 lalavany-microsoft-com

I don't think that is accurate actually.. otherwise we'd have to compile every shared library we use with the same C++ version (which is definitely not the case).

awni avatar Jul 17 '25 13:07 awni