ITADN

[Bug] Compilation error when using eigen3.4.0

#4913Openbuzhengdao 创建于 2026-04-28
bugmore info needed
B
buzhengdaocommented
### Brief Issue Summary cmake tools 1.23.51及以后版本在使用“#include <Eigen/Core>”时编译卡住,vscode重启前插件会一直卡在编译状态无法中断。 <img width="666" height="19" alt="Image" src="https://github.com/user-attachments/assets/f76aa186-ba31-48aa-ad83-84a6e1a3b193" /> ### CMake Tools Diagnostics ```shell { "os": "linux", "vscodeVersion": "1.115.0", "cmtVersion": "1.23.52", "configurations": [ { "folder": "/home/synapse/th_algorithm", "cmakeVersion": "3.22.1", "configured": true, "generator": "Unix Makefiles", "usesPresets": false, "compilers": { "C": "/usr/bin/aarch64-linux-gnu-gcc", "CXX": "/usr/bin/aarch64-linux-gnu-g++" } } ], "cpptoolsIntegration": { "isReady": false, "hasCodeModel": false, "activeBuildType": "", "buildTypesSeen": [], "requests": [], "responses": [], "partialMatches": [], "targetCount": 0, "executablesCount": 0, "librariesCount": 0, "targets": [] }, "settings": [ { "communicationMode": "automatic", "useCMakePresets": "auto", "configureOnOpen": true } ] } ``` ### Debug Log ```shell [build] /usr/include/eigen3/Eigen/src/Core/DenseStorage.h(223): warning #20012-D: __host__ annotation is ignored on a function("DenseStorage") that is explicitly defaulted on its first declaration [build] __attribute__((host)) __attribute__((device)) DenseStorage(const DenseStorage&) = default; [build] ^ [build] [build] Remark: The warnings can be suppressed with "-diag-suppress <warning-number>" [build] [build] /usr/include/eigen3/Eigen/src/Core/DenseStorage.h(223): warning #20012-D: __device__ annotation is ignored on a function("DenseStorage") that is explicitly defaulted on its first declaration [build] __attribute__((host)) __attribute__((device)) DenseStorage(const DenseStorage&) = default; [build] ^ [build] [build] /usr/include/eigen3/Eigen/src/Core/DenseStorage.h(233): warning #20012-D: __host__ annotation is ignored on a function("operator=") that is explicitly defaulted on its first declaration [build] __attribute__((host)) __attribute__((device)) DenseStorage& operator=(const DenseStorage&) = default; [build] ^ [build] [build] /usr/include/eigen3/Eigen/src/Core/DenseStorage.h(233): warning #20012-D: __device__ annotation is ignored on a function("operator=") that is explicitly defaulted on its first declaration [build] __attribute__((host)) __attribute__((device)) DenseStorage& operator=(const DenseStorage&) = default; [build] ^ [build] [build] /usr/include/eigen3/Eigen/src/Core/DenseStorage.h(248): warning #20012-D: __host__ annotation is ignored on a function("DenseStorage") that is explicitly defaulted on its first declaration [build] __attribute__((host)) __attribute__((device)) DenseStorage(DenseStorage&&) = default; [build] ^ [build] [build] /usr/include/eigen3/Eigen/src/Core/DenseStorage.h(248): warning #20012-D: __device__ annotation is ignored on a function("DenseStorage") that is explicitly defaulted on its first declaration [build] __attribute__((host)) __attribute__((device)) DenseStorage(DenseStorage&&) = default; [build] ^ [build] [build] /usr/include/eigen3/Eigen/src/Core/DenseStorage.h(249): warning #20012-D: __host__ annotation is ignored on a function("operator=") that is explicitly defaulted on its first declaration [build] __attribute__((host)) __attribute__((device)) DenseStorage& operator=(DenseStorage&&) = default; [build] ^ [build] [build] /usr/include/eigen3/Eigen/src/Core/DenseStorage.h(249): warning #20012-D: __device__ annotation is ignored on a function("operator=") that is explicitly defaulted on its first declaration [build] __attribute__((host)) __attribute__((device)) DenseStorage& operator=(DenseStorage&&) = default; [build] ^ [build] [build] [ 88%] Linking CXX shared library ../../lib/Linux/aarch64/librd_image.so [build] [ 88%] Built target rd_image [build] /usr/include/eigen3/Eigen/src/Core/MathFunctions.h(1535): warning #20013-D: calling a constexpr __host__ function("real") from a __host__ __device__ function("abs") is not allowed. The experimental flag '--expt-relaxed-constexpr' can be used to allow this. [build] return ::hypotf(x.real(), x.imag()); [build] ^ [build] [build] Remark: The warnings can be suppressed with "-diag-suppress <warning-number>" [build] [build] /usr/include/eigen3/Eigen/src/Core/MathFunctions.h(1535): warning #20013-D: calling a constexpr __host__ function("imag") from a __host__ __device__ function("abs") is not allowed. The experimental flag '--expt-relaxed-constexpr' can be used to allow this. [build] return ::hypotf(x.real(), x.imag()); [build] ^ [build] [build] /usr/include/eigen3/Eigen/src/Core/MathFunctions.h(1535): warning #20015-D: calling a constexpr __host__ function from a __host__ __device__ function is not allowed. The experimental flag '--expt-relaxed-constexpr' can be used to allow this. [build] return ::hypotf(x.real(), x.imag()); [build] ^ [build] [build] /usr/include/eigen3/Eigen/src/Core/MathFunctions.h(1535): warning #20015-D: calling a constexpr __host__ function from a __host__ __device__ function is not allowed. The experimental flag '--expt-relaxed-constexpr' can be used to allow this. [build] return ::hypotf(x.real(), x.imag()); [build] ^ [build] [build] /usr/include/eigen3/Eigen/src/Core/MathFunctions.h(1540): warning #20013-D: calling a constexpr __host__ function("real") from a __host__ __device__ function("abs") is not allowed. The experimental flag '--expt-relaxed-constexpr' can be used to allow this. [build] return ::hypot(x.real(), x.imag()); [build] ^ [build] [build] /usr/include/eigen3/Eigen/src/Core/MathFunctions.h(1540): warning #20013-D: calling a constexpr __host__ function("imag") from a __host__ __device__ function("abs") is not allowed. The experimental flag '--expt-relaxed-constexpr' can be used to allow this. [build] return ::hypot(x.real(), x.imag()); [build] ^ [build] [build] /usr/include/eigen3/Eigen/src/Core/MathFunctions.h(1540): warning #20015-D: calling a constexpr __host__ function from a __host__ __device__ function is not allowed. The experimental flag '--expt-relaxed-constexpr' can be used to allow this. [build] return ::hypot(x.real(), x.imag()); [build] ^ [build] [build] /usr/include/eigen3/Eigen/src/Core/MathFunctions.h(1540): warning #20015-D: calling a constexpr __host__ function from a __host__ __device__ function is not allowed. The experimental flag '--expt-relaxed-constexpr' can be used to allow this. [build] return ::hypot(x.real(), x.imag()); [build] ^ [build] [build] /usr/include/eigen3/Eigen/src/Core/MathFunctions.h(1564): warning #20013-D: calling a constexpr __host__ function("real") from a __host__ __device__ function("exp") is not allowed. The experimental flag '--expt-relaxed-constexpr' can be used to allow this. [build] float com = ::expf(x.real()); [build] ^ [build] [build] /usr/include/eigen3/Eigen/src/Core/MathFunctions.h(1565): warning #20013-D: calling a constexpr __host__ function("imag") from a __host__ __device__ function("exp") is not allowed. The experimental flag '--expt-relaxed-constexpr' can be used to allow this. [build] float res_real = com * ::cosf(x.imag()); [build] ^ [build] [build] /usr/include/eigen3/Eigen/src/Core/MathFunctions.h(1566): warning #20013-D: calling a constexpr __host__ function("imag") from a __host__ __device__ function("exp") is not allowed. The experimental flag '--expt-relaxed-constexpr' can be used to allow this. [build] float res_imag = com * ::sinf(x.imag()); [build] ^ [build] [build] /usr/include/eigen3/Eigen/src/Core/MathFunctions.h(1564): warning #20015-D: calling a constexpr __host__ function from a __host__ __device__ function is not allowed. The experimental flag '--expt-relaxed-constexpr' can be used to allow this. [build] float com = ::expf(x.real()); [build] ^ [build] [build] /usr/include/eigen3/Eigen/src/Core/MathFunctions.h(1565): warning #20015-D: calling a constexpr __host__ function from a __host__ __device__ function is not allowed. The experimental flag '--expt-relaxed-constexpr' can be used to allow this. [build] float res_real = com * ::cosf(x.imag()); [build] ^ [build] [build] /usr/include/eigen3/Eigen/src/Core/MathFunctions.h(1566): warning #20015-D: calling a constexpr __host__ function from a __host__ __device__ function is not allowed. The experimental flag '--expt-relaxed-constexpr' can be used to allow this. [build] float res_imag = com * ::sinf(x.imag()); [build] ^ [build] [build] /usr/include/eigen3/Eigen/src/Core/MathFunctions.h(1567): warning #20015-D: calling a constexpr __host__ function from a __host__ __device__ function is not allowed. The experimental flag '--expt-relaxed-constexpr' can be used to allow this. [build] return std::complex<float>(res_real, res_imag); [build] ^ [build] [build] /usr/include/eigen3/Eigen/src/Core/MathFunctions.h(1572): warning #20013-D: calling a constexpr __host__ function("real") from a __host__ __device__ function("exp") is not allowed. The experimental flag '--expt-relaxed-constexpr' can be used to allow this. [build] double com = ::exp(x.real()); [build] ^ [build] [build] /usr/include/eigen3/Eigen/src/Core/MathFunctions.h(1573): warning #20013-D: calling a constexpr __host__ function("imag") from a __host__ __device__ function("exp") is not allowed. The experimental flag '--expt-relaxed-constexpr' can be used to allow this. [build] double res_real = com * ::cos(x.imag()); [build] ^ [build] [build] /usr/include/eigen3/Eigen/src/Core/MathFunctions.h(1574): warning #20013-D: calling a constexpr __host__ function("imag") from a __host__ __device__ function("exp") is not allowed. The experimental flag '--expt-relaxed-constexpr' can be used to allow this. [build] double res_imag = com * ::sin(x.imag()); [build] ^ [build] [build] /usr/include/eigen3/Eigen/src/Core/MathFunctions.h(1572): warning #20015-D: calling a constexpr __host__ function from a __host__ __device__ function is not allowed. The experimental flag '--expt-relaxed-constexpr' can be used to allow this. [build] double com = ::exp(x.real()); [build] ^ [build] [build] /usr/include/eigen3/Eigen/src/Core/MathFunctions.h(1573): warning #20015-D: calling a constexpr __host__ function from a __host__ __device__ function is not allowed. The experimental flag '--expt-relaxed-constexpr' can be used to allow this. [build] double res_real = com * ::cos(x.imag()); [build] ^ [build] [build] /usr/include/eigen3/Eigen/src/Core/MathFunctions.h(1574): warning #20015-D: calling a constexpr __host__ function from a __host__ __device__ function is not allowed. The experimental flag '--expt-relaxed-constexpr' can be used to allow this. [build] double res_imag = com * ::sin(x.imag()); [build] ^ [build] [build] /usr/include/eigen3/Eigen/src/Core/MathFunctions.h(1575): warning #20015-D: calling a constexpr __host__ function from a __host__ __device__ function is not allowed. The experimental flag '--expt-relaxed-constexpr' can be used to allow this. [build] return std::complex<double>(res_real, res_imag); [build] ^ [build] [build] /usr/include/eigen3/Eigen/src/Core/arch/CUDA/Complex.h(234): warning #20015-D: calling a constexpr __host__ function from a __host__ __device__ function is not allowed. The experimental flag '--expt-relaxed-constexpr' can be used to allow this. [build] __attribute__((host)) __attribute__((device)) inline std::complex<float> operator+(const std::complex<float>& a) { return a; } __attribute__((host)) __attribute__((device)) inline std::complex<float> operator-(const std::complex<float>& a) { return std::complex<float>(-numext::real(a), -numext::imag(a)); } __attribute__((host)) __attribute__((device)) inline std::complex<float> operator+(const std::complex<float>& a, const std::complex<float>& b) { return std::complex<float>(numext::real(a) + numext::real(b), numext::imag(a) + numext::imag(b)); } __attribute__((host)) __attribute__((device)) inline std::complex<float> operator+(const std::complex<float>& a, const float& b) { return std::complex<float>(numext::real(a) + b, numext::imag(a)); } __attribute__((host)) __attribute__((device)) inline std::complex<float> operator+(const float& a, const std::complex<float>& b) { return std::complex<float>(a + numext::real(b), numext::imag(b)); } __attribute__((host)) __attribute__((device)) inline std::complex<float> operator-(const std::complex<float>& a, const std::complex<float>& b) { return std::complex<float>(numext::real(a) - numext::real(b), numext::imag(a) - numext::imag(b)); } __attribute__((host)) __attribute__((device)) inline std::complex<float> operator-(const std::complex<float>& a, const float& b) { return std::complex<float>(numext::real(a) - b, numext::imag(a)); } __attribute__((host)) __attribute__((device)) inline std::complex<float> operator-(const float& a, const std::complex<float>& b) { return std::complex<float>(a - numext::real(b), -numext::imag(b)); } __attribute__((host)) __attribute__((device)) inline std::complex<float> operator*(const std::complex<float>& a, const std::complex<float>& b) { return complex_multiply(a, b); } __attribute__((host)) __attribute__((device)) inline std::complex<float> operator*(const std::complex<float>& a, const float& b) { return std::complex<float>(numext::real(a) * b, numext::imag(a) * b); } __attribute__((host)) __attribute__((device)) inline std::complex<float> operator*(const float& a, const std::complex<float>& b) { return std::complex<float>(a * numext::real(b), a * numext::imag(b)); } __attribute__((host)) __attribute__((device)) inline std::complex<float> operator/(const std::complex<float>& a, const std::complex<float>& b) { return complex_divide(a, b); } __attribute__((host)) __attribute__((device)) inline std::complex<float> operator/(const std::complex<float>& a, const float& b) { return std::complex<float>(numext::real(a) / b, numext::imag(a) / b); } __attribute__((host)) __attribute__((device)) inline std::complex<float> operator/(const float& a, const std::complex<float>& b) { return complex_divide(std::complex<float>(a, 0), b); } __attribute__((host)) __attribute__((device)) inline std::complex<float>& operator+=(std::complex<float>& a, const std::complex<float>& b) { numext::real_ref(a) += numext::real(b); numext::imag_ref(a) += numext::imag(b); return a; } __attribute__((host)) __attribute__((device)) inline std::complex<float>& operator-=(std::complex<float>& a, const std::complex<float>& b) { numext::real_ref(a) -= numext::real(b); numext::imag_ref(a) -= numext::imag(b); return a; } __attribute__((host)) __attribute__((device)) inline std::complex<float>& operator*=(std::complex<float>& a, const std::complex<float>& b) { a = complex_multiply(a, b); return a; } __attribute__((host)) __attribute__((device)) inline std::complex<float>& operator/=(std::complex<float>& a, const std::complex<float>& b) { a = complex_divide(a, b); return a; } __attribute__((host)) __attribute__((device)) inline bool operator==(const std::complex<float>& a, const std::complex<float>& b) { return numext::real(a) == numext::real(b) && numext::imag(a) == numext::imag(b); } __attribute__((host)) __attribute__((device)) inline bool operator==(const std::complex<float>& a, const float& b) { return numext::real(a) == b && numext::imag(a) == 0; } __attribute__((host)) __attribute__((device)) inline bool operator==(const float& a, const std::complex<float>& b) { return a == numext::real(b) && 0 == numext::imag(b); } __attribute__((host)) __attribute__((device)) inline bool operator!=(const std::complex<float>& a, const std::complex<float>& b) { return !(a == b); } __attribute__((host)) __attribute__((device)) inline bool operator!=(const std::complex<float>& a, const float& b) { return !(a == b); } __attribute__((host)) __attribute__((device)) inline bool operator!=(const float& a, const std::complex<float>& b) { return !(a == b); } [build] ^ [build] ``` ### Additional Information _No response_
1 条评论