OS2 World Community Forum

OS/2, eCS & ArcaOS - Technical => Programming => Topic started by: Mentore on November 05, 2024, 10:22:02 am

Title: DOSBox-x - infinite loop in configure/make
Post by: Mentore on November 05, 2024, 10:22:02 am
Hello all,
I'm having a real PITA trying to port DosBox-x under OS/2 with the latest tool (Gcc 9.2.0, the rest is up-to-date with ANPM netlabs repo).

I've issued the usual autoreconf and given a detailed configure script call with these options

./configure --prefix=/DosBox-x --enable-sdl2 --enable-force-menu-sdldraw --disable-sdlnet --disable-opengl --disable-alsatest --disable-alsa-midi --disable-libslirp --disable-x11

But then I notice that the created makefile contains a lot of calls to am<things> (which should be autotools) and starts configuring again, everytime restarting all the process with these starting lines

CDPATH="${ZSH_VERSION+.};" && cd . && /usr/bin/sh D:/Sviluppo/Sorgenti/dbox/dosb
ox/missing aclocal-1.16
 cd . && /usr/bin/sh D:/Sviluppo/Sorgenti/dbox/dosbox/missing automake-1.16 --fo
reign
CDPATH="${ZSH_VERSION+.};" && cd . && /usr/bin/sh D:/Sviluppo/Sorgenti/dbox/dosb
ox/missing autoconf
/usr/bin/sh ./config.status --recheck
running CONFIG_SHELL=/usr/bin/sh /usr/bin/sh ./configure --prefix=/DosBox-x --en
able-sdl2 --enable-force-menu-sdldraw --disable-sdlnet --disable-opengl --disabl
e-alsatest --disable-alsa-midi --disable-libslirp --disable-x11 CC=gcc.exe CFLAG
S=-O2 -g -DOS2 LDFLAGS=-Zomf -Zhigh-mem -Zmap -Zbin-files -Zargs-wild -Zargs-res
p LIBS=-lcx CPP=/usr/bin/cpp.exe CXX=gcc.exe CXXFLAGS=-O2 -g -DOS2 --no-create -
-no-recursion


What puzzles me is the continue reference (in bold) to config.status --recheck which starts again the configuration process. I'm searching in forums and other places but without any hint. I also tried to remove and force --recheck to disappear from the config* files and the created makefiles but without any result - it still keeps regenerating files which loops indefinitely.
Even trying to use bash instead of sh changes nothing.

I really can't understand what the problem may be - I remember in the past I got stuck on a similar issue with another project, but solved it modifying an already available makefile. Can't get a grip on this.

Mentore
Title: Re: DOSBox-x - infinite loop in configure/make
Post by: Dave Yeo on November 05, 2024, 05:07:47 pm
Better to edit configure.ac, about line 368 and remove the CXXFLAGS line, the -Zmt on the LDFLAGS line and add -Zomf -Zhigh-mem -Zbin-files there. There's also a hard dependency on sdl-net in configure.ac you might want to comment out.
Then run "bash autogen.sh" rather then sh autoreconf then try configure.
There's other emxism's in the source to watch out for as you go.
Title: Re: DOSBox-x - infinite loop in configure/make
Post by: Mentore on November 06, 2024, 08:01:25 am
Better to edit configure.ac, about line 368 and remove the CXXFLAGS line, the -Zmt on the LDFLAGS line and add -Zomf -Zhigh-mem -Zbin-files there. There's also a hard dependency on sdl-net in configure.ac you might want to comment out.
Then run "bash autogen.sh" rather then sh autoreconf then try configure.
There's other emxism's in the source to watch out for as you go.

You're a wonderful source of information, Dave.
On a side note - I've ported RetroArch (!!!) and it's basically working. Have to include network support (it seems heavily bound to IPv6, though) and Qt tools (already started, but there are some differences in the needed files which I didn't understand).

But - it - WORKS.

Mentore
Title: Re: DOSBox-x - infinite loop in configure/make
Post by: Mentore on November 06, 2024, 12:02:46 pm
Better to edit configure.ac, about line 368 and remove the CXXFLAGS line, the -Zmt on the LDFLAGS line and add -Zomf -Zhigh-mem -Zbin-files there. There's also a hard dependency on sdl-net in configure.ac you might want to comment out.
Then run "bash autogen.sh" rather then sh autoreconf then try configure.
There's other emxism's in the source to watch out for as you go.

OK, tried to modify it and no - still loops; make keeps calling configure. I'll have to delve deeper into this.
Mentore
Title: Re: DOSBox-x - infinite loop in configure/make
Post by: Dave Yeo on November 06, 2024, 05:56:27 pm
I usually start with simple configure arguments, in this case,
Code: [Select]
--prefix=/dosbox-x  --enable-sdl2  LDFLAGS="-Zomf -Zhigh-mem -lcx"

The -lcx is optional at this time.
The configure script does a good job of figuring out the environment and finishes. Often I do have to add more configure options but not here, at least yet.
Make fails in src/dos/dos_programs.c with a bunch of errors. I worked on this a bit a few weeks back and decided I didn't really have the skills to fix. There's old OS/2 code that needs sorting as some is EMXism's and other fixes needed.
Title: Re: DOSBox-x - infinite loop in configure/make
Post by: Dave Yeo on November 07, 2024, 06:25:13 am
Hmm, revisited this and compared to DosBox, no EMXism's besides the -Zmt which is unneeded and ignored as kilbc is always muti-threaded. There's just various bad coding I think as DosBox compiles fine, DosBox-X is very strict with its flags and various of the OS/2 parts fail to compile.
Title: Re: DOSBox-x - infinite loop in configure/make
Post by: Dave Yeo on November 07, 2024, 07:03:01 am
As an example. this code compiles fine with DosBox,
Code: [Select]
    FSINFO fsinfo;
    ULONG drivenumber = drive[0];
    if (drivenumber > 26) { // drive letter was lowercase
        drivenumber = drive[0] - 'a' + 1;
    }
    APIRET rc = DosQueryFSInfo(drivenumber, FSIL_VOLSER, &fsinfo, sizeof(FSINFO));
    if (rc == NO_ERROR) {
        bool cdrom = false;
Whereas with DosBox-x, the error is,
Code: [Select]
drive_cache.cpp: In member function 'void DOS_Drive_Cache::SetBaseDir(const char*, DOS_Drive*)':
drive_cache.cpp:159:32: error: cannot convert 'DOS_Drive' to 'ULONG' {aka 'long unsigned int'} in initialization
  159 |     ULONG drivenumber = drive[0];
      |                         ~~~~~~~^
      |                                |
      |                                DOS_Drive
drive_cache.cpp:161:32: error: no match for 'operator-' (operand types are 'DOS_Drive' and 'char')
  161 |         drivenumber = drive[0] - 'a' + 1;
      |                       ~~~~~~~~ ^ ~~~
      |                              |   |
      |                              |   char
      |                              DOS_Drive
Title: Re: DOSBox-x - infinite loop in configure/make
Post by: Mentore on November 07, 2024, 07:51:49 am
As an example. this code compiles fine with DosBox,
Code: [Select]
    FSINFO fsinfo;
    ULONG drivenumber = drive[0];
    if (drivenumber > 26) { // drive letter was lowercase
        drivenumber = drive[0] - 'a' + 1;
    }
    APIRET rc = DosQueryFSInfo(drivenumber, FSIL_VOLSER, &fsinfo, sizeof(FSINFO));
    if (rc == NO_ERROR) {
        bool cdrom = false;
Whereas with DosBox-x, the error is,
Code: [Select]
drive_cache.cpp: In member function 'void DOS_Drive_Cache::SetBaseDir(const char*, DOS_Drive*)':
drive_cache.cpp:159:32: error: cannot convert 'DOS_Drive' to 'ULONG' {aka 'long unsigned int'} in initialization
  159 |     ULONG drivenumber = drive[0];
      |                         ~~~~~~~^
      |                                |
      |                                DOS_Drive
drive_cache.cpp:161:32: error: no match for 'operator-' (operand types are 'DOS_Drive' and 'char')
  161 |         drivenumber = drive[0] - 'a' + 1;
      |                       ~~~~~~~~ ^ ~~~
      |                              |   |
      |                              |   char
      |                              DOS_Drive

Thanks a million for all of these contributions on your side, Dave. It seems DosBox-x is not viable - too bad, but hey, I did try at least 8)
Now back to RetroArch. I'll try to delve deeper into the network part and see if I can go a little further than my first attempt (there are some interesting TLS libraries, I shall try them all).

Mentore
Title: Re: DOSBox-x - infinite loop in configure/make
Post by: Jochen Schäfer on November 07, 2024, 09:01:42 am
In DOSBOX, drive is a char array, but on DOSBOX-X it seems to be a struct or object. So, there is some work to do.
Title: Re: DOSBox-x - infinite loop in configure/make
Post by: Lars on November 07, 2024, 01:59:58 pm
So why not like this:

bool cdrom = drive->isRemovable() ? true : false;

Because that is a method that the "DOS_Drive" class offers (should offer, it's a virtual method that needs to be filled "with life").
Then, you do not need all that other test nonsense to test for CDROM yes/no.
In the end, all that #ifdef'ed code is nonsense as "labellocal" is not used anywhere.
I think all the (outer) //Get Volume label #ifdef block can therefore go away.


Title: Re: DOSBox-x - infinite loop in configure/make
Post by: Dave Yeo on November 08, 2024, 04:33:16 am
In DOSBOX, drive is a char array, but on DOSBOX-X it seems to be a struct or object. So, there is some work to do.

Yes, I should have looked at drives.h
Title: Re: DOSBox-x - infinite loop in configure/make
Post by: Jochen Schäfer on November 08, 2024, 09:25:17 am
In DOSBOX, drive is a char array, but on DOSBOX-X it seems to be a struct or object. So, there is some work to do.

Yes, I should have looked at drives.h
Sure. I already thought, it wouldn't be a straight compile, because of all the native GUI element DOSBOX-X has.
Title: Re: DOSBox-x - infinite loop in configure/make
Post by: Mentore on January 15, 2025, 03:15:51 pm
Hello all,
I'm having a real PITA trying to port DosBox-x under OS/2 with the latest tool (Gcc 9.2.0, the rest is up-to-date with ANPM netlabs repo).
-- snip --

Hi everyone, I finally found the problem! Thought it would be useful to know.
Fact is, make checks wether configure script is more recent than configure.ac and - in case - it recreates the configure script calling --recheck on config.status. BUT: I didn't notice thay my VM was setting a fixed system date at october 24, so every time I rebuilt the script it would still be older than configure.ac... Thus the loop.

I've issued a DATE command to reset time and now I'm compiling an Atari 800 emulator on SDL. Gonna let you know what's happening and maybe even give another try to Dosbox-x.

Mentore
Title: Re: DOSBox-x - infinite loop in configure/make
Post by: j on January 16, 2025, 09:51:48 pm
Cool, so the latest dosbox-x works fine on Arca then?
Title: Re: DOSBox-x - infinite loop in configure/make
Post by: Mentore on January 17, 2025, 10:08:22 am
Cool, so the latest dosbox-x works fine on Arca then?

Hey J,
currently I haven't still tried again with Dosbox-x. As Dave said, there are many other problems with it so this is just one of them (and only on my VM, I'm fairly sure Dave has his PC's clock running fine).

I'm in the process of reorganizing all the source code I have on my personal Github repository, together with some sponsoring information to keep going with OS/2 related software (ports and native).

Mentore
Title: Re: DOSBox-x - infinite loop in configure/make
Post by: Jochen Schäfer on January 17, 2025, 10:14:31 am
Cool, so the latest dosbox-x works fine on Arca then?
Certainly not, because DOSBOX-X adds a lot native GUI, which has to be programmed.
Title: Re: DOSBox-x - infinite loop in configure/make
Post by: j on January 17, 2025, 12:46:49 pm
Thank you Mentore, fingers crossed!
Title: Re: DOSBox-x - infinite loop in configure/make
Post by: Jochen Schäfer on March 26, 2025, 11:06:58 am
Hi.

I have succesfully build and run a port of DOSBOX-X.

I'm in the process of feeding PRs to upstream. After that, I will build some binaries.

Stay tuned.

PS: Classicube is not forgotten ;-)
Title: Re: DOSBox-x - infinite loop in configure/make
Post by: Pete on March 27, 2025, 12:02:00 am
Hi Jochen

Sounds promising  :-)


Regards

Pete
Title: Re: DOSBox-x - infinite loop in configure/make
Post by: Jochen Schäfer on April 19, 2025, 02:53:50 pm
Hi guys.

I'm getting through the open issues very well. I think, I can release a test build soon.
But I have some open issues, for which I couldn't find documentation:


If someone has some answers or pointers for frther investigations, it would help for this port.
Title: Re: DOSBox-x - infinite loop in configure/make
Post by: Jochen Schäfer on April 19, 2025, 03:07:36 pm
Hi guys.

I'm getting through the open issues very well. I think, I can release a test build soon.
But I have some open issues, for which I couldn't find documentation:
  • Is it possible to use WinFileDlg to select a directory? I can filter directories, but I can't select them.
  • Can I manipulate the style values of a dialog control at runtime, eg. in WM_INITDLG?
  • The API documentation alludes to being able to build a dialog description in memory via DLGTEMPLATE and DLGITEM structures, but doesn't show how nor documents the structures at all. Does someone know some sample code for this process?
  • Can someone recommend some documentation or development books for OS/2 console programming?
  • Optional: Do we have a color chooser dialog (I know nothing official), or some code how to do it? Or, would it suffice to enter the code as a string with the hex code pattern '#RRGGBB'?


If someone has some answers or pointers for frther investigations, it would help for this port.
Title: Re: DOSBox-x - infinite loop in configure/make
Post by: Pete on April 19, 2025, 03:20:42 pm
Hi Jochen

I'm not a "c" programmer but looking through pm2.inf (from os/2 toolkit) it looks like you can set the initial directory in the FILEDLG structure:-
   char pszFullFile[CCHMAXPATH] = "*.C";  /* File filter string */       
I would change the above to the following to see if it works
   char pszFullFile[CCHMAXPATH] = "Drive:\Path\*.*"; /*Set to required Drive:\Path */

eg:
  char pszFullFile[CCHMAXPATH] = "C:\Programs\*.*"; 


Regards

Pete

 
Title: Re: DOSBox-x - infinite loop in configure/make
Post by: Neil Waldhauer on April 19, 2025, 04:09:04 pm
In the FILEDLG structure, set the usDlgId member to IDDLG_DIRECTORY to get a dialog that can select directories.
Title: Re: DOSBox-x - infinite loop in configure/make
Post by: Jochen Schäfer on April 19, 2025, 10:52:54 pm
In the FILEDLG structure, set the usDlgId member to IDDLG_DIRECTORY to get a dialog that can select directories.
Thanks, that's what I needed. I will try it in a few days.
Title: Re: DOSBox-x - infinite loop in configure/make
Post by: Jochen Schäfer on April 20, 2025, 08:32:26 am
In the FILEDLG structure, set the usDlgId member to IDDLG_DIRECTORY to get a dialog that can select directories.
Thanks, that's what I needed. I will try it in a few days.
Hi, Neil.

Can you tell me the value of IDDLG_DIRECTORY? I can't find it in the OS/2 toolkit or the EMX headers.
Title: Re: DOSBox-x - infinite loop in configure/make
Post by: Lars on April 20, 2025, 02:30:10 pm
Just a guess: try DID_DIRECTORY_SELECTED.
Title: Re: DOSBox-x - infinite loop in configure/make
Post by: Neil Waldhauer on April 21, 2025, 04:38:08 am
NOTES: this code taken from Dr. Dialog

#define IDDLG_DIRECTORY             5500