Windows 10 MSVC compile

Discuss issues related to installing or building
barbara
Posts: 272
Joined: Sat Apr 04 2015 2:32 am

Re: Windows 10 MSVC compile

Post by barbara »

How will renaming pthread.h affect PostgreSQL?
Building on Windows we found a conflict between the pthread.h file in PostgreSQL and the pthread.h in the C++ standard library. This showed up as a runtime issue and the best solution has so far been to rename the file in PostgreSQL so it is not found. This showed up when compiling with MinGW and may not be an issue with MSVC.
What did you rename your pthread.h in your PostgreSQL 10 installation to?
I renamed the include/pthread.h to include/pthread_hold.h so the file is no longer found when building.

Barbara

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

Re: Windows 10 MSVC compile

Post by ctrain79 »

I do not think there are any more issues with PostgreSQL pthread.h.

I get the following error now, though:

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
Compiling has been taking quite a bit of RAM (10 GB was not enough). That is interesting for me to find out. I've compiled large game engine projects that did not run out of memory this way, and I imagine it must be the way ninja is designed to try to be as fast at compiling as possible. It did not seem as if ninja was by default using 2 threads when no options were provided, as there were around 13 instances of it compiling. I wonder if MSVC and ninja just aren't meant to be used together. Could it be because MSVC by default uses four threads?
By default, cl.exe uses four threads, as if /cgthreads4 were specified.
https://docs.microsoft.com/en-us/cpp/build/reference/cgthreads-code-generation-threads?view=msvc-160

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

Re: Windows 10 MSVC compile

Post by ctrain79 »

So I found another discussion on MSVC and Ninja that had an option I was not aware of for CMake. I was able to successfully compile with the following command:

Code: Select all

cmake -Bbuilds -G Ninja -DCMAKE_BUILD_TYPE="Release" -DCMAKE_INSTALL_PREFIX=..\lib -DCMAKE_DISABLE_FIND_PACKAGE_ZLIB=TRUE -DCMAKE_IGNORE_PATH="D:\Program Files\PostgreSQL\10\include" .
I do not really need the PostgreSQL part of the project for now, but it would be nice to know what was causing the issues with the other header it was complaining about.

Thank you for helping me along the way, Barbara!

janwilmans
Posts: 15
Joined: Wed Oct 16 2019 9:33 pm
Contact:

Re: Windows 10 MSVC compile

Post by janwilmans »

Just a few remarks:

- building CS with 16GB of RAM on windows is barely enough, for me it cause very long build times, and I sometimes had to re-start compilation when the compiler ran out of heap-space. I think as rule of thumb 16GB is enough on Linux builds and 32GB is enough for MSVC builds. I have no numbers for Mingw on windows, but I expect that 16GB will work there too.

- the /HEAP option is applicable during compilation, this is a linker option that affects the executable it _creates (the thing you are building) and does not affect the heap space available to the compiler.

Great that you found a solution that works for you!
Let us now if you have any more questions.

Cheers,

Jan

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

Re: Windows 10 MSVC compile

Post by barbara »

We are looking into your PostgreSQL issue and have not been able to repeat it as of yet. Another CS team member is doing some testing.

Glad you found a work around for right now.

Barbara

Post Reply