dosbox breaks with MIPSpro, works with gcc
#1
dosbox breaks with MIPSpro, works with gcc
very interesting problem with dosbox - compile it with gcc and it appears to work fine, compile it with MIPSpro and basically dosbox is unusable.  The "mount" command just either doesn't work or it crashes dosbox.  neko thread about it https://web.archive.org/web/201302100909...hp?t=10361

I thought it might be some sort of optimization bug with MIPSpro, but compiling with -O0 makes no difference.  

I've been toying around with the MOUNT class in src/dos/dos_programs.cpp and the DOS_Shell::Execute function in src/shell/shell_misc.cpp
but I was not able to find anything that stuck out to me (plus I suck at this) .

Anyone have any ideas how to troubleshoot the MIPSpro build?


Here is how I compiled dosbox 0.74-2 and got the source to be both gcc and MIPSpro happy:
Code:
- needed beta/neko_gmp11-5.0.2-p1.tardist and libFLAC from freeware

- edit src/gui/sdlmain.cpp to remove the SDL_INIT_CDROM from stopping dosbox from starting (this is
probably the only real source edit that needs to be made to get the source to compile using gcc only):

  change: 
     if ( SDL_Init( SDL_INIT_AUDIO|SDL_INIT_VIDEO | /*SDL_INIT_TIMER |*/ SDL_INIT_CDROM
  to:
     if ( SDL_Init( SDL_INIT_AUDIO|SDL_INIT_VIDEO //| /*SDL_INIT_TIMER |*/ SDL_INIT_CDROM

- after the #includes in src/dos/cdrom_image.cpp, add the below to resolve "dirname" symbol: 

  #if defined(__sgi)
  extern long int lround(double x);
  #pragma optional lround
  #endif

- line 43 in src/cpu/cpu.cpp change:

   "#define CPU_LOG(...)" to "#define CPU_LOG"

- line 33 in include/ipx.h  change:

  "#define LOG_IPX(...)" to "#define LOG_IPX"

- define and undefine __c99 in src/hardware/mame/emu.h:

  #inlude "dosbox.h"
  #if defined(_MSC_VER) && (_MSC_VER  <= 1500) 
  #include <SDL.h>
  #else
  #if defined(__sgi)     //added for MIPSpro
  #define __c99          //added for MIPSpro
  #endif                 //added for MIPSpro
  #include <stdint.h>
  #if defined(__sgi)     //added for MIPSpro
  #undef __c99          //added for MIPSpro
  #endif                //added for MIPSpro
  #endif
  #include <math.h>
  #include <float.h>
  #include <stdlib.h>
  #include <memory.h>

############## gcc ##############
export CC=gcc
export CXX=g++
export CFLAGS="-std=gnu99 -g0 -O2 -mips4"
export CXXFLAGS="-g0 -O2 -mips4"
export CPPFLAGS="-I/usr/local/include -I/usr/nekoware/include"
export LDFLAGS=" -L/usr/local/lib -L/usr/local/lib32 -L/usr/nekoware/lib"
export LD_LIBRARYN32_PATH=/usr/local/lib:/usr/local/lib32:/usr/nekoware/lib

./configure -prefix=/usr/local

- add -lgen after libdos.a in src/Makefile to fix "dirname" unresolved symbol:

dosbox_LDADD = cpu/libcpu.a debug/libdebug.a dos/libdos.a -lgen fpu/libfpu.a hardware/libhardware.a gui/libgui.a \
               ints/libints.a misc/libmisc.a shell/libshell.a hardware/mame/libmame.a \
               hardware/serialport/libserial.a libs/gui_tk/libgui_tk.a

gmake


############## MIPSpro ##############
export CC=cc
export CXX=CC
export CFLAGS="-c99 -g0 -O2 -mips4"
export CXXFLAGS="-g0 -woff all -O2 -mips4"
export CPPFLAGS="-I/usr/local/include -I/usr/nekoware/include"
export LDFLAGS=" -L/usr/local/lib -L/usr/local/lib32 -L/usr/nekoware/lib -L/usr/freeware/lib32"
export LD_LIBRARYN32_PATH=/usr/local/lib:/usr/local/lib32:/usr/nekoware/lib:/usr/freeware/lib32

./configure -prefix=/usr/local

- edit src/Makefile to fix various unresolved symbol:

dosbox_LDADD = cpu/libcpu.a debug/libdebug.a dos/libdos.a -L/usr/lib32 -lgen -lm -lmx fpu/libfpu.a -lm hardware/libhardware.a -lm gui/libgui.a \
               ints/libints.a misc/libmisc.a shell/libshell.a hardware/mame/libmame.a \
               hardware/serialport/libserial.a libs/gui_tk/libgui_tk.a

-dosbox links the libraries it uses statically, so it uses "ar cru".  It appears there is no way to change this from the
./configure script or setting env variables like ./configure AR="CC" ARFLAGS="-ar -o"

-the hard written AR=ar and ARFLAGS=cru is fine for gcc, but it kills MIPSpro, so those flags need to be edited by hand
to read AR=CC and ARFLAGS="-ar -o"

gmake

btw one important point is the default keymapping is broken for IRIX, edit the autogenerated ~.dosbox/dosbox-0.74-2.conf file:


Code:
- need to change "usescancodes=true" to false in dosbox-0.74-2.conf to fix keyboard mapping
gijoe77
Tezro

Posts: 530
Threads: 32
Joined: Jun 2018
Find Reply
12-15-2018, 06:52 PM
#2
RE: dosbox breaks with MIPSpro, works with gcc
I've been digging a bit more into this, I'm putting "printf's" into places to see what's going on, and here is what I seem to think is going on.

It seems there is logic that checks if there are any strings/characters after the mount command, if not - just print what's currently mounted, otherwise do other stuff.  It seems no matter what I type after issuing the "mount" command, dosbox never see's any string of characters after the mount command.

for example here some code I've been focusing on - src/dos/dos_programs.cpp:

Code:
void Run(void) {
DOS_Drive * newdrive;char drive;
std::string label;
std::string umount;
std::string newz;

//Hack To allow long commandlines
ChangeToLongCmd();
/* Parse the command line */
/* if the command line is empty show current mounts */
if (!cmd->GetCount()) {
printf("above ListMounts\n"); /* I added this to debug the program - THIS ALWAYS PRINTS no matter what I type after mount!! */
ListMounts();
return;
}


so no matter what I type in dosbox, be it
Code:
mount D "/CDROM"
or
Code:
mount FU
 (note this should trigger a showusage() function)
I've been trying to figure out how to troubleshoot/debug 

Code:
cmd->GetCount()

and

Code:
 cmd->FindString()

that are also in the dos_programs.cpp file but I'm having a hard time, if anyone has any ideas let me know!
gijoe77
Tezro

Posts: 530
Threads: 32
Joined: Jun 2018
Find Reply
03-15-2019, 02:10 AM
#3
RE: dosbox breaks with MIPSpro, works with gcc
(03-15-2019, 02:10 AM)gijoe77 Wrote:  I've been digging a bit more into this, I'm putting "printf's" into places to see what's going on, and here is what I seem to think is going on.

It seems there is logic that checks if there are any strings/characters after the mount command, if not - just print what's currently mounted, otherwise do other stuff.  It seems no matter what I type after issuing the "mount" command, dosbox never see's any string of characters after the mount command.

That makes me wonder if there's a bug in the MIPSPro optimizer that's over-optimizing a function call right out of existence, thus returning a constant 0 instead of the actual number of arguments.  It looks like you've been compiling with -O2.  Have you tried lowering your optimization settings?

(03-15-2019, 02:10 AM)gijoe77 Wrote:  I've been trying to figure out how to troubleshoot/debug 

Code:
cmd->GetCount()

and

Code:
 cmd->FindString()

that are also in the dos_programs.cpp file but I'm having a hard time, if anyone has any ideas let me know!

While those functions are called from dos_programs.cpp, they're actually implemented in src/misc/setup.cpp, so you might try adding some printfs there for debugging.  It would be particularly interesting to see the value of cmds.size() in the GetCount function of setup.cpp.

SGI:  Indigo, Indigo2, Octane, Origin 300
Sun:  SPARCstation 20 (x2), Ultra 2, Blade 2500, T5240
HP:  9000/380, 425e, C8000
Digital: DECstation 5000/125
jpstewart
Octane

Posts: 63
Threads: 0
Joined: May 2018
Find Reply
03-16-2019, 07:15 PM
#4
RE: dosbox breaks with MIPSpro, works with gcc
I got the same 'mount' command behaviour with my MIPSPro built binaries and the fact that dosbox runs fine from a gcc build and not a MIPSPro build led me to believe that there is a gcc-ism not taken into account when compiling with non-gcc compilers.

The gcc-ism __attribute__((packed)) appears to be a prime candidate which i have encountered before and can be substituted with #pragma pack(1) in the MIPSPro preprocessor.

So i've cobbled up a patch file like this:
Code:
--- ./include/ipx.h.save    Sat Mar 16 22:31:25 2019
+++ ./include/ipx.h    Sat Mar 16 22:32:18 2019
@@ -66,7 +66,7 @@
 #define COMP_UNDELIVERABLE    0xfe
 #define COMP_HARDWAREERROR    0xff
 
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__sgi)
 #pragma pack(1)
 #endif
 
@@ -154,7 +154,7 @@
 void UnpackIP(PackedIP ipPack, IPaddress * ipAddr);
 void PackIP(IPaddress ipAddr, PackedIP *ipPack);
 
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__sgi)
 #pragma pack()
 #endif
 
--- ./include/paging.h.save    Sat Mar 16 22:28:01 2019
+++ ./include/paging.h    Sat Mar 16 22:28:50 2019
@@ -100,7 +100,7 @@
 void MEM_ResetPageHandler(Bitu phys_page, Bitu pages);
 
 
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__SGI)
 #pragma pack (1)
 #endif
 struct X86_PageEntryBlock{
@@ -130,7 +130,7 @@
     Bit32u        base:20;
 #endif
 } GCC_ATTRIBUTE(packed);
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__SGI)
 #pragma pack ()
 #endif
 
--- ./include/dos_inc.h.save    Sat Mar 16 22:21:57 2019
+++ ./include/dos_inc.h    Sat Mar 16 22:26:02 2019
@@ -30,7 +30,7 @@
 
 #include <stddef.h> //for offsetof
 
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__sgi)
 #pragma pack (1)
 #endif
 struct CommandTail{
@@ -37,7 +37,7 @@
   Bit8u count;                /* number of bytes returned */
   char buffer[127];             /* the buffer itself */
 } GCC_ATTRIBUTE(packed);
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__sgi)
 #pragma pack ()
 #endif
 
@@ -52,7 +52,7 @@
 };
 
 
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__sgi)
 #pragma pack (1)
 #endif
 union bootSector {
@@ -66,7 +66,7 @@
     } bootdata;
     Bit8u rawdata[512];
 } GCC_ATTRIBUTE(packed);
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__sgi)
 #pragma pack ()
 #endif
 
@@ -308,7 +308,7 @@
     Bit16u    FindEntryByHandle    (Bit8u handle);
             
 private:
-    #ifdef _MSC_VER
+    #if defined(_MSC_VER) || defined(__sgi)
     #pragma pack(1)
     #endif
     struct sPSP {
@@ -339,7 +339,7 @@
         Bit8u    fill_4[4];            /* unused */
         CommandTail cmdtail;        
     } GCC_ATTRIBUTE(packed);
-    #ifdef _MSC_VER
+    #if defined(_MSC_VER) || defined(__sgi)
     #pragma pack()
     #endif
     Bit16u    seg;
@@ -353,7 +353,7 @@
     void Clear(void);
     void LoadData(void);
     void SaveData(void);        /* Save it as an exec block */
-    #ifdef _MSC_VER
+    #if defined(_MSC_VER) || defined(__sgi)
     #pragma pack (1)
     #endif
     struct sOverlay {
@@ -368,7 +368,7 @@
         RealPt initsssp;
         RealPt initcsip;
     }GCC_ATTRIBUTE(packed);
-    #ifdef _MSC_VER
+    #if defined(_MSC_VER) || defined(__sgi)
     #pragma pack()
     #endif
     sExec exec;
@@ -392,7 +392,7 @@
     RealPt    GetPointer(void);
     Bit32u GetDeviceChain(void);
 
-    #ifdef _MSC_VER
+    #if defined(_MSC_VER) || defined(__sgi)
     #pragma pack(1)
     #endif
     struct sDIB {        
@@ -445,7 +445,7 @@
         Bit16u    startOfUMBChain;        //  0x66 segment of first UMB-MCB
         Bit16u    memAllocScanStart;        //  0x68 start paragraph for memory allocation
     } GCC_ATTRIBUTE(packed);
-    #ifdef _MSC_VER
+    #if defined(_MSC_VER) || defined(__sgi)
     #pragma pack ()
     #endif
     Bit16u    seg;
@@ -467,7 +467,7 @@
     Bit16u    GetDirID(void)                { return (Bit16u)sGet(sDTA,dirID); };
     Bit16u    GetDirIDCluster(void)        { return (Bit16u)sGet(sDTA,dirCluster); };
 private:
-    #ifdef _MSC_VER
+    #if defined(_MSC_VER) || defined(__sgi)
     #pragma pack(1)
     #endif
     struct sDTA {
@@ -484,7 +484,7 @@
         Bit32u size;
         char name[DOS_NAMELENGTH_ASCII];
     } GCC_ATTRIBUTE(packed);
-    #ifdef _MSC_VER
+    #if defined(_MSC_VER) || defined(__sgi)
     #pragma pack()
     #endif
 };
@@ -512,7 +512,7 @@
 private:
     bool extended;
     PhysPt real_pt;
-    #ifdef _MSC_VER
+    #if defined(_MSC_VER) || defined(__sgi)
     #pragma pack (1)
     #endif
     struct sFCB {
@@ -534,7 +534,7 @@
         Bit8u  cur_rec;            /* Current record in current block */
         Bit32u rndm;            /* Current relative record number */
     } GCC_ATTRIBUTE(packed);
-    #ifdef _MSC_VER
+    #if defined(_MSC_VER) || defined(__sgi)
     #pragma pack ()
     #endif
 };
@@ -551,7 +551,7 @@
     Bit16u GetSize(void) { return (Bit16u)sGet(sMCB,size);}
     Bit16u GetPSPSeg(void) { return (Bit16u)sGet(sMCB,psp_segment);}
 private:
-    #ifdef _MSC_VER
+    #if defined(_MSC_VER) || defined(__sgi)
     #pragma pack (1)
     #endif
     struct sMCB {
@@ -561,7 +561,7 @@
         Bit8u unused[3];
         Bit8u filename[8];
     } GCC_ATTRIBUTE(packed);
-    #ifdef _MSC_VER
+    #if defined(_MSC_VER) || defined(__sgi)
     #pragma pack ()
     #endif
 };
@@ -579,7 +579,7 @@
     
     
 private:
-    #ifdef _MSC_VER
+    #if defined(_MSC_VER) || defined(__sgi)
     #pragma pack (1)
     #endif
     struct sSDA {
@@ -599,7 +599,7 @@
         Bit8u extended_break_flag;     /* 0x17 extended break flag */
         Bit8u fill[2];            /* 0x18 flag: code page switching || flag: copy of previous byte in case of INT 24 Abort*/
     } GCC_ATTRIBUTE(packed);
-    #ifdef _MSC_VER
+    #if defined(_MSC_VER) || defined(__sgi)
     #pragma pack()
     #endif
 };
--- ./include/cpu.h.save    Sat Mar 16 22:29:22 2019
+++ ./include/cpu.h    Sat Mar 16 22:30:57 2019
@@ -223,7 +223,7 @@
 #define DESC_CODE_R_C_A                0x1e
 #define DESC_CODE_R_C_NA            0x1f
 
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__sgi)
 #pragma pack (1)
 #endif
 
@@ -320,7 +320,7 @@
     Bit32u ldt;                  /* The local descriptor table */
 } GCC_ATTRIBUTE(packed);
 
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__sgi)
 #pragma pack()
 #endif
 class Descriptor
--- ./src/dos/wnaspi32.h.save    Sat Mar 16 22:51:15 2019
+++ ./src/dos/wnaspi32.h    Sat Mar 16 22:53:02 2019
@@ -25,7 +25,7 @@
 #pragma option -a1
 #endif //__BORLANDC__
 
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__sgi)
 #pragma pack(1)
 #endif //__MSC_VER
 
@@ -343,7 +343,7 @@
 #pragma option -a.
 #endif //__BORLANDC__
 
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__sgi)
 #pragma pack()
 #endif //_MSC_VER
 
--- ./src/dos/dos_mscdex.cpp.save    Sat Mar 16 22:58:13 2019
+++ ./src/dos/dos_mscdex.cpp    Sat Mar 16 22:59:26 2019
@@ -70,7 +70,7 @@
     void    SetStrategy            (Bit16u ofs)    { sSave(sDeviceHeader,strategy,ofs);            };
 
 public:
-    #ifdef _MSC_VER
+    #if defined(_MSC_VER) || defined(__sgi)
     #pragma pack(1)
     #endif
     struct sDeviceHeader{
@@ -83,7 +83,7 @@
         Bit8u    driveLetter;
         Bit8u    numSubUnits;
     } GCC_ATTRIBUTE(packed) TDeviceHeader;
-    #ifdef _MSC_VER
+    #if defined(_MSC_VER) || defined(__sgi)
     #pragma pack()
     #endif
 };
--- ./src/dos/drives.h.save    Sat Mar 16 22:53:20 2019
+++ ./src/dos/drives.h    Sat Mar 16 22:55:03 2019
@@ -87,7 +87,7 @@
     } allocation;
 };
 
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__sgi)
 #pragma pack (1)
 #endif
 struct bootstrap {
@@ -140,7 +140,7 @@
     Bit8u  magic2; /* 0xaa */
 } GCC_ATTRIBUTE(packed);
 
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__sgi)
 #pragma pack ()
 #endif
 
@@ -232,7 +232,7 @@
     char driveLetter;
 };
 
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__sgi)
 #pragma pack (1)
 #endif
 struct isoPVD {
@@ -285,7 +285,7 @@
     Bit8u ident[222];
 } GCC_ATTRIBUTE(packed);
 
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__sgi)
 #pragma pack ()
 #endif
 
--- ./src/dos/dos_execute.cpp.save    Sat Mar 16 22:55:27 2019
+++ ./src/dos/dos_execute.cpp    Sat Mar 16 22:56:38 2019
@@ -30,7 +30,7 @@
 
 const char * RunningProgram="DOSBOX";
 
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__sgi)
 #pragma pack(1)
 #endif
 struct EXE_Header {
@@ -49,7 +49,7 @@
     Bit16u reloctable;
     Bit16u overlay;
 } GCC_ATTRIBUTE(packed);
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__sgi)
 #pragma pack()
 #endif
 
--- ./src/dos/dos_tables.cpp.save    Sat Mar 16 22:59:38 2019
+++ ./src/dos/dos_tables.cpp    Sat Mar 16 23:00:27 2019
@@ -23,7 +23,7 @@
 #include "dos_inc.h"
 #include "callback.h"
 
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__sgi)
 #pragma pack(1)
 #endif
 struct DOS_TableCase {    
@@ -31,7 +31,7 @@
     Bit8u chars[256];
 }
 GCC_ATTRIBUTE (packed);
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__sgi)
 #pragma pack ()
 #endif
 
--- ./src/dos/dos_files.cpp.save    Sat Mar 16 22:56:59 2019
+++ ./src/dos/dos_files.cpp    Sat Mar 16 22:57:53 2019
@@ -785,7 +785,7 @@
     Bitu index=0;
     Bit8u fill=' ';
 /* First get the old data from the fcb */
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__sgi)
 #pragma pack (1)
 #endif
     union {
@@ -796,7 +796,7 @@
         } GCC_ATTRIBUTE (packed) part;
         char full[DOS_FCBNAME];
     } fcb_name;
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__sgi)
 #pragma pack()
 #endif
     /* Get the old information from the previous fcb */
--- ./src/hardware/adlib.cpp.save    Sat Mar 16 23:01:24 2019
+++ ./src/hardware/adlib.cpp    Sat Mar 16 23:02:09 2019
@@ -99,7 +99,7 @@
 
 /* Raw DRO capture stuff */
 
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__sgi)
 #pragma pack (1)
 #endif
 
@@ -120,7 +120,7 @@
     Bit8u delayShift8;            /* 0x18, Bit8u (delay + 1)*256 */            
     Bit8u conversionTableSize;    /* 0x191, Bit8u Raw Conversion Table size */
 } GCC_ATTRIBUTE(packed);
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__sgi)
 #pragma pack()
 #endif
 /*
--- ./src/ints/xms.cpp.save    Sat Mar 16 23:06:22 2019
+++ ./src/ints/xms.cpp    Sat Mar 16 23:07:00 2019
@@ -81,7 +81,7 @@
     bool    free;
 };
 
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__sgi)
 #pragma pack (1)
 #endif
 struct XMS_MemMove{
@@ -98,7 +98,7 @@
     } dest;
 
 } GCC_ATTRIBUTE(packed);
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__sgi)
 #pragma pack ()
 #endif
 
--- ./src/ints/int10_vesa.cpp.save    Sat Mar 16 23:04:49 2019
+++ ./src/ints/int10_vesa.cpp    Sat Mar 16 23:05:37 2019
@@ -41,7 +41,7 @@
 static char string_productname[]="DOSBox - The DOS Emulator";
 static char string_productrev[]="DOSBox " VERSION;
 
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__sgi)
 #pragma pack (1)
 #endif
 struct MODE_INFO{
@@ -79,7 +79,7 @@
     Bit16u OffScreenMemSize;
     Bit8u Reserved[206];
 } GCC_ATTRIBUTE(packed);
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__sgi)
 #pragma pack()
 #endif
 

This seems to work, although i have used it in combination with -signed in the CFLAGS/CXXFLAGS so i'm not completely sure which one did it. More testing needed tomorrow. It could be kind of ironic though that a preprocessor command meant for the Windows environment can help out our IRIX build :-)

But with this effort i have a working mount command in dosbox and successfully installed Wolfenstein3D. My challengeS didn't like the sound calls to ALmedia libraries, so i had to disable that in dosbox.conf. The game runs at a glacial speed from my [email protected] over the network, so i'm sure it can do better on other machines.

The SDL i use is 1.2.15 with a modified configure script to enable the SDL_CDROM_DUMMY driver and disable SDL_CDROM_DISABLE which causes the dosbox exit with the CDROM init failure message. I'll post that later.
(This post was last modified: 03-17-2019, 01:19 AM by dexter1.)
dexter1
Global Moderator
******

Posts: 204
Threads: 10
Joined: May 2018
Find Reply
03-17-2019, 01:18 AM
#5
RE: dosbox breaks with MIPSpro, works with gcc
oh very cool dexter1!  This was actually the same issue that kept the mipspro build of prBoom-plus from working.

btw can you link your binary?  I'm still having some problems with my mipspro build and I would like to compare your working one.

BTW which version of dosbox did you patch?  The patchfile sort of failed for me so I went and patched the 0.74-2 files by hand.  FYI It looks like "packing" the "include/dos_inc.h" file fixes the "mount" issue.

The strange issue I had was if I used the "-g0" CFLAGS/CXXFLAGS, dosbox would hang if I typed "mount", but compiling with "-g" fixed the issue.

The main problem I'm having is I can run warcraft2 using the gcc build (sorry I only have warcraft2 to test currently), but when I try to launch it using the MIPSpro build I get
Code:
Exit to error: Illegal CallBack Called

Here is my binary if you want to see how it fairs on your system (mips4)
https://www.mediafire.com/file/aaz5mj5v0...pa.xz/file
gijoe77
Tezro

Posts: 530
Threads: 32
Joined: Jun 2018
Find Reply
03-20-2019, 11:04 PM
#6
RE: dosbox breaks with MIPSpro, works with gcc
Ah, you've made a build with the interprocedural optimizer, very nice. I'll test it tonight and will share my binary as well, but note that you also will have to substitute libSDL.so since i have made a fix which enables the dummy CDROM, so i'll send that as well.

If i'm generous i might even neko-package it and add it to my nekoware directory, so mips3 systems will reap the benefits of porting as well. I'll also distribute my patches to irisware.

The patch is indeed for 0.74-2 and i'm building with 6.5.22m and MPro 7.4.4, fully patched.
dexter1
Global Moderator
******

Posts: 204
Threads: 10
Joined: May 2018
Find Reply
03-21-2019, 09:19 AM
#7
RE: dosbox breaks with MIPSpro, works with gcc
Here is the build env I used for the IPA optimized binary (I just noticed I built it using -g0, but it seems to be the only binary that didn't die on "mount" using -g0)...

Code:
#############
# MIPSpro Optimized with
# :roundoff=2:div_split=ON:alias=typed,
# -Ofast=ip35, -IPA, -g0 and -lfastm (instead of -lm on link line)
# (not INLINE=all)
#############
# note - add "-show" in CFLAGS to see internal command lines

export CC=cc
export CXX=CC
export F77=f77
export CFLAGS='-c99 -g0 -O3 -Ofast=ip35 -mips4 -OPT:Olimit=0:roundoff=2:div_split=ON:alias=typed -TARG:platform=IP35:proc=r16000 -woff all -IPA'
export CXXFLAGS='-O3  -g0  -Ofast=ip35 -mips4 -OPT:Olimit=0:roundoff=2:div_split=ON:alias=typed  -TARG:platform=IP35:proc=r16000 -woff all -IPA'
export CPPFLAGS='-I/usr/local/include -I/usr/nekoware/include -I/usr/freeware/include'
export LDFLAGS='-mips4 -L/usr/local/lib -L/usr/local/lib32 -L/usr/nekoware/lib -L/usr/freeware/lib32 -rpath /usr/local/lib:/usr/local/lib32:/usr/nekoware/lib:/usr/lib32'
#export PKG_CONFIG_PATH='/usr/nekoware/lib/pkgconfig'
#export PKG_CONFIG_LIBDIR='/usr/nekoware/lib'
export LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib32:/usr/nekoware/lib:/usr/freeware/lib32
export LD_LIBRARYN32_PATH=/usr/local/lib:/usr/local/lib32:/usr/nekoware/lib:/usr/freeware/lib32
#export LD_LIBRARY64_PATH='/usr/nekoware/lib64'
#export GNOME2_DIR='/usr/nekoware'
export GNUMAKE=gmake
export MAKE=gmake
# prevent configure from adding -O and overriding -O3:
export OPT=-O3
export AR="CC -ar -o"
export ARFLAGS=""
export AR_FLAGS=""
export AS="as -n32"
# set libtool to verbose V=1
#export V=1
export MAKE=gmake
export PERL=/usr/local/bin/perl
export FREETYPE_CFLAGS="-I/usr/local/include/freetype2"
export FREETYPE_LIBS="-L/usr/local/lib -lfreetype"
export FONTCONFIG_PATH=/usr/local/etc/fonts/conf.d
export FONTCONFIG_FILE=/usr/local/etc/fonts/fonts.conf

./configure
gmake
gijoe77
Tezro

Posts: 530
Threads: 32
Joined: Jun 2018
Find Reply
03-21-2019, 06:21 PM


Forum Jump:


Users browsing this thread: 1 Guest(s)