microsoft / DirectXTK

The DirectX Tool Kit (aka DirectXTK) is a collection of helper classes for writing DirectX 11.x code in C++

Home Page:https://walbourn.github.io/directxtk/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't compile with clang-cl for ARM64

bbfe opened this issue · comments

commented

I keep getting undefined symbol errors when compiling with clang-cl for ARM64. Is it unsupported?

1>lld-link : error : undefined symbol: neon_dupqrf32
1>>>> referenced by C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\DirectXMathMatrix.inl:1235
1>>>> ARM64\ARM64Release\Game.obj:(struct DirectX::XMMATRIX __cdecl DirectX::XMMatrixScaling(float, float, float))
1>>>> referenced by ARM64\ARM64Release\Main.obj
1>>>> referenced by C:\dxtkjuly4\DirectXTK-master\Src\SpriteBatch.cpp:733
1>>>> DirectXTKARM64.lib(SpriteBatch.obj):(private: void __cdecl DirectX::SpriteBatch::Impl::RenderBatch(struct ID3D11ShaderResourceView *, struct DirectX::SpriteBatch::Impl::SpriteInfo const *const *, unsigned __int64))
1>>>> referenced by C:\dxtkjuly4\DirectXTK-master\Src\SpriteBatch.cpp:830
1>>>> DirectXTKARM64.lib(SpriteBatch.obj):(private: static void __cdecl DirectX::SpriteBatch::Impl::RenderSprite(struct DirectX::SpriteBatch::Impl::SpriteInfo const *, struct DirectX::VertexPositionColorTexture *, union __n128, union __n128))
1>>>> referenced by C:\dxtkjuly4\DirectXTK-master\Src\SpriteBatch.cpp:862
1>>>> DirectXTKARM64.lib(SpriteBatch.obj):(private: static void __cdecl DirectX::SpriteBatch::Impl::RenderSprite(struct DirectX::SpriteBatch::Impl::SpriteInfo const *, struct DirectX::VertexPositionColorTexture *, union __n128, union __n128))
1>>>> referenced by C:\dxtkjuly4\DirectXTK-master\Src\SpriteBatch.cpp:863
1>>>> DirectXTKARM64.lib(SpriteBatch.obj):(private: static void __cdecl DirectX::SpriteBatch::Impl::RenderSprite(struct DirectX::SpriteBatch::Impl::SpriteInfo const *, struct DirectX::VertexPositionColorTexture *, union __n128, union __n128))
1>>>> referenced by C:\dxtkjuly4\DirectXTK-master\Src\SpriteBatch.cpp:1079
1>>>> DirectXTKARM64.lib(SpriteBatch.obj):(public: void __cdecl DirectX::SpriteBatch::Draw(struct ID3D11ShaderResourceView *, struct DirectX::XMFLOAT2 const &, struct tagRECT const *, union __n128, float, struct DirectX::XMFLOAT2 const &, float, enum DirectX::SpriteEffects, float))
1>>>> referenced by C:\dxtkjuly4\DirectXTK-master\Src\SpriteBatch.cpp:1126
1>>>> DirectXTKARM64.lib(SpriteBatch.obj):(public: void __cdecl DirectX::SpriteBatch::Draw(struct ID3D11ShaderResourceView *, union __n128, struct tagRECT const *, union __n128, float, union __n128, float, enum DirectX::SpriteEffects, float))
1>>>> referenced by C:\dxtkjuly4\DirectXTK-master\Src\SpriteBatch.cpp:1128
1>>>> DirectXTKARM64.lib(SpriteBatch.obj):(public: void __cdecl DirectX::SpriteBatch::Draw(struct ID3D11ShaderResourceView *, union __n128, struct tagRECT const *, union __n128, float, union __n128, float, enum DirectX::SpriteEffects, float))
1>>>> referenced by C:\dxtkjuly4\DirectXTK-master\Src\SpriteBatch.cpp:1128
1>>>> DirectXTKARM64.lib(SpriteBatch.obj):(public: void __cdecl DirectX::SpriteBatch::Draw(struct ID3D11ShaderResourceView *, union __n128, struct tagRECT const *, union __n128, float, union __n128, float, enum DirectX::SpriteEffects, float))
1>>>> referenced 11 more times

You should try the latest DirectXMath (you can use the NuGet version until the next Windows 10 SDK releases).

https://github.com/microsoft/DirectXMath/releases

That said, I've had this work so it's probably a mix-up of which arm_neon.h header is getting included.

commented

Can you give me any pointers about including arm_neon.h?

What clang-cl toolset are you using? I was using VS 2019 (16.8)

commented

It's VS2019 latest version. I installed the August 2020 Nuget package and am still getting the error.

1>lld-link : error : undefined symbol: neon_dupqrf32
1>>>> referenced by C:\Users\6700KPC\Documents\Visual Studio 2019\Projects\finalfightclang\packages\directxmath.2020.8.3.1\include\DirectXMathMatrix.inl:1368
1>>>> ARM64\ARM64Release\Game.obj:(struct DirectX::XMMATRIX __cdecl DirectX::XMMatrixScaling(float, float, float))
1>>>> referenced by ARM64\ARM64Release\Main.obj
1>>>> referenced by C:\dxtkjuly4\DirectXTK-master\Src\SpriteBatch.cpp:733
1>>>> DirectXTKARM64.lib(SpriteBatch.obj):(private: void __cdecl DirectX::SpriteBatch::Impl::RenderBatch(struct ID3D11ShaderResourceView *, struct DirectX::SpriteBatch::Impl::SpriteInfo const *const *, unsigned __int64))
1>>>> referenced by C:\dxtkjuly4\DirectXTK-master\Src\SpriteBatch.cpp:830
1>>>> DirectXTKARM64.lib(SpriteBatch.obj):(private: static void __cdecl DirectX::SpriteBatch::Impl::RenderSprite(struct DirectX::SpriteBatch::Impl::SpriteInfo const *, struct DirectX::VertexPositionColorTexture *, union __n128, union __n128))
1>>>> referenced by C:\dxtkjuly4\DirectXTK-master\Src\SpriteBatch.cpp:862
1>>>> DirectXTKARM64.lib(SpriteBatch.obj):(private: static void __cdecl DirectX::SpriteBatch::Impl::RenderSprite(struct DirectX::SpriteBatch::Impl::SpriteInfo const *, struct DirectX::VertexPositionColorTexture *, union __n128, union __n128))
1>>>> referenced by C:\dxtkjuly4\DirectXTK-master\Src\SpriteBatch.cpp:863
1>>>> DirectXTKARM64.lib(SpriteBatch.obj):(private: static void __cdecl DirectX::SpriteBatch::Impl::RenderSprite(struct DirectX::SpriteBatch::Impl::SpriteInfo const *, struct DirectX::VertexPositionColorTexture *, union __n128, union __n128))
1>>>> referenced by C:\dxtkjuly4\DirectXTK-master\Src\SpriteBatch.cpp:1079
1>>>> DirectXTKARM64.lib(SpriteBatch.obj):(public: void __cdecl DirectX::SpriteBatch::Draw(struct ID3D11ShaderResourceView *, struct DirectX::XMFLOAT2 const &, struct tagRECT const *, union __n128, float, struct DirectX::XMFLOAT2 const &, float, enum DirectX::SpriteEffects, float))
1>>>> referenced by C:\dxtkjuly4\DirectXTK-master\Src\SpriteBatch.cpp:1126
1>>>> DirectXTKARM64.lib(SpriteBatch.obj):(public: void __cdecl DirectX::SpriteBatch::Draw(struct ID3D11ShaderResourceView *, union __n128, struct tagRECT const *, union __n128, float, union __n128, float, enum DirectX::SpriteEffects, float))
1>>>> referenced by C:\dxtkjuly4\DirectXTK-master\Src\SpriteBatch.cpp:1128
1>>>> DirectXTKARM64.lib(SpriteBatch.obj):(public: void __cdecl DirectX::SpriteBatch::Draw(struct ID3D11ShaderResourceView *, union __n128, struct tagRECT const *, union __n128, float, union __n128, float, enum DirectX::SpriteEffects, float))
1>>>> referenced by C:\dxtkjuly4\DirectXTK-master\Src\SpriteBatch.cpp:1128
1>>>> DirectXTKARM64.lib(SpriteBatch.obj):(public: void __cdecl DirectX::SpriteBatch::Draw(struct ID3D11ShaderResourceView *, union __n128, struct tagRECT const *, union __n128, float, union __n128, float, enum DirectX::SpriteEffects, float))
1>>>> referenced 11 more times

Are you using MSBuild clangcl PlatformToolset or CMake?

Also which release of DirectXTK in particular are you using?

commented

I'm using clangcl. I downloaded DirectXTK from master in July.

It looks like the problem is that C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\Llvm\x64\lib\clang\10.0.0\include doesn't have an arm64_neon.h in it. Only the MSVC folder does.

OK, I don't how I missed this but I think it's because ARM64 for clang-cl was only added really recently. My testing before used android environments.

In DirectXMath.h:

#if defined(_MSC_VER) && (defined(_M_ARM64) || defined(_M_HYBRID_X86_ARM64))
#include <arm64_neon.h>
#else
#include <arm_neon.h>
#endif
#endif

This should be:

#if defined(_MSC_VER) & !defined(__clang__) && (defined(_M_ARM64) || defined(_M_HYBRID_X86_ARM64))
#include <arm64_neon.h>
#else
#include <arm_neon.h>
#endif
#endif
commented

Thanks, gets farther. I'm now getting this. I'm assuming that I have to put in similar !defined(clang) conditions for these.

Severity Code Description Project File Line Source Suppression State
Error use of undeclared identifier 'vld1_u32_ex' Final Fight Remake C:\Users\6700KPC\Documents\Visual Studio 2019\Projects\finalfightclang\packages\directxmath.2020.8.3.1\include\DirectXMathConvert.inl 305 Build

#ifdef _MSC_VER
uint32x2_t x = vld1_u32_ex(pSource, 64);
#else
uint32x2_t x = vld1_u32(pSource);

Yup. Just checked in a fix to DirectXMath

Note that I hit a code-gen bug in my test suite with clang v10 and clang v11, so YMMV.

commented

After making the changes it builds for me at least but I haven't actually tested it on an ARM device yet. Thanks.