Menu

GnuCOBOL in FreeDOS/MS-DOS ...

GnuCOBOL
2022-03-14
4 days ago
1 2 3 .. 17 > >> (Page 1 of 17)
  • Everaldo Bernardo Cunha

    Hello,

    I would to install GNU Cobol in the FreeDOS 1.3. Someone here can help me
    that work??? I'm using the FreeDOS in a virtual machine DOSBOX-Staging, in the
    Debian 11.2 LXqt 64 bits ... I'll await future contact.

    Everaldo

     

    Last edit: Everaldo Bernardo Cunha 2022-06-10
    • pottmi

      pottmi - 2022-03-14

      Okay, I will bite....

      I can't help you, but I am curious: what is your use case for GnuCOBOL on
      DOSBOX?

      mod edit for some reply-to

       

      Last edit: Brian Tiffin 2022-03-14
      • Everaldo Bernardo Cunha

        Don't worry, other people it'll help me, ok! There are places than use FreeDOS in the my city, and I don't want to use a pirate compiler for create the programs of them, right!

        Everaldo

         

        Last edit: Simon Sobisch 2022-03-14
      • Ralph Linkletter

        This is an amazing thread. It is as if in a time machine - circa 1980's
        I wonder if there is a way to get GnuCOBOL working with TRSDOS. It would be really a wonderful exercise in digital archaeology to light up the two 160 KB 5.25" drives and hear them screech and chug as a Radio Shack TRS80 does a "make" of GnuCOBOL.
        Simon interested ?
        :-)

         
        • Simon Sobisch

          Simon Sobisch - 2022-04-07

          Won't work: GC needs 32bit and "real" COBOL programs currently generate a quite big C function so the C compiler needs RAM.

          But if you have an ancient 32bit environment that can handle GCC4, has some "decent" RAM and have archaeologic interest: sure.

           
    • Simon Sobisch

      Simon Sobisch - 2022-03-14

      I've did some work around GC 2.2 (if I remember correctly) on this and I think it likely should still work.

      In any case you need a DOS with 32bit support (that's a given with FreeDOS, I think that's possible with DOS-Box, too).
      Once you have the binaries (both GnuCOBOL and the matching C compiler) it should work fine.

      The main question is how to get the GnuCOBOL binaries. Because I did not wanted to invest too much time and did not found all the necessary components pre-packaged I did a cross-compile to DOS using DGJPP from my Trisquel GNU/Linux box back then.

      Because of machines running any DOS commonly don't have much RAM allocated you possibly will compile real-world (=big) COBOL programs with cobc -O0 (disable resource-intensive optimizations).

      In general: to build it you have to either use the FreeDOS system or cross-compile from another environment.

      In theory there are 3 compilers you can use: * DGJPP's GNU set with GCC (4.7. something), for FreeDOS found on the bonus cd * WatcomC * Borland C ([the old one] using GnuCOBOL with that wasn't tested for years and is on the list of "support will be fully removed if nobody shows up using that")

      Both 1 and 2 allow cross-compiles and are (if I remember correctly) supported with configure, so you can use those to compile everything on a different machine.

      Cross-compilation commonly means that you need to set a bunch of environment variables to run it later (but with a small GNUCOBOL.BAT that would be a small issue), compiling GnuCOBOL itself on FreeDOS would mean to manually create a matching config.h [you could just start the cross-compilation with the matching compiler to get it created] then compile and link all sources in each directory together.

      The part that is likely the most hard to get compiled correctly is GMP or MPIR, so you'd likely start on this one.
      For extended screenio: PDCurses/PDCursesMod DOS port likely works fine.

      Rechecked: I've found my personal POC from 2017 - it contains GC something after 2.2 using MPIR, cross-compiled with DJGPP (GCC 4.7.3), running on FreeDOS 1.2 with its distributed GCC 4.7.1.
      I've also did a POC with DOS-BOX once, but am not sure where I have that (if this is still existing anywhere), I don't know the details but for that one the goal was "compile on GNU/Linux using a cross-compiling cobc, run on DOS-BOX").

       

      Last edit: Simon Sobisch 2022-03-14
      • Everaldo Bernardo Cunha

        I already have the FreeDOS 1.3 installed in my machine, but I don't have a manual to help me in the compilation of the GNU Cobol in it. Do you can send to me that information? I'll await your answer.

        Everaldo

         

        Last edit: Simon Sobisch 2022-03-14
        • Simon Sobisch

          Simon Sobisch - 2022-03-14

          but I don't have a manual to help me in the compilation of the GNU Cobol in it. Do you
          can send to me that information?

          I also don't have any notes about this at hand. If you want to we can try to create some, but I personally won't put too much time in this in my allocated GnuCOBOL time.
          If working in a local government environment with FreeDOS as target You may have some people familiar with building software in that, which could help.
          If your environment needs GnuCOBOL I may could try building it in extra allocated time (but that would mean to drop other things so would not be "gratis").
          But for general issues even with this "relative exotic" environment this discussion board is fine, too.

          As noted before: in general you'd have to first define which underlying C compiler to use, either DJGPP/GCC (that's in the "Bonus CD" If I remember correctly) or WatcomC.

          Then you'd have to compile MPIR or GMP for FreeDOS.
          MPIR needs yasm.exe, so if you don't have that in FreeDOS then get it from http://www.tortall.net/projects/yasm/releases/yasm-1.3.0-dos.exe ;

          GMP doesn't need an assembler, it can built a "generic C" version (which is slower but should be easier to setup; if you want to you should be able to find the correct assembler files and compile those with the DJGPP provided GNU assembler).

          In both cases you likely have to either create makefiles "by hand" for this or compile manually, both should be possible (with the Makefiles having the benefit of easier re-doing/refinements later).

          One other thing to consider: do you really need GnuCOBOL compiling COBOL modules on this environment or would it be enough (or even better) to "only" be able to run GnuCOBOL generated COBOL modules on this environment? If the later is fine than you may opt for cross-compiling from your Debian environment to DOS and only copy the resulting modules over (or have it in a shared environment). This would allow you to edit your COBOL sources in an IDE, also compile it there using the cross-cobc; and would reduce the amount of things to do to "get libcob and its dependencies built for FreeDOS, no need for an installed C compiler there".

           
  • Simon Sobisch

    Simon Sobisch - 2022-03-14

    I had a look at https://www.delorie.com/pub/djgpp/current/v2gnu/?C=M;O=A - there are most of the necessary files in there (see the index file for the full names) - including a recent GMP, (even perl if you want to run the NIST testsuite), one directory above, then down to "v2tk" is also a ready-to-use PDCurses 3.9 (= last release version).

    Those binaries "just work" on FreeDOS :-)
    So mkdir C:\devel2 && cd C:\devel2, then just wget and unzip those (wget is part of FreeDOS (you may need to use http instead of https), so downloading of everything should be easy, too); then give it a go.

    That distribution also has bash, binutils and an updated make, and while it is temping to try to compile everything using the normal procedure (see README and INSTALL) coreutils seem to be missing, but needed for this install procedure.

     
  • Simon Sobisch

    Simon Sobisch - 2022-03-14

    OK, if you want to give it go, you could try the following:

    • ensure you have "lots of" enough disk space (one GB would be more than enough, but of course this also depends on your configuration)
    • mkdir C:\DEVEL2 && cd C:\DEVEL2 && edit use_me.bat as follows
    SET DJgPP=C:\DEVEL2\DJGPP.ENV
    SET PATH==C:\DEVEL2\BIN;%PATH%
    
    • download a lot of files from your nearest mirror (I assume this to be http://mirrors.meowr.net/djgpp/ ):
      • v2/djdev205.zip
      • v2gnu/mak43b.zip
      • v2gnu/perl588b.zip
      • v2gnu/libt15b.zip
      • v2gnu/licv115b.zip
      • v2gnu/gzip110b.zip
      • v2gnu/tar112abr2.zip
      • v2gnu/grep228b.zip
      • v2gnu/sed48b.zip
      • v2gnu/gwk500b.zip
      • v2gnu/bsh4117br3.zip
      • v2gnu/dif37b.zip
      • v2gnu/gmp621b.zip
      • v2gnu/fil41br3.zip
      • v2gnu/gdb801b.zip
      • v2gnu/gcc1030b.zip
      • v2gnu/bnu2351b.zip
    • then unzip everything (in order of their dates, enabling you to overwrite existing files), because of size issues and for better overview you'll likely want to del the ones you've unpacked
    • c:\devel2\use_me.bat
    • get GnuCOBOL (because I had issues with https here also on http) and patch some files for FAT32 as follows
    wget sf-mensch.users.sourceforge.net/files/dos/gc32-dev.tgz
    gzip -d gc32-dev.tgz && tar -xvf gc32-dev.tar
    move gnucobol* C:\gc32dev
    cd C:\gc32dev
    wget sf-mensch.users.sourceforge.net/files/dos/autoc.zip
    unzip autoc.zip
    cd libcob
    wget sf-mensch.users.sourceforge.net/files/cJSON/cJSON.c
    wget sf-mensch.users.sourceforge.net/files/cJSON/cJSON.h
    mkdir c:\gc32build && cd c:\gc32build
    bash
    ac_executable_extensions ../gc32dev/configure --without-db --enable-shared --disable-static --prefix=/dev/c/devel2
    make
    make checkall  # and inspect the results
    make install
    

    Fair warning: not tested until the end...

    Also: DJGPP suggests to cross-compile more complex projects instead of getting all those pieces together in a much slower environment. If you cross-compile you can still use libgmp from that distribution on both the building machine and FreeDOS (only the binaries from the package needed then) and binutils+GCC (+potentially GDB) on FreeDOS + then copy the GnuCOBOL build from your cross-compiling environment - no need for most of the downloads of all the tools and bash on FreeDOS.

     

    Last edit: Simon Sobisch 2022-03-16
  • Simon Sobisch

    Simon Sobisch - 2022-03-15

    Note: I've found that FreeDOS perfectly runs the following, which may be one of the reasons to have a COBOL environment running there:

    Microsoft (R) COBOL Optimizing Compiler Version 5.0
    
    COBOL software by Micro Focus
    Copyright (C) Microsoft Corporation 1984,1993.  All rights reserved.
    Copyright (C) Micro Focus Ltd. 1984,1993.  All rights reserved.
    

    If this is the case then it may be nice to first move to GnuCOBOL on the same environment (also allows for some nice comparisons), but it likely is better to directly port everything over to your Debian system.
    Just saying...

     
  • Everaldo Bernardo Cunha

    Simon Sobisch , I tried with your instructions, but in FreeDOS the file "DJGPP.ENV" doesn't ative the compiler ... I did some changes, but doesn't worked it! How do I proceed now?

     
    • Simon Sobisch

      Simon Sobisch - 2022-03-16

      I'm neither a FreeDOS nor DJGPP expert, but I guess that either SET DJGPP=C:\DEVEL2\DJGPP.ENV was not done (check with ECHO %DJGPP% - and note that my initial instructions had a typo there), or the layout of the DEVEL2 folder is not correct (should be when you unzip everything there).

       

      Last edit: Simon Sobisch 2022-03-16
  • Everaldo Bernardo Cunha

    Simon, I've been trying to compile gnucobol for FreeDOS for two days, without success! I managed to install DJGPP and run it under DOS, but my knowledge of C language is limited then... but the attempt was commendable. I appreciate the help you gave me.

     
    • Simon Sobisch

      Simon Sobisch - 2022-03-17

      Then next would be to follow the way the DGJPP packages are built, too - running GnuCOBOL there but cross-compile that under your Debian.

       
    • Simon Sobisch

      Simon Sobisch - 2022-03-17

      ... and reconsider to let GnuCOBOL run outside of FreeDOS.

       
  • Everaldo Bernardo Cunha

    The interesting is then there is a version for Windows, where the same to work perfectly ... I found in the FreeDOS I could to create a similar compiler. In the Windows it use the GCC to do it ...

     
    • Simon Sobisch

      Simon Sobisch - 2022-03-17

      DJGPP is GCC, and the shell is also the same (GNU bash).
      If you can setup everything (not sure where the issues are currently on your side, last thing was the wrong-spelled DJGPP environment variable/value), then the build should work fine.

      Because of the 8.3 name schema (actually in my test the only real problem was the "two extension problem) you need minor patches to GnuCOBOL as it wasn't build on DOS (as far as I know) before, this was never recognized.

      Again: there are two other options to consider:

      • all on GNU/Linux - just works out of the box, but would possibly need adjustments because things you expect from the DOS side are not available
      • setup DJGPP so it seems to work, but don't build GnuCOBOL with it; instead build it using a cross-compiler from your GNU/Linux environment, then just copy cobc.exe, cobcrun.exe, libcob.dll over to your FreeDOS and use it there, to do so
      • get DJGPP working there as outlined above (but no need to install the shell, fileutil, textutils, ..=, ideally an updated one because the one shipped with FreeDOS is quite old
      • create the matching version as cross-compiler on your GNU/Linux environment, this takes a while but works "nearly automated" using https://github.com/andrewwutw/build-djgpp (I've used it before and as far as I know it only got better) - this was used for my cross-compiling to DOS tests, too!
      • copy the libmp (and if you want the libncurses) parts from the DJGPP site to the installed cross-compiling environment (back then I was not aware of those and it was problematic to get libgmp linking)
      • get whatever GnuCOBOL version you like (3.x+) and during configure explicit specify the target environment as i586-pc-msdosdjgpp - you should get cobc,exe, cobcrun.exe, libcob.dll out of it that can be copied to FreeDOS
      • create a cob_env.bat to adjust the compile/linker flags to be used by GnuCOBOL (only adjusting the paths)
      • use it and have fun
       
  • Everaldo Bernardo Cunha

    Ok, Simon! Now I understood! I go to proceed how you are saying me! After, I'll post here the result obtained ...

     
  • Everaldo Bernardo Cunha

    Nothing do it! I tried to configure various times, but the result is ever the same ... see screenshot:

     
    • Simon Sobisch

      Simon Sobisch - 2022-03-18

      That's actually a result "not bad" - configure passed already. Out of interest: could you share the resulting configure.log?

      Your screenshot says that make complains that there is no "build_aux" directory - is that really there? If not please extract the version from the GnuCOBOL distribution you've used and place it there.

      In any case you should run make in this place, not a check target (because the programs were not build yet).

       
  • Everaldo Bernardo Cunha

    See, now it appear errors various ... See:

    mod edit for long console dump, attached

     

    Last edit: Brian Tiffin 2022-03-18
  • Everaldo Bernardo Cunha

    Here the script I am using:

     
  • Everaldo Bernardo Cunha

    Ahhhh ... I did the proceeding manually and ... now work it! But doesn't generate the EXEs and DLLs for FreeDOS, only the files for Debian linux, see screenshots ... do will I have to rename the files????

     
  • Everaldo Bernardo Cunha

    I changed some things: I put a other destiny path and I created a the logs files ... The results are in the attachments ...

     

    Last edit: Everaldo Bernardo Cunha 2022-03-19
1 2 3 .. 17 > >> (Page 1 of 17)

Log in to post a comment.