How to compile under DosEMU?

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

How to compile under DosEMU?

Post by angros47 »

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: 3235
Joined: Jul 28, 2005 14:45
Location: Germany

Re: How to compile under DosEMU?

Post by dkl »

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: 2321
Joined: Jun 21, 2005 19:04

Re: How to compile under DosEMU?

Post by angros47 »

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: 3235
Joined: Jul 28, 2005 14:45
Location: Germany

Re: How to compile under DosEMU?

Post by dkl »

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: 2321
Joined: Jun 21, 2005 19:04

Re: How to compile under DosEMU?

Post by angros47 »

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: 1619
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: How to compile under DosEMU?

Post by St_W »

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

Re: How to compile under DosEMU?

Post by angros47 »

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: 1619
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: How to compile under DosEMU?

Post by St_W »

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: 2321
Joined: Jun 21, 2005 19:04

Re: How to compile under DosEMU?

Post by angros47 »

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: 2321
Joined: Jun 21, 2005 19:04

Re: How to compile under DosEMU?

Post by angros47 »

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

Re: How to compile under DosEMU?

Post by St_W »

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: 2321
Joined: Jun 21, 2005 19:04

Re: How to compile under DosEMU?

Post by angros47 »

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: 1619
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: How to compile under DosEMU?

Post by St_W »

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: 2321
Joined: Jun 21, 2005 19:04

Re: How to compile under DosEMU?

Post by angros47 »

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: 1619
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: How to compile under DosEMU?

Post by St_W »

@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.
Post Reply