[Feb 2018 ed.] PCem MSYS2 build guide (with wxWidgets)

Discussion of development and patch submission.
JosepMa
Posts: 168
Joined: Tue 20 Jun, 2017 6:25 pm

Re: [Feb 2018 ed.] PCem MSYS2 build guide (with wxWidgets)

Post by JosepMa »

altieres.lima wrote:
Sat 28 Apr, 2018 2:11 pm
How to include all dll's in exe?
Just locate them in msys2 and copy them into your final dist folder.
They are:

libexpat-1.dll
libgcc_s_dw2-1.dll
libjpeg-8.dll
liblzma-5.dll
libopenal-1.dll
libpng16-16.dll
libstdc++-6.dll
libtiff-5.dll
libwinpthread-1.dll
SDL2.dll
wxbase30u_gcc_custom.dll
wxbase30u_xml_gcc_custom.dll
wxmsw30u_adv_gcc_custom.dll
wxmsw30u_core_gcc_custom.dll
wxmsw30u_html_gcc_custom.dll
wxmsw30u_xrc_gcc_custom.dll
zlib1.dll


If you actually asked how to build pcem with static linking instead of dynamic linking, I looked briefly and I don't see any simple way to do it.
You might be able to build it with one of the manually written Makefiles (inside the src folder) and modify the LIBS= definition to include the options -Bstatic or -Bdynamic as needed.
User avatar
KingDaveRa
Posts: 22
Joined: Thu 06 Oct, 2016 9:00 pm
Location: UK
Contact:

Re: [Feb 2018 ed.] PCem MSYS2 build guide (with wxWidgets)

Post by KingDaveRa »

I've followed through the build instructions, and come to a juddering halt:

Code: Select all

Dave@DESKTOP-HTLI9DO MSYS ~/pcem
# ./configure --enable-networking --enable-release-build
configure: loading site script /etc/config.site
checking build system type... x86_64-pc-msys
checking host system type... x86_64-pc-msys
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/home/Dave/pcem':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
Config.log is attached.

I get no errors installing, but I find gcc in /mingw32/bin/gcc.exe which isn't in the path. I'd have expected that to be added automatically (and I've re-started MSYS2, even run it as administrator and re-installed).

Shall I just add that, or is there something else subtly different since the guide was written?
Attachments
config.log
(7.68 KiB) Downloaded 219 times
shermanp
Posts: 136
Joined: Sat 18 Feb, 2017 2:09 am

Re: [Feb 2018 ed.] PCem MSYS2 build guide (with wxWidgets)

Post by shermanp »

That's weird. I can't think of anything that would have fundamentally changed since I made this guide. In fact, I recently updated my own MSYS2 installation a few weeks ago.

Are you using the MSYS2 MingGW shell. You should be using that, and not the MSYS2 MSYS shell.

It's really strange that it's not finding gcc.
User avatar
KingDaveRa
Posts: 22
Joined: Thu 06 Oct, 2016 9:00 pm
Location: UK
Contact:

Re: [Feb 2018 ed.] PCem MSYS2 build guide (with wxWidgets)

Post by KingDaveRa »

I've been using MSYS2 MSYS, as the guide said. I'll give it a whirl with the MingGW shell instead.
User avatar
ruben_balea
Posts: 123
Joined: Mon 08 May, 2017 11:24 pm
Location: Spain

Re: [Feb 2018 ed.] PCem MSYS2 build guide (with wxWidgets)

Post by ruben_balea »

MSYS2 MSYS is used during setup only, to compile PCem switch to MSYS2 MinGW32
User avatar
KingDaveRa
Posts: 22
Joined: Thu 06 Oct, 2016 9:00 pm
Location: UK
Contact:

Re: [Feb 2018 ed.] PCem MSYS2 build guide (with wxWidgets)

Post by KingDaveRa »

There we go, that fixed it. A subtlety I'd not noticed!

Thanks :)
shermanp
Posts: 136
Joined: Sat 18 Feb, 2017 2:09 am

Re: [Feb 2018 ed.] PCem MSYS2 build guide (with wxWidgets)

Post by shermanp »

I've updated the original guide to hopefully make it clearer that one needs to switch shells from the "Prepare and Compile PCem" step onward.
User avatar
omarsis81
Posts: 867
Joined: Thu 17 Dec, 2015 6:20 pm

Re: [Feb 2018 ed.] PCem MSYS2 build guide (with wxWidgets)

Post by omarsis81 »

Is this guide for the Linux build? How can I compile it under Windows?
darksabre76
Posts: 62
Joined: Tue 12 Sep, 2017 4:33 am
Location: Seattle, WA, USA
Contact:

Re: [Feb 2018 ed.] PCem MSYS2 build guide (with wxWidgets)

Post by darksabre76 »

MSYS2 is a Windows build environment
User avatar
omarsis81
Posts: 867
Joined: Thu 17 Dec, 2015 6:20 pm

Re: [Feb 2018 ed.] PCem MSYS2 build guide (with wxWidgets)

Post by omarsis81 »

darksabre76 wrote:
Thu 03 Jan, 2019 7:19 pm
MSYS2 is a Windows build environment
Please forgive my silly question, I saw all those $ shell commands that looked like linux
shermanp
Posts: 136
Joined: Sat 18 Feb, 2017 2:09 am

Re: [Feb 2018 ed.] PCem MSYS2 build guide (with wxWidgets)

Post by shermanp »

omarsis81 wrote:
Fri 04 Jan, 2019 1:48 pm
darksabre76 wrote:
Thu 03 Jan, 2019 7:19 pm
MSYS2 is a Windows build environment
Please forgive my silly question, I saw all those $ shell commands that looked like linux
That's because MSYS2 is basically a stripped down linux distribution (Arch I believe) compiled to run on windows. It contains a linux shell, package manager, and all the *nix programs one would expect to compile software in the *nix manner (./configure, make etc.)
User avatar
omarsis81
Posts: 867
Joined: Thu 17 Dec, 2015 6:20 pm

Re: [Feb 2018 ed.] PCem MSYS2 build guide (with wxWidgets)

Post by omarsis81 »

I'm trying to compile v15 using this guide.
Trying to clone PCem directly from bitbucket.org gives me an error, so I copied all the src files
to where the clone should be, but when I try to run $ mingw32-make -j it said "No targets specified and no makefile found."
So... do I need a makefile? How should I proceed? Thanks

EDIT: I don't want to compile a clone as I want to make some changes to the code myself
JosepMa
Posts: 168
Joined: Tue 20 Jun, 2017 6:25 pm

Re: [Feb 2018 ed.] PCem MSYS2 build guide (with wxWidgets)

Post by JosepMa »

@omarsis81: more information is needed to know what are you doing wrong.

Given that not even hg worked for you, maybe we should first verify that the environment is correctly installed.

Anyway, you don't need to use hg inside msys2. you can still use TortoiseHG or whatever windows tool that you already have.

To change to a directory like C:\mypath\mysubfolder from msys2, you would do like

Code: Select all

cd /c/mypath/mysubfolder  
EDIT: The compilation instructions (configure, autoreconf, make...) assume that you are on the pcem root source folder.
Last edited by JosepMa on Wed 03 Jul, 2019 8:21 pm, edited 1 time in total.
User avatar
ruben_balea
Posts: 123
Joined: Mon 08 May, 2017 11:24 pm
Location: Spain

Re: [Feb 2018 ed.] PCem MSYS2 build guide (with wxWidgets)

Post by ruben_balea »

That's what I did:

I downloaded http://pcem-emulator.co.uk/files/PCemV15Win.zip and extracted it to C:\msys64\home\username\PCemV15Win

Then I run MSYS2 MinGW 32-bit and do the following

$ cd PCemV15Win
$ make clean
$ ./configure --enable-release-build --enable-networking
$ mingw32-make -j8
Then if you didn't get any compilation error:
$ cp ./src/pcem.exe ./
$ start .

And there's your fresh PCem.exe ready to run or to ask for some dll's, see below.

start . is a Windows command which opens the current folder in explorer, it's the same as start .\ but faster to type
make clean to clean any garbage from previous compilations
both --enable-release-build --enable-networking parameters are optional of course.
-j8 where 8 is for the number of CPU threads to use by the compiler, my CPU has 4 HT cores so I'm using 8 threads, this is also optional, under MSYS2 compiling is a bit slow anyway…

And then the resulting PCem.exe doesn't work in place of the original PCem.exe located on PCemV15Win folder because the dll's are not the same, I have to search for the correct ones on c:\msys64 folder.
Each time you run that compiled PCem it throws and error about a missing dll until you get them all.
  • Those are the dll's that I have in my PCem folder, some have the same name as the one that come in PCemV15Win.zip but I've replaced them with the ones found on msys64 subfolders:

    libexpat-1.dll
    libgcc_s_dw2-1.dll
    libjpeg-8.dll
    liblzma-5.dll
    libopenal-1.dll
    libpng16-16.dll
    libstdc++-6.dll
    libtiff-5.dll
    libwinpthread-1.dll
    SDL2.dll
    wpcap.dll
    wxbase30u_gcc_custom.dll
    wxbase30u_net_gcc_custom.dll
    wxbase30u_xml_gcc_custom.dll
    wxmsw30u_adv_gcc_custom.dll
    wxmsw30u_aui_gcc_custom.dll
    wxmsw30u_core_gcc_custom.dll
    wxmsw30u_gl_gcc_custom.dll
    wxmsw30u_html_gcc_custom.dll
    wxmsw30u_propgrid_gcc_custom.dll
    wxmsw30u_qa_gcc_custom.dll
    wxmsw30u_ribbon_gcc_custom.dll
    wxmsw30u_richtext_gcc_custom.dll
    wxmsw30u_stc_gcc_custom.dll
    wxmsw30u_webview_gcc_custom.dll
    wxmsw30u_xrc_gcc_custom.dll
    zlib1.dll
Manaphy
Posts: 10
Joined: Sat 18 May, 2019 7:26 pm

Re: [Feb 2018 ed.] PCem MSYS2 build guide (with wxWidgets)

Post by Manaphy »

Try to compile using the mingw make file, it appears to compile with slightly different keyboard input code than if I use configure.
User avatar
ruben_balea
Posts: 123
Joined: Mon 08 May, 2017 11:24 pm
Location: Spain

Re: [Feb 2018 ed.] PCem MSYS2 build guide (with wxWidgets)

Post by ruben_balea »

I will try that way right now, many thanks for the advice
User avatar
omarsis81
Posts: 867
Joined: Thu 17 Dec, 2015 6:20 pm

Re: [Feb 2018 ed.] PCem MSYS2 build guide (with wxWidgets)

Post by omarsis81 »

I'm compiling as ruben_balea said and works fine, but I get a compilation error at some point - I'm missing pcap.h used in ne2000.c
I believe I'm missing a library
I typed "pacman -Ss libpcap-dev" but didn't work. Any advice?
jznomoney
Posts: 94
Joined: Sat 06 Dec, 2014 9:11 pm

Re: [Feb 2018 ed.] PCem MSYS2 build guide (with wxWidgets)

Post by jznomoney »

omarsis81 wrote:
Thu 04 Jul, 2019 1:24 pm
I'm compiling as ruben_balea said and works fine, but I get a compilation error at some point - I'm missing pcap.h used in ne2000.c
I believe I'm missing a library
I typed "pacman -Ss libpcap-dev" but didn't work. Any advice?
you missed a step. double check back in the first post about npcap.
User avatar
ruben_balea
Posts: 123
Joined: Mon 08 May, 2017 11:24 pm
Location: Spain

Re: [Feb 2018 ed.] PCem MSYS2 build guide (with wxWidgets)

Post by ruben_balea »

Try downloading https://nmap.org/npcap/dist/npcap-sdk-1.03.zip
Extract all the contents of 'Include' folder into <msys installation folder>\mingw32\include and all the contents of 'Lib' folder into <msys installation folder>\mingw32\lib

Edit: Yes, as jznomoney said there's the proper way to do it from the MSYS2 MSYS Shell in the PCem MSYS2 build guide: http://pcem-emulator.co.uk/phpBB3/viewt ... ?f=3&t=845
User avatar
omarsis81
Posts: 867
Joined: Thu 17 Dec, 2015 6:20 pm

Re: [Feb 2018 ed.] PCem MSYS2 build guide (with wxWidgets)

Post by omarsis81 »

ruben_balea wrote:
Thu 04 Jul, 2019 3:43 pm
Try downloading https://nmap.org/npcap/dist/npcap-sdk-1.03.zip
Extract all the contents of 'Include' folder into <msys installation folder>\mingw32\include and all the contents of 'Lib' folder into <msys installation folder>\mingw32\lib

Edit: Yes, as jznomoney said there's the proper way to do it from the MSYS2 MSYS Shell in the PCem MSYS2 build guide: http://pcem-emulator.co.uk/phpBB3/viewt ... ?f=3&t=845
That worked like a charm! I'm almost done with the compiling, but I get this error now

pcem-model.o:model.c:(.text+0x1af6): undefined reference to `fdc37c932fr_init'
pcem-model.o:model.c:(.text+0x1d55): undefined reference to `aip_82091aa_init'
collect2.exe: error: ld returned 1 exit status
mingw32-make[1]: *** [Makefile:899: pcem.exe] Error 1
mingw32-make[1]: Leaving directory 'C:/msys32/home/Omar/pc15/src'
mingw32-make: *** [Makefile:365: all-recursive] Error 1

I wonder why it mentions mingw when I use MSYS2
User avatar
ruben_balea
Posts: 123
Joined: Mon 08 May, 2017 11:24 pm
Location: Spain

Re: [Feb 2018 ed.] PCem MSYS2 build guide (with wxWidgets)

Post by ruben_balea »

omarsis81 wrote:
Thu 04 Jul, 2019 4:04 pm
I wonder why it mentions mingw when I use MSYS2
I guess you're using MSYS2 MinGW 32-bit. The console shows MINGW32 after your username, like: user@domain MINGW32 ~/PCemv15/src

You can't compile PCem from MSYS2 MSYS.

try to use make clean before compiling again
User avatar
omarsis81
Posts: 867
Joined: Thu 17 Dec, 2015 6:20 pm

Re: [Feb 2018 ed.] PCem MSYS2 build guide (with wxWidgets)

Post by omarsis81 »

Thanks to the advise of ruben_balea I managed to get the pcem.exe file
I renamed pcem.exe to pcem2.exe I moved it to the oficial PCem v15 exe folder
The first thing I notieced is the oficial v15 exe is 17 MB large while the new binary I compiled is only 7 MB...
When I run the pcem2.exe file I get an error message:

"The procedure entry point _divmoddi4 could not be located in the dynamic link library libgcc_s_dw2-1.dll"

I first though I have a corrupted DLL file, but it is the same DLL that it comes with PCem15
JosepMa
Posts: 168
Joined: Tue 20 Jun, 2017 6:25 pm

Re: [Feb 2018 ed.] PCem MSYS2 build guide (with wxWidgets)

Post by JosepMa »

Official pcem is not compiled with MSYS2. it is compiled with the other mingw and not using the exact same versions of the dependencies.
You need to use the dlls that are in msys2.
User avatar
omarsis81
Posts: 867
Joined: Thu 17 Dec, 2015 6:20 pm

Re: [Feb 2018 ed.] PCem MSYS2 build guide (with wxWidgets)

Post by omarsis81 »

JosepMa wrote:
Thu 11 Jul, 2019 7:55 pm
Official pcem is not compiled with MSYS2. it is compiled with the other mingw and not using the exact same versions of the dependencies.
You need to use the dlls that are in msys2.
It works now, I feel so newbie at this :oops:
basic2004
Posts: 124
Joined: Sun 08 Jan, 2017 5:59 pm

Re: [Feb 2018 ed.] PCem MSYS2 build guide (with wxWidgets)

Post by basic2004 »

I found MIDI feature is missing when building with MSYS2(Windows), so I added -lwinmm and win-midi.c in src/Makefile.am
This patch file for stock PCem v15 for Windows.

Put this file in PCem directory and patch before compile.

Code: Select all

patch -p1 < PCemV15-winmidi.patch
Attachments
PCemV15-winmidi.patch
(562 Bytes) Downloaded 140 times
User avatar
omarsis81
Posts: 867
Joined: Thu 17 Dec, 2015 6:20 pm

Re: [Feb 2018 ed.] PCem MSYS2 build guide (with wxWidgets)

Post by omarsis81 »

Did someone successfully compile the latest commit?
I got the following error
pcem-model.o:model.c:(.text+0xc94): undefined reference to `scamp_init'
pcem-video.o:video.c:(.data+0xb58): undefined reference to `mystique_device'
User avatar
leilei
Posts: 806
Joined: Fri 25 Apr, 2014 4:47 pm

Re: [Feb 2018 ed.] PCem MSYS2 build guide (with wxWidgets)

Post by leilei »

It's compileable. Sounds like your makefile leaving out vid_mga.c
darksabre76
Posts: 62
Joined: Tue 12 Sep, 2017 4:33 am
Location: Seattle, WA, USA
Contact:

Re: [Feb 2018 ed.] PCem MSYS2 build guide (with wxWidgets)

Post by darksabre76 »

Using the `autoreconf` -> `./configure` -> `make` path is still better than using the separate makefiles :) Albeit there are some issues compiling on x86-64 (at least on my MSYS2 setup)
User avatar
dns2kv2
Posts: 66
Joined: Sun 19 Feb, 2017 3:30 am

Re: [Feb 2018 ed.] PCem MSYS2 build guide (with wxWidgets)

Post by dns2kv2 »

Just tested the guides with latest pcem commit 6db6308, still works in 2020 as intended & nicely smooth :D

Code: Select all

#pre-compilation 1: 
#download MSYS2 from http://www.msys2.org/ I686 or x86_64 doesn't matter. 
#Install it to C:\msys32 or C:\msys64). 
#From opened MSYS2 MSYS shell run:
pacman -Syuu


#pre-compilation 2: 
#Force close the opened MSYS2 MSYS shell until crashed and Re-open MSYS2 MSYS shell (C:\msys32\msys2.exe) then run again below command:
pacman -Syuu


#pre-compilation 3: 
#download compiling tools & include files
#On opened MSYS2 MSYS shell (C:\msys32\msys2.exe), run below command:
pacman -S mingw-w64-i686-toolchain base-devel mercurial unzip
pacman -S mingw-w64-i686-SDL2 mingw-w64-i686-openal mingw-w64-i686-wxWidgets
wget https://nmap.org/npcap/dist/npcap-sdk-0.1.zip
unzip npcap-sdk-0.1.zip
cd npcap-sdk-0.1
cp -r Include/* /mingw32/include/
cp -r Lib/* /mingw32/lib/


#download pcem source files
#if encounter error during this step, run as admin c:\msys2.exe\autorebase.bat and try again.
#open MSYS2 MinGW 32-bit shell  (C:\msys32\mingw32.exe) and run below command:
hg clone https://bitbucket.org/pcem_emulator/pcem
cd pcem


#compile pcem
#On opened MSYS2 MinGW 32-bit shell  (C:\msys32\mingw32.exe), run below command:
autoreconf -i
./configure --enable-networking --enable-release-build
mingw32-make -j


#get the pcem.exe binary & dll files
c:\msys32\home\{your username}\pcem\src\pcem.exe
c:\msys32\mingw32\bin\libexpat-1.dll
c:\msys32\mingw32\bin\libgcc_s_dw2-1.dll
c:\msys32\mingw32\bin\libjpeg-8.dll
c:\msys32\mingw32\bin\liblzma-5.dll
c:\msys32\mingw32\bin\libopenal-1.dll
c:\msys32\mingw32\bin\libpng16-16.dll
c:\msys32\mingw32\bin\libstdc++-6.dll
c:\msys32\mingw32\bin\libtiff-5.dll
c:\msys32\mingw32\bin\libwinpthread-1.dll
c:\msys32\mingw32\bin\libzstd.dll
c:\msys32\mingw32\bin\SDL2.dll
c:\msys32\mingw32\bin\wxbase30u_gcc_custom.dll
c:\msys32\mingw32\bin\wxbase30u_xml_gcc_custom.dll
c:\msys32\mingw32\bin\wxmsw30u_adv_gcc_custom.dll
c:\msys32\mingw32\bin\wxmsw30u_core_gcc_custom.dll
c:\msys32\mingw32\bin\wxmsw30u_html_gcc_custom.dll
c:\msys32\mingw32\bin\wxmsw30u_xrc_gcc_custom.dll
c:\msys32\mingw32\bin\zlib1.dll


#clean previous build, redownload & update pcem sources then recompile pcem
#open MSYS2 MinGW 32-bit shell  (C:\msys32\mingw32.exe) and run below command:
cd ~/pcem
mingw32-make clean
hg pull && hg update default
autoreconf -i
./configure --enable-networking --enable-release-build
mingw32-make -j


#get the updated pcem.exe binary
c:\msys32\home\{your username}\pcem\src\pcem.exe
shermanp
Posts: 136
Joined: Sat 18 Feb, 2017 2:09 am

Re: [Feb 2018 ed.] PCem MSYS2 build guide (with wxWidgets)

Post by shermanp »

Glad to hear! I must admit I don't tend to use MSYS2 these days. The makefile autoconf produces is so sloooooow.

I instead use the included windows makefile with mingw-w64 and manually installed libraries. It's a LOT quicker!

EDIT: This was a reason I experimented with cmake a while back. But Sarah wasn't interested in changing/adding build systems (fair enough) so I abandoned that.
Post Reply