Strange errors

DOS specific questions.
ffracca
Posts: 6
Joined: Mar 05, 2020 11:21

Strange errors

Postby ffracca » Mar 05, 2020 11:36

I’ve written a short program with FB 1.07. No problems for compilers Windows and Linux either 32 or 64 bit.

I tried to transfer it under DOS (MS-DOS 6.22 in Virtualbox) for older pcs but I got the following error notification:

- - - - - -
ld: cannot find filetocompile.o: Too many open files (EMFILE)
ld: cannot find -lfb
ld: cannot find -lgcc
ld: cannot find -lc
ld: cannot find -lm
- - - - - -

I tried to re-name the corresponding libraries (libfb.a, libgcc.a, liblc.a, libm.a), that I found at
c:\fb107\lib\dos. I also tried to move the re-named files into the directory that contains compilers and source (fbc and filetocompile.bas).
Of course I also inserted in Path c:\fb107 and c:\fb107\lib\dos.

Same error came up again.

Any suggestions?
fxm
Posts: 9529
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Strange errors

Postby fxm » Mar 05, 2020 13:33

Did you compile it with at top:
#lang "qb"
(and with FreeBASIC-1.07.1-dos)
ffracca
Posts: 6
Joined: Mar 05, 2020 11:21

Re: Strange errors

Postby ffracca » Mar 05, 2020 17:52

Mine is not a "qb" program, in an "fb" program.
Anyway I tried to compile as you suggested, but as expected I have had some syntax error messages.
Sorry.
Laaca
Posts: 25
Joined: Dec 31, 2007 14:24

Re: Strange errors

Postby Laaca » Mar 08, 2020 8:11

Does work the cross-compilation from Windows compiler to DOS executable?

In case you are trying to do a native compilation in DOS system with DOS FB-compiler to DOS executable it is rather some DOS specific problém than a problém in your code.
It can be related to LFN (long file names) support. Or the DOS limitation about maximal number of opened files (something like that sugests the error message).
In real DOS system can be the limit for opened files increase by editing the configuration file CONFIG.SYS. How is it done in emulated environments I don't know.
Anyway, your problem should be easy to analyse for DOS users because it is replicable. If you provide the sources it should not be so hard.
ffracca
Posts: 6
Joined: Mar 05, 2020 11:21

Re: Strange errors

Postby ffracca » Mar 08, 2020 15:56

Cross compilation? You mean to compile with FB for DOS in command line window (CMD)?. I don't know, never tried.

Compiled with FreeDOS in Virtualbox works fine.
But I need a compiler working in *every* DOS environment so i am converting to good(?) old (1988) QB 4.5, saving Freebasic for Linux and Windows.

p.s.: With QB 4.5 works :(
Laaca
Posts: 25
Joined: Dec 31, 2007 14:24

Re: Strange errors

Postby Laaca » Mar 14, 2020 11:19

It works in QB 4.5?

And what about the calls from C libraries?
Do you use in your code some explicite linking with C-library files? (I don't know the proper FB syntax but simething like: "#INCLIB GCC.A" ). Or your code is just "pure" basic code without any attempts to call anything external?
Because if you do not use any INCLIB or INCLUDE it means that you have severely damaged installation of FreeBasic
ffracca
Posts: 6
Joined: Mar 05, 2020 11:21

Re: Strange errors

Postby ffracca » Mar 14, 2020 13:52

Mine is "pure basic" but in FB I needed an ' #INCLUDE "file.bi" ' to run "filecopy".
In QB 4.5 I used a ' SHELL "COPY ... " '

FB with Linux and Windows works fine, and looks fine also QB in MS-DOS 6.22

Laaca wrote:.....
Because if you do not use any INCLIB or INCLUDE it means that you have severely damaged installation of FreeBasic


??? Why??? Only I do not use any other library.
caseih
Posts: 1425
Joined: Feb 26, 2007 5:32

Re: Strange errors

Postby caseih » Mar 14, 2020 15:12

ffracca wrote:I’ve written a short program with FB 1.07. No problems for compilers Windows and Linux either 32 or 64 bit.

I tried to transfer it under DOS (MS-DOS 6.22 in Virtualbox) for older pcs but I got the following error notification:

- - - - - -
ld: cannot find filetocompile.o: Too many open files (EMFILE)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is the error message here which plainly states the cause. You apparently missed it.

I tried to re-name the corresponding libraries (libfb.a, libgcc.a, liblc.a, libm.a), that I found at
c:\fb107\lib\dos. I also tried to move the re-named files into the directory that contains compilers and source (fbc and filetocompile.bas).
Of course I also inserted in Path c:\fb107 and c:\fb107\lib\dos.

Same error came up again.

Of course it did because none of that is the problem. The problem is "Too many open files."

This is jogging some very old memories here. If I recall there's a way to increase the number of files DOS allows to be open at one time using the FILES=### line in config.sys. There's also something about FILESHIGH, which may also need to be set. I think I remember setting both of these back in the day.

Something else you need to realize about FB for DOS is that it's a 32-bit program that requires a working 32-bit DOS extender environment. I think the DJGPP-based binaries in FreeBASIC come with their own built-in extender but you need to make sure things are set up correctly. FreeDOS will have everything you need out of the box. I can't remember how to make MS-DOS work. Needs EMM386.sys? I'm not sure. Anyway FB nor any FBC-compiled executables will work on a 286 or older. 386 is required.
ffracca
Posts: 6
Joined: Mar 05, 2020 11:21

Re: Strange errors

Postby ffracca » Mar 14, 2020 16:07

Thank you caseih. I'll work on it. Somewhere I still have my old MS DOS manuals (back to 4.01).
About 386, my fist one was in 1989.
:-D
I suppose that 31 years old is enough!
Laaca
Posts: 25
Joined: Dec 31, 2007 14:24

Re: Strange errors

Postby Laaca » Mar 14, 2020 21:29

But this command line: "fbc filetocompile.bas" can't work in normal DOS environment!

Because FILETOCOMPILE.BAS has longer name than usual 8+3 DOS file name format. Don't rely on the 3rd party LFN drivers. In some situations they may not work.
caseih
Posts: 1425
Joined: Feb 26, 2007 5:32

Re: Strange errors

Postby caseih » Mar 14, 2020 22:34

True I had forgotten about that!
ffracca
Posts: 6
Joined: Mar 05, 2020 11:21

Re: Strange errors

Postby ffracca » Mar 15, 2020 9:10

Filetocompile.bas is only an example. The right name of my program is Bitbasso.bas (8+3)

Also with:
DEVICE = EMM386.EXE RAM
FILES = 50
in CONFYG.SYS nothing changes.
My last hope is to compile in FreeDOS an run the executable in MS DOS.

Return to “DOS”

Who is online

Users browsing this forum: No registered users and 1 guest