Cannot compile a working executable

Discussion of development and patch submission.
Post Reply
teepean
Posts: 7
Joined: Sat 04 Feb, 2017 1:33 pm

Cannot compile a working executable

Post by teepean »

I've been trying to compile my own version of PCem without success. The vanilla v11 binary works great but I would like to compile from hg while waiting for v12. This also happens when I try compiling v11.

If I compile without debug information I get the error:

Code: Select all

Program received signal SIGSEGV, Segmentation fault.
0x004f7736 in dumpregs ()
Here's the error if I compile with debug (-g)

Code: Select all

Program received signal SIGSEGV, Segmentation fault.
readmemb (a=4096) at 808x.c:48
48              else return *(uint8_t *)(readlookup2[(a) >> 12] + (a));
I've tried using the vanilla GCC 5.3.0 from MinGW using dreamer's instructions.
Mr.Nacho
Posts: 10
Joined: Sun 29 Jan, 2017 3:12 pm

Re: Cannot compile a working executable

Post by Mr.Nacho »

I use GCC 4.7.2-1. I also followed Dreamer's instructions -- it says that you need to remove the GCC packages from the main installer and to install 4.7.2-1 manually afterwards. That worked for me.
User avatar
dreamer
Posts: 40
Joined: Wed 28 Dec, 2016 11:56 am

Re: Cannot compile a working executable

Post by dreamer »

PCem doesn't compile on newest versions of GCC and Leilei advised me to use 4.7.2 which is definitely known to work with PCem. It looks like it's a different issue - the app compiles bus doesn't run properly. Make sure You are using GCC 4.7.2 from the guide and try again. Post up if You mange to do it, and if it doesn't work out we will try to help You :)
altieres.lima
Posts: 5
Joined: Sun 18 Sep, 2016 1:54 pm

Re: Cannot compile a working executable

Post by altieres.lima »

PCem Compiling Tools use the latest gcc 5.3.0-3 from:
https://sourceforge.net/projects/mingw/ ... c-5.3.0-3/

mingw_gcc-5.3.0-3_ready_to_compile_v8.3_for_pcem.7z (24.32MB)

Link:
https://www.sendspace.com/file/9siufi
Last edited by altieres.lima on Mon 06 Feb, 2017 7:04 am, edited 1 time in total.
szadycbr
Posts: 295
Joined: Mon 21 Nov, 2016 6:23 pm

Re: Cannot compile a working executable

Post by szadycbr »

Now this is simplest thing for anyone who wants to compile and dont know how, just download mingw_gcc-5.3.0-3_ready_to_compile_v8.3_for_pcem.7z and extract the content to pcem/src folder, then click Compile_release_build.bat and ... thats it, just wait and PCem_release.exe will be in this folder after the job is done.
I stil prefer Dreamer setup , but it require a bit of doing ,until you make it work, but this is the simplest ever.
User avatar
Fusion
Posts: 11
Joined: Sun 05 Feb, 2017 10:14 pm
Location: Ontario, Canada

Re: Cannot compile a working executable

Post by Fusion »

That worked great for me szadycbr!

I just had to move a few .dlls from src\mingw\gcc-5.3.0-3\bin to where PCem_release.exe was located.
teepean
Posts: 7
Joined: Sat 04 Feb, 2017 1:33 pm

Re: Cannot compile a working executable

Post by teepean »

Thank you szadycbr! Your solution did the trick. I still don't understand why my own MinGW cannot produce a working executable because AFAIK the setup is exactly the same as in the ready to compile archive.
szadycbr
Posts: 295
Joined: Mon 21 Nov, 2016 6:23 pm

Re: Cannot compile a working executable

Post by szadycbr »

Glad to hear that it works, but strangely i didnt had to copy anything to src folder (where release was build) to make executable , unless you try to run the exe in this folder, then you need three dll's from gcc/bin folder, libwinpthread-1.dll, libstdc++-6.dll, libgcc_s_dw2-1.dll is that the case?
And dont thank me, thank Altieres.lima for this.
Last edited by szadycbr on Mon 06 Feb, 2017 5:44 pm, edited 1 time in total.
teepean
Posts: 7
Joined: Sat 04 Feb, 2017 1:33 pm

Re: Cannot compile a working executable

Post by teepean »

I noticed a strange thing about the dlls. The build I just made doesn't require libwinpthread-1.dll at all. Or more specifically libgcc_s_dw2-1.dll that is included in mingw_gcc-5.3.0-3_ready_to_compile_v8.3_for_pcem.7z does not require libwinpthread-1.dll.
szadycbr
Posts: 295
Joined: Mon 21 Nov, 2016 6:23 pm

Re: Cannot compile a working executable

Post by szadycbr »

it is strange, cos my build require both of them to run. does any one have any idea why?
Battler
Posts: 793
Joined: Sun 06 Jul, 2014 7:05 pm

Re: Cannot compile a working executable

Post by Battler »

- teepean: The emulator is fataling before RAM is initialized, and then crashing when dumping the RAM. See pclog.txt for why it's fataling.
startmenu
Posts: 104
Joined: Sat 29 Nov, 2014 7:39 am

Re: Cannot compile a working executable

Post by startmenu »

I've just built recent PCem revisions successfully with GCC 5.3 (MinGW) and GCC 6.2 (msys2).
For MinGW, I just performed a full and clean instalation and added some DirectX API headers(see here https://github.com/lifthrasiir/w32api-d ... standalone ).
But it's tricky to compile it on msys2. I added the missing headers and libs, but it still failed to compile cdrom-ioctl.c. I have to compile cdrom-ioctl.c alone, with "-D__MINGW64__" argument, and continue the make process.
pcem_gcc5.png
pcem_gcc5.png (39.13 KiB) Viewed 15437 times
teepean
Posts: 7
Joined: Sat 04 Feb, 2017 1:33 pm

Re: Cannot compile a working executable

Post by teepean »

Battler wrote:- teepean: The emulator is fataling before RAM is initialized, and then crashing when dumping the RAM. See pclog.txt for why it's fataling.
Here's the output. Is it possible to get the pclog.txt from a successful session?

Code: Select all

Arg 0 - E:\pcem\PCem-profiled.exe
Raw input registered!
Preparing scan code map list...
Done preparing!
executable_name = E:\pcem\PCem-profiled.exe
path = E:\pcem\
Keyboard initialized!
joystick_init: joysticks_present=0
Config data :
[]
gameblaster = 0
gus = 0
ssi2001 = 0
voodoo = 1
model = 38
cpu_manufacturer = 0
cpu = 7
cpu_use_dynarec = 1
gfxcard = 17
video_speed = 5
sndcard = 7
cpu_speed = 19
has_fpu = 1
slow_video = 1
cache = 4
cga_composite = 0
disc_a = 
disc_b = 
mem_size = 262144
cdrom_drive = 200
cdrom_enabled = 1
cdrom_channel = 2
cdrom_path = E:\Tiedot\Downloads\UNREAL_GOLD.iso
vid_resize = 0
vid_api = 1
video_fullscreen_scale = 0
video_fullscreen_first = 1
hdc_sectors = 63
hdc_heads = 16
hdc_cylinders = 5111
hdc_fn = E:\pcem\hdd\dos622.hda
hdd_sectors = 0
hdd_heads = 0
hdd_cylinders = 0
hdd_fn = 
hde_sectors = 0
hde_heads = 0
hde_cylinders = 0
hde_fn = 
hdf_sectors = 0
hdf_heads = 0
hdf_cylinders = 0
hdf_fn = 
drive_a_type = 5
drive_b_type = 7
cpu_waitstates = 0
window_w = 0
window_h = 0
window_x = 0
window_y = 0
window_remember = 0
joystick_type = 0
enable_sync = 1
[Joysticks]
joystick_0_nr = 0
joystick_1_nr = 0
[3DFX Voodoo Graphics]
framebuffer_memory = 4
texture_memory = 4
bilinear = 1
dacfilter = 0
render_threads = 1
recompiler = 1
Config loaded
Starting with romset 38
timer_reset
Loading :0  
Loading :1  
Starting with romset 0
romset 0 - 1
Starting with romset 1
romset 1 - 1
Starting with romset 2
romset 2 - 1
Starting with romset 3
romset 3 - 1
Starting with romset 4
romset 4 - 1
Starting with romset 5
romset 5 - 1
Starting with romset 6
romset 6 - 1
Starting with romset 7
romset 7 - 1
Starting with romset 8
romset 8 - 1
Starting with romset 9
romset 9 - 1
Starting with romset 10
romset 10 - 1
Starting with romset 11
Loading BIOS
FF FF FF
romset 11 - 1
Starting with romset 12
romset 12 - 1
Starting with romset 13
romset 13 - 1
Starting with romset 14
romset 14 - 1
Starting with romset 15
romset 15 - 1
Starting with romset 16
romset 16 - 1
Starting with romset 17
romset 17 - 1
Starting with romset 18
romset 18 - 1
Starting with romset 19
romset 19 - 1
Starting with romset 20
romset 20 - 1
Starting with romset 21
romset 21 - 1
Starting with romset 22
romset 22 - 1
Starting with romset 23
romset 23 - 1
Starting with romset 24
romset 24 - 1
Starting with romset 25
romset 25 - 1
Starting with romset 26
romset 26 - 1
Starting with romset 27
Failed to load ROM!
romset 27 - 0
Starting with romset 28
romset 28 - 1
Starting with romset 29
romset 29 - 1
Starting with romset 30
romset 30 - 1
Starting with romset 31
romset 31 - 1
Starting with romset 32
romset 32 - 1
Starting with romset 33
romset 33 - 1
Starting with romset 34
romset 34 - 1
Starting with romset 35
Load SIS496 ea ff
romset 35 - 1
Starting with romset 36
romset 36 - 1
Starting with romset 37
romset 37 - 1
Starting with romset 38
romset 38 - 1
Starting with romset 39
romset 39 - 1
Starting with romset 40
romset 40 - 1
Starting with romset 41
romset 41 - 1
Starting with romset 42
romset 42 - 1
Starting with romset 43
romset 43 - 1
Starting with romset 38
Starting with romset 38
timer_reset
Initting as Intel Premiere/PCI
io_init
Video_init 38 17
PCI burst=1 nonburst=4
hasfpu - 1
is486 - 1  544237928
cpu_set : unknown CPU type 544237928
Battler
Posts: 793
Joined: Sun 06 Jul, 2014 7:05 pm

Re: Cannot compile a working executable

Post by Battler »

This is the error:
cpu_set : unknown CPU type 544237928
You have an invalid CPU set.
teepean
Posts: 7
Joined: Sat 04 Feb, 2017 1:33 pm

Re: Cannot compile a working executable

Post by teepean »

Battler wrote:This is the error:
cpu_set : unknown CPU type 544237928
You have an invalid CPU set.
I haven't changed that so it is -march=i686.
User avatar
SarahWalker
Site Admin
Posts: 2054
Joined: Thu 24 Apr, 2014 4:18 pm

Re: Cannot compile a working executable

Post by SarahWalker »

He means in the pcem.cfg file. Try deleting your config file and running again.
Post Reply