Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't compile with clang-cl for ARM64 #246

Closed
bbfe opened this issue Dec 15, 2020 · 12 comments
Closed

Can't compile with clang-cl for ARM64 #246

bbfe opened this issue Dec 15, 2020 · 12 comments
Labels

Comments

@bbfe
Copy link

bbfe commented Dec 15, 2020

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

@walbourn
Copy link
Member

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.

@bbfe
Copy link
Author

bbfe commented Dec 15, 2020

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

@walbourn
Copy link
Member

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

@bbfe
Copy link
Author

bbfe commented Dec 15, 2020

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

@walbourn
Copy link
Member

Are you using MSBuild clangcl PlatformToolset or CMake?

@walbourn
Copy link
Member

Also which release of DirectXTK in particular are you using?

@bbfe
Copy link
Author

bbfe commented Dec 15, 2020

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.

@walbourn walbourn added bug and removed question labels Dec 15, 2020
@walbourn
Copy link
Member

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

@bbfe
Copy link
Author

bbfe commented Dec 15, 2020

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);

@walbourn
Copy link
Member

Yup. Just checked in a fix to DirectXMath

walbourn referenced this issue in microsoft/DirectXMath Dec 15, 2020
@walbourn
Copy link
Member

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

@bbfe
Copy link
Author

bbfe commented Dec 15, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants