Skip to content

Conversation

NancyLi1013
Copy link
Contributor

This port is a header-only library.
Related issue #8264.

@NancyLi1013
Copy link
Contributor Author

Failed on x86-windows due to this:

C:\vsts\_work\2\s\buildtrees\libdivide\src\v2.0-66dc5347d1\libdivide.h(1570) : fatal error C1001: An internal error has occurred in the compiler.
(compiler file 'd:\agent\_work\3\s\src\vctools\Compiler\Utc\src\p2\main.c', line 160)
 To work around this problem, try simplifying or changing the program near the locations listed above.
Please choose the Technical Support command on the Visual C++ 
 Help menu, or open the Technical Support help file for more information

INTERNAL COMPILER ERROR in 'C:\VS2017\Stable\VC\Tools\MSVC\14.22.27905\bin\Hostx64\x86\cl.exe'
    Please choose the Technical Support command on the Visual C++
    Help menu, or open the Technical Support help file for more information

Failed on x64-uwp due to this:

CMake Error: TRY_RUN() invoked in cross-compiling mode, please set the following cache variables appropriately:
   cpu_x86_EXITCODE (advanced)
   cpu_x86_EXITCODE__TRYRUN_OUTPUT (advanced)
For details see C:/vsts/_work/2/s/buildtrees/libdivide/x64-uwp-rel/TryRunResults.cmake
-- Performing Test cpu_x86 - Failed
-- Performing Test march_native
-- Performing Test march_native - Failed
-- Performing Test avx512
CMake Error: TRY_RUN() invoked in cross-compiling mode, please set the following cache variables appropriately:
   avx512_EXITCODE (advanced)
   avx512_EXITCODE__TRYRUN_OUTPUT (advanced)

Can someone help solve this issue or give any suggestions?
Thanks in advance.

@Rastaban
Copy link
Contributor

If you are able to reproduce the x86 issue then you should report it https://docs.microsoft.com/en-us/cpp/overview/how-to-report-a-problem-with-the-visual-cpp-toolset?view=vs-2019.

@Rastaban Rastaban self-assigned this Sep 24, 2019
@PhoebeHui
Copy link
Contributor

Thanks Phil for the review, I will help follow up.

@kimwalisch
Copy link

kimwalisch commented Oct 11, 2019

Hi,

I am the current maintainer of libdivide. I have now fixed the TRY_RUN() cross compilation error (at least it works for me when cross compiling using MinGW on x64).

The issue below however seems to be a x86 MSVC (32-bit) bug that is caused by libdivide's AVX2 code.

C:\vsts\_work\2\s\buildtrees\libdivide\src\v2.0-66dc5347d1\libdivide.h(1570) : fatal error C1001: An internal error has occurred in the compiler.
(compiler file 'd:\agent\_work\3\s\src\vctools\Compiler\Utc\src\p2\main.c', line 160)
 To work around this problem, try simplifying or changing the program near the locations listed above.
Please choose the Technical Support command on the Visual C++ 
 Help menu, or open the Technical Support help file for more information

INTERNAL COMPILER ERROR in 'C:\VS2017\Stable\VC\Tools\MSVC\14.22.27905\bin\Hostx64\x86\cl.exe'
    Please choose the Technical Support command on the Visual C++
    Help menu, or open the Technical Support help file for more information

Note that this bug does not render libdivide useless since vector instructions are disabled by default and the user has to explicitly define LIBDIVIDE_AVX2 in order to enable AVX2. The bug only shows up because libdivide's test programs are built with vector extensions enabled on x86 and x64.

Since I don't know how long it will take until this bug gets fixed in MSVC I have added an option to libdivide's CMake build system which allows to turn off CPU vector instructions for compiling the test programs. So the bug above can now be avoided using e.g.:

cmake .. -G "Visual Studio 15 2017" -DENABLE_VECTOR_EXTENSIONS=OFF
cmake --build . --config Release

I have also added find_package(libdivide) support to libdivide's CMakeLists.txt and made a bunch of other changes that should make it easier to package libdivide. I will do a new libdivide release once I get confirmation that the new CMake code works well with vcpkg.

@NancyLi1013
Copy link
Contributor Author

@kimwalisch thanks a lot for your detail description about this issue. We will update this port if you have a new release.
Thanks again.

@kimwalisch
Copy link

We will update this port if you have a new release.

I have now released libdivide-3.0 on GitHub. Fingers crossed that it will work well with vcpkg...

@NancyLi1013
Copy link
Contributor Author

@kimwalisch thanks for your instant update . I have updated libdivide to the latest release. It seems that these issues have been fixed now. Thank you very much for these efforts.

@NancyLi1013 NancyLi1013 marked this pull request as ready for review October 17, 2019 05:41
@grdowns
Copy link
Contributor

grdowns commented Oct 30, 2019

Thanks @NancyLi1013 for the port addition and thanks @kimwalisch for taking interest in helping us get libdivide in vcpkg!

@grdowns grdowns merged commit 34eff46 into microsoft:master Oct 30, 2019
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

Successfully merging this pull request may close these issues.

5 participants