Compilation errors in cpu.cpp on 0.74

Developer's Forum, for discussion of bugs, code, and other developmental aspects of DOSBox.

Compilation errors in cpu.cpp on 0.74

Postby xjas » 2017-9-21 @ 18:45

I'm trying to compile DOSBox 0.74 with this patch applied (the final update posted on page 3.) I'm using the version of the source straight off dosbox.com/downloads. I get a ton of errors, mostly in cpu.cpp, but also dos_inc.h. Neither of those files are altered by the patch BTW.

Code: Select all
make
make  all-recursive
make[1]: Entering directory '/home/jay/Downloads/dosbox-0.74'
Making all in src
make[2]: Entering directory '/home/jay/Downloads/dosbox-0.74/src'
Making all in cpu
make[3]: Entering directory '/home/jay/Downloads/dosbox-0.74/src/cpu'
Making all in core_full
make[4]: Entering directory '/home/jay/Downloads/dosbox-0.74/src/cpu/core_full'
make[4]: Nothing to be done for 'all'.
make[4]: Leaving directory '/home/jay/Downloads/dosbox-0.74/src/cpu/core_full'
Making all in core_normal
make[4]: Entering directory '/home/jay/Downloads/dosbox-0.74/src/cpu/core_normal'
make[4]: Nothing to be done for 'all'.
make[4]: Leaving directory '/home/jay/Downloads/dosbox-0.74/src/cpu/core_normal'
Making all in core_dyn_x86
make[4]: Entering directory '/home/jay/Downloads/dosbox-0.74/src/cpu/core_dyn_x86'
make[4]: Nothing to be done for 'all'.
make[4]: Leaving directory '/home/jay/Downloads/dosbox-0.74/src/cpu/core_dyn_x86'
Making all in core_dynrec
make[4]: Entering directory '/home/jay/Downloads/dosbox-0.74/src/cpu/core_dynrec'
make[4]: Nothing to be done for 'all'.
make[4]: Leaving directory '/home/jay/Downloads/dosbox-0.74/src/cpu/core_dynrec'
make[4]: Entering directory '/home/jay/Downloads/dosbox-0.74/src/cpu'
g++ -DHAVE_CONFIG_H -I. -I../..  -I../../include -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT  -g -O2  -MT callback.o -MD -MP -MF .deps/callback.Tpo -c -o callback.o callback.cpp
callback.cpp: In function ‘Bitu CALLBACK_SetupExtra(Bitu, Bitu, PhysPt, bool)’:
callback.cpp:435:47: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘Bitu {aka long unsigned int}’ [-Wformat=]
   E_Exit("CALLBACK:Setup:Illegal type %d",type);
                                               ^
mv -f .deps/callback.Tpo .deps/callback.Po
g++ -DHAVE_CONFIG_H -I. -I../..  -I../../include -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT  -g -O2  -MT cpu.o -MD -MP -MF .deps/cpu.Tpo -c -o cpu.o cpu.cpp
In file included from ../../include/programs.h:28:0,
                 from cpu.cpp:29:
../../include/dos_inc.h: In member function ‘void DOS_MCB::SetFileName(const char*)’:
../../include/dos_inc.h:543:78: error: expected primary-expression before ‘,’ token
  void SetFileName(char const * const _name) { MEM_BlockWrite(pt+offsetof(sMCB,filename),_name,8); }
                                                                              ^
../../include/dos_inc.h:543:79: error: ‘filename’ was not declared in this scope
  void SetFileName(char const * const _name) { MEM_BlockWrite(pt+offsetof(sMCB,filename),_name,8); }
                                                                               ^
../../include/dos_inc.h:543:87: error: ‘offsetof’ was not declared in this scope
  void SetFileName(char const * const _name) { MEM_BlockWrite(pt+offsetof(sMCB,filename),_name,8); }
                                                                                       ^
../../include/dos_inc.h: In member function ‘void DOS_MCB::GetFileName(char*)’:
../../include/dos_inc.h:544:71: error: expected primary-expression before ‘,’ token
  void GetFileName(char * const _name) { MEM_BlockRead(pt+offsetof(sMCB,filename),_name,8);_name[8]=0;}
                                                                       ^
../../include/dos_inc.h:544:72: error: ‘filename’ was not declared in this scope
  void GetFileName(char * const _name) { MEM_BlockRead(pt+offsetof(sMCB,filename),_name,8);_name[8]=0;}
                                                                        ^
../../include/dos_inc.h:544:80: error: ‘offsetof’ was not declared in this scope
  void GetFileName(char * const _name) { MEM_BlockRead(pt+offsetof(sMCB,filename),_name,8);_name[8]=0;}
                                                                                ^
cpu.cpp: In member function ‘void TaskStateSegment::Get_SSx_ESPx(Bitu, Bitu&, Bitu&)’:
cpu.cpp:294:37: error: expected primary-expression before ‘,’ token
    PhysPt where=base+offsetof(TSS_32,esp0)+level*8;
                                     ^
cpu.cpp:294:38: error: ‘esp0’ was not declared in this scope
    PhysPt where=base+offsetof(TSS_32,esp0)+level*8;
                                      ^
cpu.cpp:294:42: error: ‘offsetof’ was not declared in this scope
    PhysPt where=base+offsetof(TSS_32,esp0)+level*8;
                                          ^
cpu.cpp:298:37: error: expected primary-expression before ‘,’ token
    PhysPt where=base+offsetof(TSS_16,sp0)+level*4;
                                     ^
cpu.cpp:298:38: error: ‘sp0’ was not declared in this scope
    PhysPt where=base+offsetof(TSS_16,sp0)+level*4;
                                      ^
cpu.cpp:298:41: error: ‘offsetof’ was not declared in this scope
    PhysPt where=base+offsetof(TSS_16,sp0)+level*4;
                                         ^
cpu.cpp: In function ‘bool CPU_SwitchTask(Bitu, TSwitchType, Bitu)’:
cpu.cpp:348:86: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘Bitu {aka long unsigned int}’ [-Wformat=]
   E_Exit("Illegal TSS for switch, selector=%x, switchtype=%x",new_tss_selector,tstype);
                                                                                      ^
cpu.cpp:362:49: error: expected primary-expression before ‘,’ token
   new_cr3=mem_readd(new_tss.base+offsetof(TSS_32,cr3));
                                                 ^
cpu.cpp:362:50: error: ‘cr3’ was not declared in this scope
   new_cr3=mem_readd(new_tss.base+offsetof(TSS_32,cr3));
                                                  ^
cpu.cpp:362:53: error: ‘offsetof’ was not declared in this scope
   new_cr3=mem_readd(new_tss.base+offsetof(TSS_32,cr3));
                                                     ^
cpu.cpp:363:49: error: expected primary-expression before ‘,’ token
   new_eip=mem_readd(new_tss.base+offsetof(TSS_32,eip));
                                                 ^
cpu.cpp:363:50: error: ‘eip’ was not declared in this scope
   new_eip=mem_readd(new_tss.base+offsetof(TSS_32,eip));
                                                  ^
cpu.cpp:364:52: error: expected primary-expression before ‘,’ token
   new_eflags=mem_readd(new_tss.base+offsetof(TSS_32,eflags));
                                                    ^
cpu.cpp:364:53: error: ‘eflags’ was not declared in this scope
   new_eflags=mem_readd(new_tss.base+offsetof(TSS_32,eflags));
                                                     ^
cpu.cpp:365:49: error: expected primary-expression before ‘,’ token
   new_eax=mem_readd(new_tss.base+offsetof(TSS_32,eax));
                                                 ^
cpu.cpp:365:50: error: ‘eax’ was not declared in this scope
   new_eax=mem_readd(new_tss.base+offsetof(TSS_32,eax));
                                                  ^
cpu.cpp:366:49: error: expected primary-expression before ‘,’ token
   new_ecx=mem_readd(new_tss.base+offsetof(TSS_32,ecx));
                                                 ^
cpu.cpp:366:50: error: ‘ecx’ was not declared in this scope
   new_ecx=mem_readd(new_tss.base+offsetof(TSS_32,ecx));
                                                  ^
cpu.cpp:367:49: error: expected primary-expression before ‘,’ token
   new_edx=mem_readd(new_tss.base+offsetof(TSS_32,edx));
                                                 ^
cpu.cpp:367:50: error: ‘edx’ was not declared in this scope
   new_edx=mem_readd(new_tss.base+offsetof(TSS_32,edx));
                                                  ^
cpu.cpp:368:49: error: expected primary-expression before ‘,’ token
   new_ebx=mem_readd(new_tss.base+offsetof(TSS_32,ebx));
                                                 ^
cpu.cpp:368:50: error: ‘ebx’ was not declared in this scope
   new_ebx=mem_readd(new_tss.base+offsetof(TSS_32,ebx));
                                                  ^
cpu.cpp:369:49: error: expected primary-expression before ‘,’ token
   new_esp=mem_readd(new_tss.base+offsetof(TSS_32,esp));
                                                 ^
cpu.cpp:369:50: error: ‘esp’ was not declared in this scope
   new_esp=mem_readd(new_tss.base+offsetof(TSS_32,esp));
                                                  ^
cpu.cpp:370:49: error: expected primary-expression before ‘,’ token
   new_ebp=mem_readd(new_tss.base+offsetof(TSS_32,ebp));
                                                 ^
cpu.cpp:370:50: error: ‘ebp’ was not declared in this scope
   new_ebp=mem_readd(new_tss.base+offsetof(TSS_32,ebp));
                                                  ^
cpu.cpp:371:49: error: expected primary-expression before ‘,’ token
   new_edi=mem_readd(new_tss.base+offsetof(TSS_32,edi));
                                                 ^
cpu.cpp:371:50: error: ‘edi’ was not declared in this scope
   new_edi=mem_readd(new_tss.base+offsetof(TSS_32,edi));
                                                  ^
cpu.cpp:372:49: error: expected primary-expression before ‘,’ token
   new_esi=mem_readd(new_tss.base+offsetof(TSS_32,esi));
                                                 ^
cpu.cpp:372:50: error: ‘esi’ was not declared in this scope
   new_esi=mem_readd(new_tss.base+offsetof(TSS_32,esi));
                                                  ^
cpu.cpp:374:48: error: expected primary-expression before ‘,’ token
   new_es=mem_readw(new_tss.base+offsetof(TSS_32,es));
                                                ^
cpu.cpp:375:48: error: expected primary-expression before ‘,’ token
   new_cs=mem_readw(new_tss.base+offsetof(TSS_32,cs));
                                                ^
cpu.cpp:376:48: error: expected primary-expression before ‘,’ token
   new_ss=mem_readw(new_tss.base+offsetof(TSS_32,ss));
                                                ^
cpu.cpp:377:48: error: expected primary-expression before ‘,’ token
   new_ds=mem_readw(new_tss.base+offsetof(TSS_32,ds));
                                                ^
cpu.cpp:378:48: error: expected primary-expression before ‘,’ token
   new_fs=mem_readw(new_tss.base+offsetof(TSS_32,fs));
                                                ^
cpu.cpp:379:48: error: expected primary-expression before ‘,’ token
   new_gs=mem_readw(new_tss.base+offsetof(TSS_32,gs));
                                                ^
cpu.cpp:380:49: error: expected primary-expression before ‘,’ token
   new_ldt=mem_readw(new_tss.base+offsetof(TSS_32,ldt));
                                                 ^
cpu.cpp:380:50: error: ‘ldt’ was not declared in this scope
   new_ldt=mem_readw(new_tss.base+offsetof(TSS_32,ldt));
                                                  ^
cpu.cpp:403:42: error: expected primary-expression before ‘,’ token
   mem_writed(cpu_tss.base+offsetof(TSS_32,eflags),old_flags);
                                          ^
cpu.cpp:403:43: error: ‘eflags’ was not declared in this scope
   mem_writed(cpu_tss.base+offsetof(TSS_32,eflags),old_flags);
                                           ^
cpu.cpp:403:49: error: ‘offsetof’ was not declared in this scope
   mem_writed(cpu_tss.base+offsetof(TSS_32,eflags),old_flags);
                                                 ^
cpu.cpp:404:42: error: expected primary-expression before ‘,’ token
   mem_writed(cpu_tss.base+offsetof(TSS_32,eip),old_eip);
                                          ^
cpu.cpp:404:43: error: ‘eip’ was not declared in this scope
   mem_writed(cpu_tss.base+offsetof(TSS_32,eip),old_eip);
                                           ^
cpu.cpp:406:42: error: expected primary-expression before ‘,’ token
   mem_writed(cpu_tss.base+offsetof(TSS_32,eax),reg_eax);
                                          ^
cpu.cpp:406:43: error: ‘eax’ was not declared in this scope
   mem_writed(cpu_tss.base+offsetof(TSS_32,eax),reg_eax);
                                           ^
cpu.cpp:407:42: error: expected primary-expression before ‘,’ token
   mem_writed(cpu_tss.base+offsetof(TSS_32,ecx),reg_ecx);
                                          ^
cpu.cpp:407:43: error: ‘ecx’ was not declared in this scope
   mem_writed(cpu_tss.base+offsetof(TSS_32,ecx),reg_ecx);
                                           ^
cpu.cpp:408:42: error: expected primary-expression before ‘,’ token
   mem_writed(cpu_tss.base+offsetof(TSS_32,edx),reg_edx);
                                          ^
cpu.cpp:408:43: error: ‘edx’ was not declared in this scope
   mem_writed(cpu_tss.base+offsetof(TSS_32,edx),reg_edx);
                                           ^
cpu.cpp:409:42: error: expected primary-expression before ‘,’ token
   mem_writed(cpu_tss.base+offsetof(TSS_32,ebx),reg_ebx);
                                          ^
cpu.cpp:409:43: error: ‘ebx’ was not declared in this scope
   mem_writed(cpu_tss.base+offsetof(TSS_32,ebx),reg_ebx);
                                           ^
cpu.cpp:410:42: error: expected primary-expression before ‘,’ token
   mem_writed(cpu_tss.base+offsetof(TSS_32,esp),reg_esp);
                                          ^
cpu.cpp:410:43: error: ‘esp’ was not declared in this scope
   mem_writed(cpu_tss.base+offsetof(TSS_32,esp),reg_esp);
                                           ^
cpu.cpp:411:42: error: expected primary-expression before ‘,’ token
   mem_writed(cpu_tss.base+offsetof(TSS_32,ebp),reg_ebp);
                                          ^
cpu.cpp:411:43: error: ‘ebp’ was not declared in this scope
   mem_writed(cpu_tss.base+offsetof(TSS_32,ebp),reg_ebp);
                                           ^
cpu.cpp:412:42: error: expected primary-expression before ‘,’ token
   mem_writed(cpu_tss.base+offsetof(TSS_32,esi),reg_esi);
                                          ^
cpu.cpp:412:43: error: ‘esi’ was not declared in this scope
   mem_writed(cpu_tss.base+offsetof(TSS_32,esi),reg_esi);
                                           ^
cpu.cpp:413:42: error: expected primary-expression before ‘,’ token
   mem_writed(cpu_tss.base+offsetof(TSS_32,edi),reg_edi);
                                          ^
cpu.cpp:413:43: error: ‘edi’ was not declared in this scope
   mem_writed(cpu_tss.base+offsetof(TSS_32,edi),reg_edi);
                                           ^
cpu.cpp:415:42: error: expected primary-expression before ‘,’ token
   mem_writed(cpu_tss.base+offsetof(TSS_32,es),SegValue(es));
                                          ^
cpu.cpp:416:42: error: expected primary-expression before ‘,’ token
   mem_writed(cpu_tss.base+offsetof(TSS_32,cs),SegValue(cs));
                                          ^
cpu.cpp:417:42: error: expected primary-expression before ‘,’ token
   mem_writed(cpu_tss.base+offsetof(TSS_32,ss),SegValue(ss));
                                          ^
cpu.cpp:418:42: error: expected primary-expression before ‘,’ token
   mem_writed(cpu_tss.base+offsetof(TSS_32,ds),SegValue(ds));
                                          ^
cpu.cpp:419:42: error: expected primary-expression before ‘,’ token
   mem_writed(cpu_tss.base+offsetof(TSS_32,fs),SegValue(fs));
                                          ^
cpu.cpp:420:42: error: expected primary-expression before ‘,’ token
   mem_writed(cpu_tss.base+offsetof(TSS_32,gs),SegValue(gs));
                                          ^
cpu.cpp:428:43: error: expected primary-expression before ‘,’ token
    mem_writed(new_tss.base+offsetof(TSS_32,back),cpu_tss.selector);
                                           ^
cpu.cpp:428:44: error: ‘back’ was not declared in this scope
    mem_writed(new_tss.base+offsetof(TSS_32,back),cpu_tss.selector);
                                            ^
cpu.cpp:428:48: error: ‘offsetof’ was not declared in this scope
    mem_writed(new_tss.base+offsetof(TSS_32,back),cpu_tss.selector);
                                                ^
cpu.cpp:430:43: error: expected primary-expression before ‘,’ token
    mem_writew(new_tss.base+offsetof(TSS_16,back),cpu_tss.selector);
                                           ^
cpu.cpp:430:44: error: ‘back’ was not declared in this scope
    mem_writew(new_tss.base+offsetof(TSS_16,back),cpu_tss.selector);
                                            ^
cpu.cpp:430:48: error: ‘offsetof’ was not declared in this scope
    mem_writew(new_tss.base+offsetof(TSS_16,back),cpu_tss.selector);
                                                ^
cpu.cpp:502:50: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘Bitu {aka long unsigned int}’ [-Wformat=]
    E_Exit("Task switch CS Type %d",cs_desc.Type());
                                                  ^
cpu.cpp: In function ‘void CPU_Interrupt(Bitu, Bitu, Bitu)’:
cpu.cpp:724:89: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘Bitu {aka long unsigned int}’ [-Wformat=]
      E_Exit("INT:Gate Selector points to illegal descriptor with type %x",cs_desc.Type());
                                                                                         ^
cpu.cpp:754:66: warning: format ‘%X’ expects argument of type ‘unsigned int’, but argument 2 has type ‘Bitu {aka long unsigned int}’ [-Wformat=]
    E_Exit("Illegal descriptor type %X for int %X",gate.Type(),num);
                                                                  ^
cpu.cpp:754:66: warning: format ‘%X’ expects argument of type ‘unsigned int’, but argument 3 has type ‘Bitu {aka long unsigned int}’ [-Wformat=]
cpu.cpp: In function ‘void CPU_IRET(bool, Bitu)’:
cpu.cpp:901:61: warning: format ‘%X’ expects argument of type ‘unsigned int’, but argument 2 has type ‘Bitu {aka long unsigned int}’ [-Wformat=]
    E_Exit("IRET:Illegal descriptor type %X",n_cs_desc.Type());
                                                             ^
cpu.cpp: In function ‘void CPU_JMP(bool, Bitu, Bitu, Bitu)’:
cpu.cpp:1058:55: warning: format ‘%X’ expects argument of type ‘unsigned int’, but argument 2 has type ‘Bitu {aka long unsigned int}’ [-Wformat=]
    E_Exit("JMP Illegal descriptor type %X",desc.Type());
                                                       ^
cpu.cpp: In function ‘void CPU_CALL(bool, Bitu, Bitu, Bitu)’:
cpu.cpp:1294:60: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 2 has type ‘Bitu {aka long unsigned int}’ [-Wformat=]
    E_Exit("CALL:Descriptor type %x unsupported",call.Type());
                                                            ^
cpu.cpp: In function ‘void CPU_RET(bool, Bitu, Bitu)’:
cpu.cpp:1352:61: warning: format ‘%X’ expects argument of type ‘unsigned int’, but argument 2 has type ‘Bitu {aka long unsigned int}’ [-Wformat=]
     E_Exit("RET from illegal descriptor type %X",desc.Type());
                                                             ^
cpu.cpp:1397:61: warning: format ‘%X’ expects argument of type ‘unsigned int’, but argument 2 has type ‘Bitu {aka long unsigned int}’ [-Wformat=]
     E_Exit("RET from illegal descriptor type %X",desc.Type());  // or #GP(selector)
                                                             ^
cpu.cpp: In function ‘bool CPU_LTR(Bitu)’:
cpu.cpp:1508:80: warning: format ‘%X’ expects argument of type ‘unsigned int’, but argument 2 has type ‘Bitu {aka long unsigned int}’ [-Wformat=]
   if (!cpu_tss.SetSelector(selector)) E_Exit("LTR failed, selector=%X",selector);
                                                                                ^
Makefile:288: recipe for target 'cpu.o' failed
make[4]: *** [cpu.o] Error 1
make[4]: Leaving directory '/home/jay/Downloads/dosbox-0.74/src/cpu'
Makefile:308: recipe for target 'all-recursive' failed
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory '/home/jay/Downloads/dosbox-0.74/src/cpu'
Makefile:328: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory '/home/jay/Downloads/dosbox-0.74/src'
Makefile:277: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/jay/Downloads/dosbox-0.74'
Makefile:215: recipe for target 'all' failed
make: *** [all] Error 2


I tried this on two different machines, one running Fedora 21 and the other running Mint 18.2 & got the same errors. I have successfully compiled SVN versions multiple times on the same two machines; nothing has been changed in my environment.

What do I need to do to get 0.74 to compile?

(Alternately, can I apply the pinball patch to the latest SVN without alterations?)
xjas
Oldbie
 
Posts: 895
Joined: 2015-9-07 @ 02:29

Re: Compilation errors in cpu.cpp on 0.74

Postby Qbix » 2017-9-22 @ 08:29

you need to add one patch to 0.74 in order for it to compile on modern compilers.
I don't have it at hand, but it's this one:
https://anonscm.debian.org/cgit/collab- ... 3691.patch
Water flows down the stream
How to ask questions the smart way!
User avatar
Qbix
DOSBox Author
 
Posts: 10375
Joined: 2002-11-27 @ 14:50
Location: Fryslan


Return to DOSBox Development

Who is online

Users browsing this forum: No registered users and 1 guest