WolframResearch / codeparser

Parse Wolfram Language source code as abstract syntax trees (ASTs) or concrete syntax trees (CSTs)
MIT License
122 stars 14 forks source link

cmake build on Windows is failing #12

Closed arnoudbuzing closed 4 years ago

arnoudbuzing commented 4 years ago

I don't speak cmake very well, but I think this is supposed to work for me on Windows (I have VS 2019 installed):

PS C:\Users\Arnoud\Documents\GitHub\codeparser\build> cmake ..
-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.18363.
-- The C compiler identification is MSVC 19.21.27702.2
-- The CXX compiler identification is MSVC 19.21.27702.2
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.21.27702/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.21.27702/bin/Hostx64/x64/cl.exe - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.21.27702/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.21.27702/bin/Hostx64/x64/cl.exe - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- PACLET: CodeParser
-- WOLFRAMKERNEL: C:/Program;Files/Wolfram;Research/Mathematica/12.0/wolfram.exe
-- BUILD_DOCS: OFF
-- BUILD_EXE: OFF
-- BUILD_EXPR_LIB: ON
-- USE_MATHLINK: ON
-- NISSUES: OFF
-- NABORT: OFF
-- LOCAL_BUILD: OFF
-- VERSION_NUMBER: 1200
-- SYSTEMID: Windows-x86-64
-- PACLET_VERSION: 1.1
-- VERSION_NUMBER is below 1210; disabling BUILD_EXPR_LIB
-- WOLFRAMLIBRARY_INCLUDE_DIR: C:/Program;Files/Wolfram;Research/Mathematica/12.0/SystemFiles/IncludeFiles/C
-- MATHLINK_INCLUDE_DIR: C:/Program;Files/Wolfram;Research/Mathematica/12.0/SystemFiles/Links/MathLink/DeveloperKit/Windows-x86-64/CompilerAdditions
-- MATHLINK_LIB_DIR: C:/Program;Files/Wolfram;Research/Mathematica/12.0/SystemFiles/Links/MathLink/DeveloperKit/Windows-x86-64/CompilerAdditions
-- MATHLINK_LIB: MATHLINK_LIB-NOTFOUND
-- Configuring done
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
MATHLINK_LIB
    linked by target "codeparser-lib" in directory C:/Users/Arnoud/Documents/GitHub/codeparser

-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.
PS C:\Users\Arnoud\Documents\GitHub\codeparser\build>
szhorvat commented 4 years ago

I'll just note that cmake also fails on macOS if the path to the installation directory has spaces in it. I usually use /Applications/Mathematica 12.1.app, with a space. But it fails in a different way: it hangs after -- VERSION_NUMBER: 1200.

jfultz commented 4 years ago

Another related problem...for earlier versions of Visual Studio, cmake defaults to the 32-bit compiler (which is terribly annoying). But build system here assumes a 64-bit target because it points directly to the Windows-x86-64 libraries in the layout.

I think it would be fine to simply not support 32-bit Windows. But it would be a nice courtesy to inform people that Windows 32-bit tooling isn't supported through error messaging rather than setting up a linker error which may be quite mysterious to some.

bostick commented 4 years ago

@szhorvat can you please give the exact command-line that causes the hang?

bostick commented 4 years ago

And @szhorvat , did you mean to say /Applications/Mathematica 12.1.app is reporting -- VERSION_NUMBER: 1200, or was that a typo? Is the hang 100% reproducible?

szhorvat commented 4 years ago

@bostick Sorry, it seems I was wrong. The hand happens with certain M versions only. With 11.1.1, I see a hang at this point, and Ctrl-C won't kill it:

~/R/codeparser (master↓13|…) $ mkdir build
~/R/codeparser (master↓13|…) $ cd build/
~/R/c/build (master↓13|✔) $ ls
~/R/c/build (master↓13|✔) $ cmake -DMATHEMATICA_INSTALL_DIR=/Applications/Mathematica\ 11.1.app/Contents/ ..
-- The C compiler identification is AppleClang 11.0.0.11000033
-- The CXX compiler identification is AppleClang 11.0.0.11000033
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- PACLET: CodeParser
-- WOLFRAMKERNEL: /Applications/Mathematica 11.1.app/Contents/MacOS/WolframKernel
-- BUILD_DOCS: OFF
-- BUILD_EXE: OFF
-- BUILD_EXPR_LIB: ON
-- USE_MATHLINK: ON
-- NISSUES: OFF
-- NABORT: OFF
-- LOCAL_BUILD: OFF
-- VERSION_NUMBER: 1111

With 11.3.0, I see a hang here:

cmake -DMATHEMATICA_INSTALL_DIR=/Applications/Mathematica\ 11.3.app/Contents/ ..
-- The C compiler identification is AppleClang 11.0.0.11000033
-- The CXX compiler identification is AppleClang 11.0.0.11000033
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- PACLET: CodeParser
-- WOLFRAMKERNEL: /Applications/Mathematica 11.3.app/Contents/MacOS/WolframKernel
-- BUILD_DOCS: OFF
-- BUILD_EXE: OFF
-- BUILD_EXPR_LIB: ON
-- USE_MATHLINK: ON
-- NISSUES: OFF
-- NABORT: OFF
-- LOCAL_BUILD: OFF

12.1.0 and 12.0.0 worked without problems.

bostick commented 4 years ago

@szhorvat Good! (well, hang is not good). It's good to line up with what I was expecting.

The hang you are seeing was a MathLink bug that was fixed in 12.0. (not that it helps, but the "hang" actually only lasts 30 minutes, but for all intents and purposes, yes, it is a hang)

I still want to put in a nice message about 32-bit-expectation vs. 64-bit-expectation on Windows, so not closing yet.

If we want to discuss more non-Windows related things, we can open another issue.

bostick commented 4 years ago

Also, to be clear, I will be putting in a work-around for hang that is seen

arnoudbuzing commented 4 years ago

If we can keep this issue for just the cmake issue I reported on Windows, that would be good (and not make it a catch-all for any cmake issue in this repo).

bostick commented 4 years ago

I've added pauses to work-around the hang that @szhorvat has seen, and also add a nice fatal error message if CMake is running as 32-bit build and Mathematica is running as 64-bit:

CMake is reporting 32-bit; Mathematica is reporting: 64