Page 2 of 3

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

Posted: Sat 28 Apr, 2018 5:51 pm
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.

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

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

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

Posted: Tue 25 Dec, 2018 10:46 pm
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.

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

Posted: Tue 25 Dec, 2018 11:17 pm
by KingDaveRa
I've been using MSYS2 MSYS, as the guide said. I'll give it a whirl with the MingGW shell instead.

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

Posted: Tue 25 Dec, 2018 11:24 pm
by ruben_balea
MSYS2 MSYS is used during setup only, to compile PCem switch to MSYS2 MinGW32

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

Posted: Tue 25 Dec, 2018 11:27 pm
by KingDaveRa
There we go, that fixed it. A subtlety I'd not noticed!

Thanks :)

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

Posted: Tue 25 Dec, 2018 11:54 pm
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.

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

Posted: Thu 03 Jan, 2019 7:04 pm
by omarsis81
Is this guide for the Linux build? How can I compile it under Windows?

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

Posted: Thu 03 Jan, 2019 7:19 pm
by darksabre76
MSYS2 is a Windows build environment

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

Posted: Fri 04 Jan, 2019 1:48 pm
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

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

Posted: Fri 04 Jan, 2019 8:29 pm
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.)

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

Posted: Wed 03 Jul, 2019 5:22 pm
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

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

Posted: Wed 03 Jul, 2019 7:57 pm
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.

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

Posted: Wed 03 Jul, 2019 8:09 pm
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

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

Posted: Wed 03 Jul, 2019 10:21 pm
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.

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

Posted: Wed 03 Jul, 2019 10:29 pm
by ruben_balea
I will try that way right now, many thanks for the advice

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

Posted: Thu 04 Jul, 2019 1:24 pm
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?

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

Posted: Thu 04 Jul, 2019 3:35 pm
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.

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

Posted: Thu 04 Jul, 2019 3:43 pm
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

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

Posted: Thu 04 Jul, 2019 4:04 pm
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

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

Posted: Thu 04 Jul, 2019 4:35 pm
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

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

Posted: Thu 11 Jul, 2019 6:07 pm
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

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

Posted: Thu 11 Jul, 2019 7:55 pm
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.

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

Posted: Thu 11 Jul, 2019 8:31 pm
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:

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

Posted: Fri 09 Aug, 2019 7:53 pm
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

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

Posted: Fri 17 Jan, 2020 3:08 pm
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'

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

Posted: Fri 17 Jan, 2020 3:18 pm
by leilei
It's compileable. Sounds like your makefile leaving out vid_mga.c

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

Posted: Fri 17 Jan, 2020 7:16 pm
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)

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

Posted: Sat 18 Apr, 2020 1:11 am
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

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

Posted: Sat 18 Apr, 2020 10:52 am
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.