gnucobol-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GnuCOBOL on cygwin/Win32 (was: more intel thanks wrong format exe)


From: Simon Sobisch
Subject: GnuCOBOL on cygwin/Win32 (was: more intel thanks wrong format exe)
Date: Wed, 9 Oct 2024 19:10:55 +0200
User-agent: Mozilla Thunderbird

Hi Jim and welcome to GnuCOBOL!

Am 09.10.2024 um 14:52 schrieb Jim McNamara:
cd /usr/local/bin
$> ls
blob.cob  blob.dll  blob.exe  cobc.exe  cob-config  cobcrun.exe  cygcob-4.dll  
platinfo

While it would be quite uncommon to place COBOL sources to /usr/local/bin, it can make sense to place COBOL executables there (if you want them to be callable from everywhere in your PATH, with the guess that this path is in there).

As cygwin has a global replacement of the "lib" prefix with "cyg" (that's the reason you don't have libcob-4.dll [note: the 4 is the ABI number, not the version number]) that additional file is kind of expected as well. It does so because "cyg" libraries are always linked to cygwin1.dll and are not intended to be called from non-cygwin libraries / binaries.

$> ./blob.exe
bash: ./blob.exe: cannot execute binary file: Exec format error

I _guess_ you've compiled that with `cobc` and just named it ".exe", so it is a shared object with an executable name?

Per the distributed manual:

cobc -x blob.cob    (implies "-o blob.exe" on cygwin)
to create an executable - note that this cannot have a LINKAGE but must parse its parameters (if any are planned) different. Execute it with ./blob.exe or ./blob (or, with the assumption that this folder is in PATH with "blob")

cobc blob.cob       (implies "-m" and together "-o blob.dll" on cygwin)
to generate a shared object, which you either CALL from a different COBOL program or with the module runner (note: the remark on parameters applies identical)

Execute it with cobcrun blob (note: "blob" must then also match the program-id of the program!)

Apart from the program-id you'd then either have /usr/local/bin as current path or set it into the COBOL runtime library path, for example inline:
COB_LIBRARY_PATH=/usr/local/bin cobcrun blob

or   cobcrun -M /usr/local/bin/blob blob   (the later is the program-id)


Hi looks like i grabbed wrong source it ended in .tar.gz thought I was good to 
go?

filename: gnucobol-3.2.tar.gz

No, the source was completely fine.

But if you are no general cygwin user, which seems to be the case given the cygcob question, then cygwin is likely not the environment for you and you may prefer to use something like "full-featured and fast" WSL or MSYS2 (in both cases you can either build from the same source or use the distribution provided binaries) or directly use Win32 (x86/s64) binaries from one of

https://arnoldtrembley.com/GnuCOBOL.htm
  (Mingw or MSYS2 MINGW32 or MINGW64 based)

https://superbol.eu/en/developers/windows-aio-3.2/
  (MSYS2 MINGW64 based)


Welcome again :-)
Simon



reply via email to

[Prev in Thread] Current Thread [Next in Thread]