How to compile latest version on windows 10

Discussion of development and patch submission.
Post Reply
slipstream2021
Posts: 2
Joined: Fri 24 Dec, 2021 6:20 am

How to compile latest version on windows 10

Post by slipstream2021 »

HI all, Unsure as to how to compile this latest version or what environment needs to be set up, instructions are included for Linux & BSD but for nothing else.
I used to use in a mingw32 environment and pacman to get the prerequisites.
$ autoreconf -i
$ ./configure --enable-networking --enable-release-build
$ mingw32-make -j4

How should it be done now?
shermanp
Posts: 175
Joined: Sat 18 Feb, 2017 2:09 am

Re: How to compile latest version on windows 10

Post by shermanp »

See Here. Also see my additional notes.

For networking, you'll need to add mingw-w64-{i686,x86_64}-libpcap to the list of packages to install.

To build with the ninja backend (MSYS2 recommendation), you will need mingw-w64-{i686,x86_64}-ninja, and add -DMSYS=TRUE to the cmake command line. Eg:

Code: Select all

cmake -G Ninja -DMSYS=TRUE -DUSE_NETWORKING=ON -DCMAKE_BUILD_TYPE=Release ..
User avatar
ruben_balea
Posts: 180
Joined: Mon 08 May, 2017 11:24 pm
Location: Spain

Re: How to compile latest version on windows 10

Post by ruben_balea »

Thank you very much for the guide, I was quite lost trying to find the correct commands...

The only downside after compiling PCem is running it just to find how it complains about a lot of missing libraries ;-) so I have written all the necessary ones for a release build with networking in a single command, one for MinGW 32 and another for for MinGW 64, I guess those will be the same for everybody, if not or if there's a better way to do that please correct me.

After make (or ninja) finishes building pcem paste one of the following commands to copy the required DLL files to the same directory as pcem.exe

Use this command under MSYS2 MinGW 32:

Code: Select all

cd output && cd bin && cp /mingw32/bin/libLerc.dll ./ && cp /mingw32/bin/libdeflate.dll ./ && cp /mingw32/bin/libexpat-1.dll ./ && cp /mingw32/bin/libgcc_s_dw2-1.dll ./ && cp /mingw32/bin/libjbig-0.dll ./ && cp /mingw32/bin/libjpeg-8.dll ./ && cp /mingw32/bin/liblzma-5.dll ./ && cp /mingw32/bin/libopenal-1.dll ./ && cp /mingw32/bin/libpng16-16.dll ./ && cp /mingw32/bin/libstdc++-6.dll ./ && cp /mingw32/bin/libtiff-5.dll ./ && cp /mingw32/bin/libwebp-7.dll ./ && cp /mingw32/bin/libwinpthread-1.dll ./ && cp /mingw32/bin/libzstd.dll ./ && cp /mingw32/bin/sdl2.dll ./ && cp /mingw32/bin/wxbase30u_gcc_custom.dll ./ && cp /mingw32/bin/wxbase30u_xml_gcc_custom.dll ./ && cp /mingw32/bin/wxmsw30u_adv_gcc_custom.dll ./ && cp /mingw32/bin/wxmsw30u_core_gcc_custom.dll ./ && cp /mingw32/bin/wxmsw30u_html_gcc_custom.dll ./ && cp /mingw32/bin/wxmsw30u_xrc_gcc_custom.dll ./ && cp /mingw32/bin/zlib1.dll ./ && cd .. && cd ..
Use this command under MSYS2 MinGW 64:

Code: Select all

cd output && cd bin && cp /mingw64/bin/libLerc.dll ./ && cp /mingw64/bin/libdeflate.dll ./ && cp /mingw64/bin/libexpat-1.dll ./ && cp /mingw64/bin/libgcc_s_seh-1.dll ./&& cp /mingw64/bin/libjbig-0.dll ./ && cp /mingw64/bin/libjpeg-8.dll ./ && cp /mingw64/bin/liblzma-5.dll ./ && cp /mingw64/bin/libopenal-1.dll ./ && cp /mingw64/bin/libpng16-16.dll ./ && cp /mingw64/bin/libstdc++-6.dll ./ && cp /mingw64/bin/libtiff-5.dll ./ && cp /mingw64/bin/libwebp-7.dll ./ && cp /mingw64/bin/libwinpthread-1.dll ./ && cp /mingw64/bin/libzstd.dll ./ && cp /mingw64/bin/sdl2.dll ./ && cp /mingw64/bin/wxbase30u_gcc_custom.dll ./ && cp /mingw64/bin/wxbase30u_xml_gcc_custom.dll ./ && cp /mingw64/bin/wxmsw30u_adv_gcc_custom.dll ./ && cp /mingw64/bin/wxmsw30u_core_gcc_custom.dll ./ && cp /mingw64/bin/wxmsw30u_html_gcc_custom.dll ./ && cp /mingw64/bin/wxmsw30u_xrc_gcc_custom.dll ./ && cp /mingw64/bin/zlib1.dll ./ && cd .. && cd ..
:arrow: To paste text in the MSYS2 console you can press Shift+Insert or right click on the window and select paste from the menu, then press Enter to run the pasted command.
User avatar
MichaelJManley
Posts: 38
Joined: Fri 17 Dec, 2021 9:42 pm

Re: How to compile latest version on windows 10

Post by MichaelJManley »

ruben_balea wrote: Sun 26 Dec, 2021 8:20 pm The only downside after compiling PCem is running it just to find how it complains about a lot of missing libraries ;-)
I am going to add the dll list to the article. Being that Linux is my primary os I tend to forget about Windows nuances! Lol.
shermanp
Posts: 175
Joined: Sat 18 Feb, 2017 2:09 am

Re: How to compile latest version on windows 10

Post by shermanp »

Note, you can use ntldd to automate the DLL copying.

See here for how I've done it in dosbox-staging. This could be adapted for PCem.
slipstream2021
Posts: 2
Joined: Fri 24 Dec, 2021 6:20 am

Re: How to compile latest version on windows 10

Post by slipstream2021 »

Thanks so much for the guide worked like a charm :)
edilson
Posts: 4
Joined: Wed 19 May, 2021 1:11 pm

Re: How to compile latest version on windows 10

Post by edilson »

I just downloaded again the code from the repo.
My system was prepared from viewtopic.php?p=7078#p7078 and it worked.

checkout dev branch
cmake -G Ninja -DMSYS=TRUE -DUSE_NETWORKING=ON -DCMAKE_BUILD_TYPE=Release
returns immediately :/ no error message

Any suggestions?
User avatar
MichaelJManley
Posts: 38
Joined: Fri 17 Dec, 2021 9:42 pm

Re: How to compile latest version on windows 10

Post by MichaelJManley »

edilson wrote: Sun 02 Jan, 2022 11:29 pm I just downloaded again the code from the repo.
My system was prepared from viewtopic.php?p=7078#p7078 and it worked.

checkout dev branch
cmake -G Ninja -DMSYS=TRUE -DUSE_NETWORKING=ON -DCMAKE_BUILD_TYPE=Release
returns immediately :/ no error message

Any suggestions?
Install PCAP Dependencies (mingw-w64-{i686,x86_64}-libpcap) or do -DUSE_PCAP_NETWORKING=NO if you just want SLiRP support
edilson
Posts: 4
Joined: Wed 19 May, 2021 1:11 pm

Re: How to compile latest version on windows 10

Post by edilson »

I reinstalled libpcap and it worked.
Thanks
Joel_w
Posts: 4
Joined: Sat 16 Mar, 2019 3:33 pm

Re: How to compile latest version on windows 10

Post by Joel_w »

I had another problem, the wrong version of CMake was installed. I had to uninstall the other version and then reinstall the correct CMake to get everything to work.

If you get an error message about the system being unknown and that the C compiler can't compile a simple file you can try this:

Code: Select all

pacman -R cmake
pacman -S mingw-w64-{x86_64,i686}-cmake
User avatar
leilei
Posts: 981
Joined: Fri 25 Apr, 2014 4:47 pm

Re: How to compile latest version on windows 10

Post by leilei »

Going through that MSYS2 guide (after 3.64gb of dev env prep) deadended me...

Code: Select all

$ cmake -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release ..
CMake Error: Could not create named generator MSYS Makefiles

Generators
* Unix Makefiles               = Generates standard UNIX makefiles.
  Ninja                        = Generates build.ninja files.
  Ninja Multi-Config           = Generates build-<Config>.ninja files.
  CodeBlocks - Ninja           = Generates CodeBlocks project files.
  CodeBlocks - Unix Makefiles  = Generates CodeBlocks project files.
  CodeLite - Ninja             = Generates CodeLite project files.
  CodeLite - Unix Makefiles    = Generates CodeLite project files.
  Eclipse CDT4 - Ninja         = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - Unix Makefiles= Generates Eclipse CDT 4.0 project files.
  Kate - Ninja                 = Generates Kate project files.
  Kate - Unix Makefiles        = Generates Kate project files.
  Sublime Text 2 - Ninja       = Generates Sublime Text 2 project files.
  Sublime Text 2 - Unix Makefiles
                               = Generates Sublime Text 2 project files.

User avatar
ruben_balea
Posts: 180
Joined: Mon 08 May, 2017 11:24 pm
Location: Spain

Re: How to compile latest version on windows 10

Post by ruben_balea »

That can happen if you run cmake from MSYS2 MSYS, if this was your case you have to switch to MSYS2 MinGW 32 or MSYS2 MinGW 64 to compile PCem, in some of the earlier guides it was specified but I think the last guide is missing that step

MSYS2:
________msys.png
________msys.png (16.44 KiB) Viewed 2385 times
MSYS2 MINGW64:
________mingw64.png
________mingw64.png (25.9 KiB) Viewed 2385 times
(Edit: I added screen captures)
User avatar
leilei
Posts: 981
Joined: Fri 25 Apr, 2014 4:47 pm

Re: How to compile latest version on windows 10

Post by leilei »

Alright it's built. I'm now seeing a pcem.exe and libpcem.dll. Thank!
User avatar
MichaelJManley
Posts: 38
Joined: Fri 17 Dec, 2021 9:42 pm

Re: How to compile latest version on windows 10

Post by MichaelJManley »

I will update the Windows one to be more accurate. Also I need to make one for Ubuntu and openSUSE
Post Reply