How to compile under DosEMU?

DOS specific questions.
angros47
Posts: 1305
Joined: Jun 21, 2005 19:04

How to compile under DosEMU?

Postby angros47 » Oct 01, 2017 20:27

At first, I got the error that TARGET_OS is not specified. I guess that in the makefile, the line:

Code: Select all

    ifeq ($(uname),MS-DOS)


should be

Code: Select all

    ifneq ($(findstring DOS,$(uname)),)


But still I keep getting errors... for example, if I compile with "make gfxlib2", the file "gfx_paletteget64.o" is not created and linking is impossible.
dkl
Site Admin
Posts: 3166
Joined: Jul 28, 2005 14:45
Location: Germany

Re: How to compile under DosEMU?

Postby dkl » Oct 02, 2017 17:20

I've only ever tested DJGPP builds on Windows or cross-compiling from Ubuntu, but... what errors do you get? Is there a gcc compilation error on src/gfxlib2/gfx_paletteget64.c, or a linking problem later when compiling FB programs using the gfxlib?
angros47
Posts: 1305
Joined: Jun 21, 2005 19:04

Re: How to compile under DosEMU?

Postby angros47 » Oct 02, 2017 18:50

I get no error. Just, the file gfx_paletteget64.o is not created, and I got an error reporting the missing file during linking. I also get some weird errors, like:

Code: Select all

src/compiler/obj/parser-expr-binary.o:fake:(.text+0x2ac): undefined reference to
 \ASTNEWBOP'
src/compiler/obj/parser-expr-binary.o:fake:(.text+0x37d): undefined reference to
 \ASTNEWBOP'
src/compiler/obj/parser-expr-binary.o:fake:(.text+0x44d): undefined reference to
 \ASTNEWBOP'
src/compiler/obj/parser-expr-binary.o:fake:(.text+0x5a1): more undefined referen
ces to \ASTNEWBOP' follow
src/compiler/obj/parser-quirk.o:fake:(.text+0x151): undefined reference to \CDAT
ASTMT'
src/compiler/obj/rtl-error.o:fake:(.text+0xad): undefined reference to \ASTNEWBO
P'
src/compiler/obj/rtl-file.o:fake:(.text+0x75f): undefined reference to \ASTNEWBO
P'
src/compiler/obj/rtl-file.o:fake:(.text+0xc6e): undefined reference to \ASTNEWBO
P'
src/compiler/obj/rtl-system.o:fake:(.text+0x3ca): undefined reference to \ASTNEW
BOP'
src/compiler/obj/rtl-system.o:fake:(.text+0x405): undefined reference to \ASTNEW
BOP'
src/compiler/obj/rtl-system.o:fake:(.text+0x5ac): more undefined references to \
ASTNEWBOP' follow
make.exe: *** [makefile:559: bin/fbc.exe] Error 1


while attempting to build the compiler.

Meanwhile, I managed to integrate the changes made by Monochromator in the last version, achieving dynamic linking (by dxe files) and threads under dos. I will prepare a patch, would you consider integrating it into the official version?
dkl
Site Admin
Posts: 3166
Joined: Jul 28, 2005 14:45
Location: Germany

Re: How to compile under DosEMU?

Postby dkl » Oct 02, 2017 19:17

So it was a problem with the makefile, as in it didn't build gfx_paletteget64.o but tried to include it in the archive at the "AR lib/dos/libfbgfx.a" step? I have no explanation for those compiler linking errors either; is ast-node-bop.o missing from the link command line?

Not sure how either of these could happen; unless it's something about the file names or command line length limits...

There is a way to get more information than the default output: make V=1 FBC='fbc -v'
angros47
Posts: 1305
Joined: Jun 21, 2005 19:04

Re: How to compile under DosEMU?

Postby angros47 » Oct 02, 2017 21:03

It doesn't help... no more error messages are shown. Anyway, I put the patch online, can you have a look at it?

https://sourceforge.net/p/fbc/patches/34/
St_W
Posts: 1127
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: How to compile under DosEMU?

Postby St_W » Oct 02, 2017 22:18

Does that patch also work with DJGPP (on Windows)? (or is it unaffected by it?)
angros47
Posts: 1305
Joined: Jun 21, 2005 19:04

Re: How to compile under DosEMU?

Postby angros47 » Oct 02, 2017 22:25

That patch is intended for DJGPP, since, as far as I know, under dos FreeBasic must be compiled with DJGPP. And under other systems, the patch is not needed since dynamic libs and threads are already available.
And I compiled it with DJGPP on a Windows machine
St_W
Posts: 1127
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: How to compile under DosEMU?

Postby St_W » Oct 02, 2017 22:52

Ok, thanks. I wanted to ask whether it depends on special APIs or other interfaces provided by DosEMU or works on any DOS (like NTVDM on Windows, or "real" MS-DOS or FreeDOS with DJGPP's DOS-Extender). I'm sorry for the misleading and unclear question above.
angros47
Posts: 1305
Joined: Jun 21, 2005 19:04

Re: How to compile under DosEMU?

Postby angros47 » Oct 02, 2017 22:57

You need a working djgpp setup. And you need pthreads, that can be a bit tricky to install, because it's not well supported
angros47
Posts: 1305
Joined: Jun 21, 2005 19:04

Re: How to compile under DosEMU?

Postby angros47 » Oct 04, 2017 12:06

I tried committing the changes
St_W
Posts: 1127
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: How to compile under DosEMU?

Postby St_W » Oct 05, 2017 11:35

angros47 wrote:You need a working djgpp setup. And you need pthreads, that can be a bit tricky to install, because it's not well supported
Could you describe which changes are required to be applied to a DJGPP environment as described in the wiki: https://freebasic.net/wiki/wikka.php?wakka=DevBuildDos ? Are there also changes in the build process necessary (I'm especially thinking of the step where the libraries are copied)?
I'm asking because I'd like to prepare my CI environment so that the build doesn't fail when your changes are merged into master.
angros47
Posts: 1305
Joined: Jun 21, 2005 19:04

Re: How to compile under DosEMU?

Postby angros47 » Oct 05, 2017 11:54

I first installed all the files in pth207b.zip, and then installed in the lib directory of DJGPP only the file libsocket.a from ls080b.zip (it can be found http://www.delorie.com/pub/djgpp/current/v2tk/). I also had to edit the file pthread.h (in the include directory of djgpp installation), removing the lines:

Code: Select all

#include <sys/socket.h>    /* for sockaddr        */


Code: Select all

#include <sys/wtime.h>     /* for struct timespec */


Code: Select all

#include <sys/select.h>


from it.
St_W
Posts: 1127
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: How to compile under DosEMU?

Postby St_W » Oct 05, 2017 12:25

Thank you, I applied the changes. You didn't mention any new library requirements in FreeBasic's lib/dos folder, is that right?
angros47
Posts: 1305
Joined: Jun 21, 2005 19:04

Re: How to compile under DosEMU?

Postby angros47 » Oct 05, 2017 13:21

With the last edit, a copy of libpthread.a and libsocket.a should be included where the linker can find it (if FreeBasic is used with djgpp, it can use the copy in the lib folder of the djgpp installation, otherwise the files should be put in the dos folder)
St_W
Posts: 1127
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: How to compile under DosEMU?

Postby St_W » Oct 09, 2017 0:03

@dkl / counting_pine or others who may know:
I saw that the changes were already merged into the master branch on GitHub, however the changes weren't synced to the SourceForge repo yet. So how does this synchronization work? (is this automated or done manually?) A when are the changes expected to be synchronized to fbc's git repo at SourceForge?
I'm asking because currently my CI server uses the sourceforge repo mainly. Should I switch to the one on GitHub? Which is considered the more "official" place to look for the latest source code?

@angros47:
Thank you, I've adapted the build process accordingly.

Return to “DOS”

Who is online

Users browsing this forum: No registered users and 1 guest