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

Linking errors with AVX trigonometric functions on MSVC 14 #147

Open
lsa-pilot opened this issue Nov 2, 2016 · 4 comments
Open

Linking errors with AVX trigonometric functions on MSVC 14 #147

lsa-pilot opened this issue Nov 2, 2016 · 4 comments

Comments

@lsa-pilot
Copy link

lsa-pilot commented Nov 2, 2016

Vc version / revision Operating System Compiler & Version Compiler Flags Assembler & Version CPU
1.3.0 / tagged release Windows 7 Prof SP1 MSVC 19.00.24215.1 see below i7-3520M
Using Visual Studio 2015 Community Version 14.0.25431.01 Update 3

All Options (Debug) for example_polarcoord_avx.prj

/GS /TP /W3 /Zc:wchar_t /I"D:\work\SXall\Vc" /I"D:\work\SXall\Vc\include" /I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt" /I"D:\work\SXall\Vc\examples\polarcoord\example_polarcoord_scalar" /I"D:\work\SXall\Vc\examples\polarcoord\INTERFACE" /I"D:\work\SXall\Vc\examples\polarcoord\example_polarcoord_sse" /I"D:\work\SXall\Vc\examples\polarcoord\example_polarcoord_avx" /Zi /Gm- /Od /Ob0 /Fd"example_polarcoord_avx.dir\Debug\vc140.pdb" /Zc:inline /fp:precise /D "WIN32" /D "_WINDOWS" /D "_DEBUG" /D "Vc_IMPL=AVX" /D "_CRT_SECURE_NO_WARNINGS" /D "SSE2" /D "SSE3" /D "SSSE3" /D "SSE4_1" /D "SSE4_2" /D "AVX" /D "CMAKE_INTDIR="Debug"" /D "_MBCS" /errorReport:prompt /WX- /Zc:forScope /RTC1 /GR /Gd /MDd /Fa"Debug/" /EHsc /nologo /Fo"example_polarcoord_avx.dir\Debug" /Fp"example_polarcoord_avx.dir\Debug\example_polarcoord_avx.pch"

Testcase

example_polarcoord_avx, linkTest, linkTestLibDynamic1, linkTestLibDynamic2, trigonometrix_avx, sorted_avx, subscript_avx, scatterinterleavedmemory_avx

Actual Results

Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol "public: static class Vc_1::Vector<float,struct Vc_1::VectorAbi::Avx> __cdecl Vc_1::Common::Trigonometric<struct Vc_1::ImplementationT<6> >::atan2<class Vc_1::Vector<float,struct Vc_1::VectorAbi::Avx> >(class Vc_1::Vector<float,struct Vc_1::VectorAbi::Avx> const &,class Vc_1::Vector<float,struct Vc_1::VectorAbi::Avx> const &)" (??$atan2@V?$Vector@MUAvx@VectorAbi@Vc_1@@@Vc_1@@@?$Trigonometric@U?$ImplementationT@$05@Vc_1@@@common@Vc_1@@sa?AV?$Vector@MUAvx@VectorAbi@Vc_1@@@2@AEBV32@0@Z) referenced in function "class Vc_1::Vector<float,struct Vc_1::VectorAbi::Avx> __cdecl Vc_1::atan2<float,struct Vc_1::VectorAbi::Avx>(class Vc_1::Vector<float,struct Vc_1::VectorAbi::Avx> const &,class Vc_1::Vector<float,struct Vc_1::VectorAbi::Avx> const &)" (??$atan2@MUAvx@VectorAbi@Vc_1@@@Vc_1@@ya?AV?$Vector@MUAvx@VectorAbi@Vc_1@@@0@AEBV10@0@Z) example_polarcoord_avx D:\work\SXall\Vc\build\examples\polarcoord\main.obj 1

Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol "public: static class Vc_1::Vector<float,struct Vc_1::VectorAbi::Avx> __cdecl Vc_1::Common::Trigonometric<struct Vc_1::ImplementationT<6> >::sin<class Vc_1::Vector<float,struct Vc_1::VectorAbi::Avx> >(class Vc_1::Vector<float,struct Vc_1::VectorAbi::Avx> const &)" (??$sin@V?$Vector@MUAvx@VectorAbi@Vc_1@@@Vc_1@@@?$Trigonometric@U?$ImplementationT@$05@Vc_1@@@common@Vc_1@@sa?AV?$Vector@MUAvx@VectorAbi@Vc_1@@@2@AEBV32@@z) referenced in function "class Vc_1::Vector<float,struct Vc_1::VectorAbi::Avx> __cdecl Vc_1::sin<float,struct Vc_1::VectorAbi::Avx>(class Vc_1::Vector<float,struct Vc_1::VectorAbi::Avx> const &)" (??$sin@MUAvx@VectorAbi@Vc_1@@@Vc_1@@ya?AV?$Vector@MUAvx@VectorAbi@Vc_1@@@0@AEBV10@@z) linkTest D:\work\SXall\Vc\build\tests\linkTest0.obj 1

Expected Results

No Link Errors.

Compilation Details

After adding to the include path the universal C Runtime directory "C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt" I was able to build Vc and all examples that do not use Qt4 except example_polarcoord_avx and example_polarcoord_default; when compiling the tests, I also ran into link errors (LNK2001) in many projects: linkTest, linkTestLibDynamic1, linkTestLibDynamic2, trigonometrix_avx, sorted_avx, subscript_avx, scatterinterleavedmemory_avx.

How to resolve these linking problems? They seem related to trigonometric functions.

@mattkretz
Copy link
Member

Hi. Thanks for the report.

Questions:

  1. Is the version number for MSVC correct? Mine says "MSVC 19.0.24215.1" so yours should be rather ancient?
  2. Is this a 64-bit build? I'm specifically wondering about the __cdecl that is in the error message. It should use __vectorcall.
  3. Do you know why ucrt is needed and not part of the standard environment? In my setup (and on AppVeyor) this isn't an issue.

@lsa-pilot
Copy link
Author

lsa-pilot commented Nov 3, 2016

Hi Matthias, responses below;
I also updated the original report with all options used for building example_polarcoord_avx.
thank you. Alex.

  1. Is the version number for MSVC correct? Mine says "MSVC 19.0.24215.1" so
    yours should be rather ancient? YOU ARE CORRECT, mine is also MSVC
    19.00.24215.1, original number was the Visual Studio version, I fixed the issue report.
  2. Is this a 64-bit build? I'm specifically wondering about the __cdecl
    that is in the error message. It should use __vectorcall.
    YES, I used cmake -G "Visual Studio 12 2013 Win64" to generate the solution, confirmed inside
    VS2015 (solution platform: x64).
  3. Do you know why ucrt is needed and not part of the standard environment?
    In my setup (and on AppVeyor) this isn't an issue. I don't know.

@mattkretz
Copy link
Member

For some reason I never saw an error on my builds. I'm pretty sure this is just an incompatible __cdecl vs. __vectorcall. Can you try adding "/Gv" to the compiler flags in the polarcoord examples?

@lsa-pilot
Copy link
Author

I switched the C++ calling convention option from __cdecl (/Gd) to __vectorcall (/Gv) for all polarcoord examples and the Vc project and got this link error below (similar to the previous reported error) for polarcoord_avx and polarcoord_default example projects. If I don't change Vc to use /Gv the polarcoord_sse does not link either, only polarcoord_scalar builds.
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol "public: static class Vc_1::Vector<float,struct Vc_1::VectorAbi::Avx> __vectorcall Vc_1::Common::Trigonometric<struct Vc_1::ImplementationT<6> >::atan2<class Vc_1::Vector<float,struct Vc_1::VectorAbi::Avx> >(class Vc_1::Vector<float,struct Vc_1::VectorAbi::Avx> const &,class Vc_1::Vector<float,struct Vc_1::VectorAbi::Avx> const &)" (??$atan2@V?$Vector@MUAvx@VectorAbi@Vc_1@@@Vc_1@@@?$Trigonometric@U?$ImplementationT@$05@Vc_1@@@common@Vc_1@@sq?AV?$Vector@MUAvx@VectorAbi@Vc_1@@@2@AEBV32@0@Z) referenced in function "class Vc_1::Vector<float,struct Vc_1::VectorAbi::Avx> __vectorcall Vc_1::atan2<float,struct Vc_1::VectorAbi::Avx>(class Vc_1::Vector<float,struct Vc_1::VectorAbi::Avx> const &,class Vc_1::Vector<float,struct Vc_1::VectorAbi::Avx> const &)" (??$atan2@MUAvx@VectorAbi@Vc_1@@@Vc_1@@yq?AV?$Vector@MUAvx@VectorAbi@Vc_1@@@0@AEBV10@0@Z) example_polarcoord_avx D:\work\SXall\Vc\build\examples\polarcoord\main.obj 1
Error LNK1120 1 unresolved externals example_polarcoord_avx D:\work\SXall\Vc\build\examples\polarcoord\Debug\example_polarcoord_avx.exe 1

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

No branches or pull requests

2 participants