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

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

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

Post by JosepMa » Sat 28 Apr, 2018 5:51 pm

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 » Tue 25 Dec, 2018 10:23 pm

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 82 times

shermanp
Posts: 121
Joined: Sat 18 Feb, 2017 2:09 am

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

Post by shermanp » Tue 25 Dec, 2018 10:46 pm

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 » Tue 25 Dec, 2018 11:17 pm

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: 98
Joined: Mon 08 May, 2017 11:24 pm
Location: Spain

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

Post by ruben_balea » Tue 25 Dec, 2018 11:24 pm

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 » Tue 25 Dec, 2018 11:27 pm

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

Thanks :)

shermanp
Posts: 121
Joined: Sat 18 Feb, 2017 2:09 am

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

Post by shermanp » Tue 25 Dec, 2018 11:54 pm

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: 696
Joined: Thu 17 Dec, 2015 6:20 pm

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

Post by omarsis81 » Thu 03 Jan, 2019 7:04 pm

Is this guide for the Linux build? How can I compile it under Windows?

darksabre76
Posts: 60
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 » Thu 03 Jan, 2019 7:19 pm

MSYS2 is a Windows build environment

User avatar
omarsis81
Posts: 696
Joined: Thu 17 Dec, 2015 6:20 pm

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

Post by omarsis81 » 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

shermanp
Posts: 121
Joined: Sat 18 Feb, 2017 2:09 am

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

Post by shermanp » Fri 04 Jan, 2019 8:29 pm

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: 696
Joined: Thu 17 Dec, 2015 6:20 pm

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

Post by omarsis81 » Wed 03 Jul, 2019 5:22 pm

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: 139
Joined: Tue 20 Jun, 2017 6:25 pm

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

Post by JosepMa » Wed 03 Jul, 2019 7:57 pm

@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: 98
Joined: Mon 08 May, 2017 11:24 pm
Location: Spain

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

Post by ruben_balea » Wed 03 Jul, 2019 8:09 pm

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: 2
Joined: Sat 18 May, 2019 7:26 pm

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

Post by Manaphy » Wed 03 Jul, 2019 10:21 pm

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: 98
Joined: Mon 08 May, 2017 11:24 pm
Location: Spain

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

Post by ruben_balea » Wed 03 Jul, 2019 10:29 pm

I will try that way right now, many thanks for the advice

User avatar
omarsis81
Posts: 696
Joined: Thu 17 Dec, 2015 6:20 pm

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

Post by omarsis81 » 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?

jznomoney
Posts: 92
Joined: Sat 06 Dec, 2014 9:11 pm

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

Post by jznomoney » Thu 04 Jul, 2019 3:35 pm

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: 98
Joined: Mon 08 May, 2017 11:24 pm
Location: Spain

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

Post by ruben_balea » 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

User avatar
omarsis81
Posts: 696
Joined: Thu 17 Dec, 2015 6:20 pm

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

Post by omarsis81 » Thu 04 Jul, 2019 4:04 pm

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: 98
Joined: Mon 08 May, 2017 11:24 pm
Location: Spain

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

Post by ruben_balea » Thu 04 Jul, 2019 4:35 pm

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: 696
Joined: Thu 17 Dec, 2015 6:20 pm

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

Post by omarsis81 » Thu 11 Jul, 2019 6:07 pm

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: 139
Joined: Tue 20 Jun, 2017 6:25 pm

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

Post by JosepMa » 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.

User avatar
omarsis81
Posts: 696
Joined: Thu 17 Dec, 2015 6:20 pm

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

Post by omarsis81 » Thu 11 Jul, 2019 8:31 pm

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:

Post Reply