Page 2 of 2

Re: Windows 10 MSVC compile

Posted: Tue May 11 2021 6:49 pm
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

Re: Windows 10 MSVC compile

Posted: Tue May 11 2021 9:39 pm
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

Re: Windows 10 MSVC compile

Posted: Wed May 12 2021 1:03 am
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!

Re: Windows 10 MSVC compile

Posted: Wed May 12 2021 7:59 am
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

Re: Windows 10 MSVC compile

Posted: Wed May 12 2021 6:41 pm
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