Windows 10 MSVC compile

Discuss issues related to installing or building
ctrain79
Posts: 9
Joined: Sun May 09 2021 9:34 pm

Windows 10 MSVC compile

Post by ctrain79 »

My system is Windows 10, 20H2 build 19042.928, and I am using MSVC.

I'm trying to follow all of the documentation, but I get the following error:

Code: Select all

[345/3846] Building CXX object src\core\CMakeFiles\CsCore.dir\tools\qbytearray.cpp.obj
FAILED: src/core/CMakeFiles/CsCore.dir/tools/qbytearray.cpp.obj
C:\PROGRA~2\MICROS~3\2019\BUILDT~1\VC\Tools\MSVC\14.28.29333\bin\Hostx86\x86\cl.exe  /nologo /TP @src\core\CMakeFiles\CsCore.dir\tools\qbytearray.cpp.obj.rsp /showIncludes /Fosrc\core\CMakeFiles\CsCore.dir\tools\qbytearray.cpp.obj /Fdsrc\core\CMakeFiles\CsCore.dir\ /FS -c ..\src\core\tools\qbytearray.cpp
..\src\core\tools\qbytearray.cpp(32): fatal error C1083: Cannot open include file: 'zlib.h': No such file or directory
[358/3846] Building CXX object src\core\CMakeFiles\CsCore.dir\tools\qharfbuzz_core.cpp.obj
ninja: build stopped: subcommand failed.
The output of my configuration:

Code: Select all


D:\Projects\Vendor\copperspice>cmake -H. -Bbuilds -G Ninja -DCMAKE_CONFIGURATION_TYPES="Release" -DCMAKE_INSTALL_PREFIX=..\lib
-- The C compiler identification is MSVC 19.28.29337.0
-- The CXX compiler identification is MSVC 19.28.29337.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.28.29333/bin/Hostx86/x86/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.28.29333/bin/Hostx86/x86/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The ASM_MASM compiler identification is MSVC
-- Found assembler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.28.29333/bin/Hostx86/x86/ml.exe
-- Looking for dlfcn.h
-- Looking for dlfcn.h - not found
-- Looking for dirent.h
-- Looking for dirent.h - not found
-- Looking for features.h
-- Looking for features.h - not found
-- Looking for fcntl.h
-- Looking for fcntl.h - found
-- Looking for grp.h
-- Looking for grp.h - not found
-- Looking for inttypes.h
-- Looking for inttypes.h - found
-- Looking for libpq-fe.h
-- Looking for libpq-fe.h - not found
-- Looking for memory.h
-- Looking for memory.h - found
-- Looking for pg_config.h
-- Looking for pg_config.h - not found
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Looking for pthread_np.h
-- Looking for pthread_np.h - not found
-- Looking for pwd.h
-- Looking for pwd.h - not found
-- Looking for signal.h
-- Looking for signal.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stdlib.h
-- Looking for stdlib.h - found
-- Looking for strings.h
-- Looking for strings.h - not found
-- Looking for string.h
-- Looking for string.h - found
-- Looking for unistd.h
-- Looking for unistd.h - not found
-- Looking for cups/cups.h
-- Looking for cups/cups.h - not found
-- Looking for mysql/mysql.h
-- Looking for mysql/mysql.h - not found
-- Looking for net/if.h
-- Looking for net/if.h - not found
-- Looking for netinet/in.h
-- Looking for netinet/in.h - not found
-- Looking for sys/eventfd.h
-- Looking for sys/eventfd.h - not found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for sys/ioctl.h
-- Looking for sys/ioctl.h - not found
-- Looking for sys/ipc.h
-- Looking for sys/ipc.h - not found
-- Looking for sys/time.h
-- Looking for sys/time.h - not found
-- Looking for sys/shm.h
-- Looking for sys/shm.h - not found
-- Looking for sys/socket.h
-- Looking for sys/socket.h - not found
-- Looking for sys/stat.h
-- Looking for sys/stat.h - found
-- Looking for sys/wait.h
-- Looking for sys/wait.h - not found
-- Looking for sys/param.h
-- Looking for sys/param.h - not found
-- Looking for 8 include files dlfcn.h, ..., float.h
-- Looking for 8 include files dlfcn.h, ..., float.h - not found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of size_t
-- Check size of size_t - done
-- Checking for 64-bit off_t
-- Performing Test FILE64_OK
-- Performing Test FILE64_OK - Failed
-- Checking for 64-bit off_t - not present
-- Checking for fseeko/ftello
-- Performing Test FSEEKO_COMPILE_OK
-- Performing Test FSEEKO_COMPILE_OK - Failed
-- Checking for fseeko/ftello - not found
-- Large File support - not found

Configuring CMake for CopperSpice


Searching for required packages

-- Found OpenSSL: D:/Program Files/PostgreSQL/10/lib/libcrypto.lib (found suitable version "1.1.1g", minimum required is "1.0")
-- libjpeg was not found, bundled library will be used

CMake Warning at CMakeLists.txt:303 (message):


CMake Warning at CMakeLists.txt:304 (message):
  ------------------------------------------------------------


CMake Warning at CMakeLists.txt:305 (message):
  WARNING WARNING WARNING


CMake Warning at CMakeLists.txt:306 (message):
  The 'D:/Program Files/PostgreSQL/10/include' directory contains a file
  called pthread.h


CMake Warning at CMakeLists.txt:307 (message):


CMake Warning at CMakeLists.txt:308 (message):
  A conflict exists between pthread.h and the standard library


CMake Warning at CMakeLists.txt:309 (message):
  Rename or remove pthread.h in order to build the CsSqlPsql plugin


CMake Warning at CMakeLists.txt:310 (message):
  ------------------------------------------------------------


CMake Warning at CMakeLists.txt:311 (message):


-- PostgreSQL client library was found, plugin will not be built
--
-- MySQL was not found, CopperSpice plugin will not be built

-- looking in folder D:/Projects/Vendor/copperspice


-- The following CopperSpice libraries will be built:

 * Core Gui Multimedia Network OpenGL Script Sql Svg WebKit Xml XmlPatterns

-- The following packages have been found:

 * OpenSSL (required version >= 1.0), Support for SSL and TLS, <https://openssl.org>
   Required for HTTPS support


CopperSpice configured to run on:  Windows 32 bit, Debug Mode
CopperSpice will be built in:      D:/Projects/Vendor/copperspice/builds
CopperSpice will be installed in:  D:/Projects/Vendor/lib


-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_CONFIGURATION_TYPES


-- Build files have been written to: D:/Projects/Vendor/copperspice/builds
I am very much looking forward to working with CopperSpice once I can get it working :D

barbara
Posts: 272
Joined: Sat Apr 04 2015 2:32 am

Re: Windows 10 MSVC compile

Post by barbara »

Thanks so much for your interest in CopperSpice. We will do our best to help you get started.
CopperSpice configured to run on: Windows 32 bit, Debug Mode
(1) We noticed you are building a 32 bit binary, was this intended?

(2) You are also building in Debug Mode and it looks like you wanted Release Mode since your CMake command says "-DCMAKE_CONFIGURATION_TYPES="Release". Please note that CopperSpice uses "-DCMAKE_BUILD_TYPE" as per the following docs.

https://www.copperspice.com/docs/cs_overview/build-options.html

(3) Also, curious why you passed -H on the CMake command line.

(4) Can you verify you have the "zlib.h" located in src/3rdparty/zlib.

Barbara

ctrain79
Posts: 9
Joined: Sun May 09 2021 9:34 pm

Re: Windows 10 MSVC compile

Post by ctrain79 »

Ah, I did not realize that VS terminals had different environment (having other shortcuts on my desktop set up), one for WIN32 and one for x64. Not sure what difference native tools vs cross tools would mean. I'm planning on using CopperSpice for desktop dev, so I'm guessing native tools.

The "-H." option is undocumented CMake, and I've seen on other forums people refer to the source code:

Code: Select all

if(arg.find("-H",0) == 0) {
  directoriesSet = true;
  std::string path = arg.substr(2);
  path = cmSystemTools::CollapseFullPath(path);
  cmSystemTools::ConvertToUnixSlashes(path);
  this->SetHomeDirectory(path);
I kind of like the more explicit way of specifying the source directory this way and not worrying about Windows vs UNIX path directory separators.

I tried recompiling using x64 and changed to "-DCMAKE_BUILD_TYPE=Release", but I still get the same zlib.h missing error, even though it does exist in the project hierarchy where you specified.

Thank you for getting back to me so quickly! I'm curious what could make my system and CMake setup unable to find zlib. Please let me know what info you might need to solve my mystery.

barbara
Posts: 272
Joined: Sat Apr 04 2015 2:32 am

Re: Windows 10 MSVC compile

Post by barbara »

Odd question, do you have zlib installed on your system. This is not a typical set up for MSVC users.

Can you check your CMakeCache.txt file in the build directory and look for lines starting with ZLIB. See if ZLIB_INCLUDE_DIR is set to some path on your system.

Barbara

ctrain79
Posts: 9
Joined: Sun May 09 2021 9:34 pm

Re: Windows 10 MSVC compile

Post by ctrain79 »

I guess this issue has something to do with my PostgreSQL installation:

Code: Select all

ZLIB_INCLUDE_DIR:PATH=D:/Program Files/PostgreSQL/10/include
I'm still learning more of CMake, and my next stepping stone is to learn how to install packages. How would you recommend I configure CMake for the version of zlib internal to CopperSpice?

barbara
Posts: 272
Joined: Sat Apr 04 2015 2:32 am

Re: Windows 10 MSVC compile

Post by barbara »

This is very interesting and we have some ideas. Thank you for being patient while we work this out.

Just for reference, I am a Windows developer and I use PostgreSQL 10. The only difference is that I compile with MinGW and not MSVC. I have not experienced this problem and it sounds like we may need to adjust some of our build files.

1) What version of CMake are you using?

2) To instruct CMake not to use an external version of zlib use the following option on your CMake command line.

-DCMAKE_DISABLE_FIND_PACKAGE_ZLIB=TRUE

Barbara

ctrain79
Posts: 9
Joined: Sun May 09 2021 9:34 pm

Re: Windows 10 MSVC compile

Post by ctrain79 »

I am using CMake version 3.19.

I had to use PostgreSQL 10 because the lab computers at one of the universities I was teaching databases at had that version installed. I've been enjoying your descriptions of your work on YouTube, and the compile-time counter design is so interesting! It reminds me of similarities to the functionality of C#'s yield keyword, and what a wild way to automate a code design in C++.

My compile was able to get past the zlib issue, but MSVC is complaining that there is not enough heap space during ninja command. It gets to about [919/3862] done and then has the following error.

Code: Select all

FAILED: src/gui/CMakeFiles/CsGui.dir/accessible/qaccessiblewidget_views.cpp.obj
C:\PROGRA~2\MICROS~3\2019\Community\VC\Tools\MSVC\14.28.29910\bin\Hostx64\x64\cl.exe  /nologo /TP @src\gui\CMakeFiles\CsGui.dir\accessible\qaccessiblewidget_views.cpp.obj.rsp /showIncludes /Fosrc\gui\CMakeFiles\CsGui.dir\accessible\qaccessiblewidget_views.cpp.obj /Fdsrc\gui\CMakeFiles\CsGui.dir\ /FS -c ..\src\gui\accessible\qaccessiblewidget_views.cpp
..\src\gui\widgetbase\qwidget.h(118): fatal error C1060: compiler is out of heap space
[920/3862] Building CXX object src\gui\CMakeFiles\CsGui.dir\accessible\qaccessiblewidget_simple.cpp.obj
FAILED: src/gui/CMakeFiles/CsGui.dir/accessible/qaccessiblewidget_simple.cpp.obj
C:\PROGRA~2\MICROS~3\2019\Community\VC\Tools\MSVC\14.28.29910\bin\Hostx64\x64\cl.exe  /nologo /TP @src\gui\CMakeFiles\CsGui.dir\accessible\qaccessiblewidget_simple.cpp.obj.rsp /showIncludes /Fosrc\gui\CMakeFiles\CsGui.dir\accessible\qaccessiblewidget_simple.cpp.obj /Fdsrc\gui\CMakeFiles\CsGui.dir\ /FS -c ..\src\gui\accessible\qaccessiblewidget_simple.cpp
include\QtCore\csmeta_internal_1.h(230): fatal error C1060: compiler is out of heap space
After that, there is a bunch of "inconsistent dll linkage" messages.

I don't mind going through the compiling to learn more about CMake and open source volunteering. Thank you for your help :D

ctrain79
Posts: 9
Joined: Sun May 09 2021 9:34 pm

Re: Windows 10 MSVC compile

Post by ctrain79 »

I think I got around the heap out of memory with -j option for ninja to run more concurrent jobs, but not quite sure. I tried ninja again and the compile continued on until more errors. It looks like there are more issues with me using PostgreSQL 10?

Code: Select all

D:\Program Files\PostgreSQL\10\include\Event.h(44): fatal error C1083: Cannot open include file: 'event2/event-config.h': No such file or directory

barbara
Posts: 272
Joined: Sat Apr 04 2015 2:32 am

Re: Windows 10 MSVC compile

Post by barbara »

Thanks for answering our questions, it makes support so much easier.
fatal error C1060: compiler is out of heap space
(1) How much memory do you have on this computer? Are you building CopperSpice in release mode now?
-- PostgreSQL client library was found, plugin will not be built
(2) In terms of PostgreSQL we use version 10 internally and have not seen this issue. In your original post the output indicated the plugin would not be built. So this is odd.

Did you happen to rename the pthread.h file to resolve the conflict as indicated in our CMake warning?

Barbara

ctrain79
Posts: 9
Joined: Sun May 09 2021 9:34 pm

Re: Windows 10 MSVC compile

Post by ctrain79 »

How will renaming pthread.h affect PostgreSQL? What did you rename your pthread.h in your PostgreSQL 10 installation to?

I tried to find a way to turn off building the optional Sql as a way to possibly resolve the pthread.h issue, but I do not see any CMake options in the CopperSpice documentation to do that.

I have been trying to compile for Release mode. I have 16GB, but note that Microsoft documentation explains the MSVC compiler has 1MB heap limit by default:

https://docs.microsoft.com/en-us/cpp/build/reference/heap-set-heap-size?view=msvc-160

Post Reply