Ben Swift via llvm-dev
2015-Sep-03 01:02 UTC
[llvm-dev] LLVM 3.7.0 build errors on Windows
I'm working on a cross-platform project which links (statically) against LLVM, which I use for MCJIT purposes. Everything was fine on 3.4.2. I'm just experimenting with upgrading to 3.7.0, and everything works fine on OSX & Linux once I changed my project to reflect the API updates. On Windows, I get a bunch of compile errors - hundreds of them, but variations on a couple of different themes, such as Error C3805 '(': unexpected token, expected either '}' or a ',' llvm\Support\COFF.h 168 Error C3646 'Checksum': unknown override specifier llvm\Object\COFF.h 50 Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int llvm\Object\COFF.h 52 All the errors are reported in LLVM header files, mostly llvm/Support/COFF.h and llvm/Object/COFF.h I'm using Visual Studio Community 2015, the CXX compiler identification is MSVC 19.0.23026.0 My CPP includes are: WIN32 _WINDOWS NDEBUG _CRT_SECURE_NO_DEPRECATE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_DEPRECATE _CRT_NONSTDC_NO_WARNINGS _SCL_SECURE_NO_DEPRECATE _SCL_SECURE_NO_WARNINGS __STDC_CONSTANT_MACROS __STDC_FORMAT_MACROS __STDC_LIMIT_MACROS _GNU_SOURCE %(PreprocessorDefinitions) Now, a couple of things are suspicious: - in googling around it seems like there are some problems with including Windows.h (which I have to include for other reasons) as well as the LLVM headers, at least with previous versions of LLVM. - on OSX, I did have to add a -std=c++11 flag before it would compile. But I thought I didn't need/couldn't do that on Windows? Does anyone have any idea what might be the problem, or ideas for solutions/workarounds? Cheers Ben
Renato Golin via llvm-dev
2015-Sep-03 08:15 UTC
[llvm-dev] LLVM 3.7.0 build errors on Windows
On 3 September 2015 at 02:02, Ben Swift via llvm-dev <llvm-dev at lists.llvm.org> wrote:> Does anyone have any idea what might be the problem, or ideas for > solutions/workarounds?Hi Ben, We have moved up the minimum version of most compilers, but AFAIK, MSVC 2015 is supported. Maybe you do need -std=c++11 after all. Have you tried that? cheers, --renato
Russell Wallace via llvm-dev
2015-Sep-03 08:28 UTC
[llvm-dev] LLVM 3.7.0 build errors on Windows
I have the same setup as you, and it's working fine, but I think that's because I have #include <windows.h> after the llvm headers. I tried moving it before them just now and I get the same error messages as you. I also took a look at C:\llvm\tools\clang\lib\Driver\MSVCToolChain.cpp and it likewise puts the windows header after the llvm headers. Can you move it to after? On Thu, Sep 3, 2015 at 2:02 AM, Ben Swift via llvm-dev < llvm-dev at lists.llvm.org> wrote:> I'm working on a cross-platform project which links (statically) against > LLVM, which I use for MCJIT purposes. > > Everything was fine on 3.4.2. I'm just experimenting with upgrading to > 3.7.0, and everything works fine on OSX & Linux once I changed my > project to reflect the API updates. > > On Windows, I get a bunch of compile errors - hundreds of them, but > variations on a couple of different themes, such as > > Error C3805 '(': unexpected token, expected either '}' or a ',' > llvm\Support\COFF.h 168 > Error C3646 'Checksum': unknown override specifier > llvm\Object\COFF.h 50 > Error C4430 missing type specifier - int assumed. Note: C++ does not > support default-int llvm\Object\COFF.h 52 > > All the errors are reported in LLVM header files, mostly > llvm/Support/COFF.h and llvm/Object/COFF.h > > I'm using Visual Studio Community 2015, the CXX compiler identification > is MSVC 19.0.23026.0 > > My CPP includes are: > > WIN32 > _WINDOWS > NDEBUG > _CRT_SECURE_NO_DEPRECATE > _CRT_SECURE_NO_WARNINGS > _CRT_NONSTDC_NO_DEPRECATE > _CRT_NONSTDC_NO_WARNINGS > _SCL_SECURE_NO_DEPRECATE > _SCL_SECURE_NO_WARNINGS > __STDC_CONSTANT_MACROS > __STDC_FORMAT_MACROS > __STDC_LIMIT_MACROS > _GNU_SOURCE > %(PreprocessorDefinitions) > > Now, a couple of things are suspicious: > > - in googling around it seems like there are some problems with > including Windows.h (which I have to include for other reasons) as well > as the LLVM headers, at least with previous versions of LLVM. > - on OSX, I did have to add a -std=c++11 flag before it would compile. > But I thought I didn't need/couldn't do that on Windows? > > Does anyone have any idea what might be the problem, or ideas for > solutions/workarounds? > > Cheers > Ben > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150903/3b9828ec/attachment.html>
Nico Rieck via llvm-dev
2015-Sep-03 10:57 UTC
[llvm-dev] LLVM 3.7.0 build errors on Windows
On 03.09.2015 10:28, Russell Wallace via llvm-dev wrote:> I have the same setup as you, and it's working fine, but I think that's > because I have #include <windows.h> after the llvm headers. I tried moving > it before them just now and I get the same error messages as you. I also > took a look at C:\llvm\tools\clang\lib\Driver\MSVCToolChain.cpp and it > likewise puts the windows header after the llvm headers. Can you move it to > after?Support/COFF.h is incompatible with winnt.h because the former defines the IMAGE_* constants as enums while the latter uses macros. If you cannot avoid including both headers in the same TU you have to undef those macros. -Nico
Reid Kleckner via llvm-dev
2015-Sep-03 16:45 UTC
[llvm-dev] LLVM 3.7.0 build errors on Windows
The conflict between COFF.h and windows.h is pretty unfortunate. I think the root cause of your problem is that COFF.h gets included transitively by MCSectionCOFF.h, but that header doesn't actually need COFF.h. I sunk COFF.h down into the .cpp files out of MCSectionCOFF.h, so now you shouldn't get these build errors at head. On Wed, Sep 2, 2015 at 6:02 PM, Ben Swift via llvm-dev < llvm-dev at lists.llvm.org> wrote:> I'm working on a cross-platform project which links (statically) against > LLVM, which I use for MCJIT purposes. > > Everything was fine on 3.4.2. I'm just experimenting with upgrading to > 3.7.0, and everything works fine on OSX & Linux once I changed my > project to reflect the API updates. > > On Windows, I get a bunch of compile errors - hundreds of them, but > variations on a couple of different themes, such as > > Error C3805 '(': unexpected token, expected either '}' or a ',' > llvm\Support\COFF.h 168 > Error C3646 'Checksum': unknown override specifier > llvm\Object\COFF.h 50 > Error C4430 missing type specifier - int assumed. Note: C++ does not > support default-int llvm\Object\COFF.h 52 > > All the errors are reported in LLVM header files, mostly > llvm/Support/COFF.h and llvm/Object/COFF.h > > I'm using Visual Studio Community 2015, the CXX compiler identification > is MSVC 19.0.23026.0 > > My CPP includes are: > > WIN32 > _WINDOWS > NDEBUG > _CRT_SECURE_NO_DEPRECATE > _CRT_SECURE_NO_WARNINGS > _CRT_NONSTDC_NO_DEPRECATE > _CRT_NONSTDC_NO_WARNINGS > _SCL_SECURE_NO_DEPRECATE > _SCL_SECURE_NO_WARNINGS > __STDC_CONSTANT_MACROS > __STDC_FORMAT_MACROS > __STDC_LIMIT_MACROS > _GNU_SOURCE > %(PreprocessorDefinitions) > > Now, a couple of things are suspicious: > > - in googling around it seems like there are some problems with > including Windows.h (which I have to include for other reasons) as well > as the LLVM headers, at least with previous versions of LLVM. > - on OSX, I did have to add a -std=c++11 flag before it would compile. > But I thought I didn't need/couldn't do that on Windows? > > Does anyone have any idea what might be the problem, or ideas for > solutions/workarounds? > > Cheers > Ben > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150903/5f5be575/attachment.html>