Either produce an executable with cobc -x hello.cob (resulting in a callable ./hello) or, what I'd always suggest use the GnuCOBOL module runner with your current so:
cobcrun hello.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
1. Did you build and test the compiler under the Pi ?
Assuming you have.
Recompile hello.cob by running :
cobc -x -free hello.cob
./hello
Does it now work ?
Notes : the '-free' is needed if the program source is not a fixed
format or you have not included the source code line that starts in
cc8 of :.
>>SOURCE FREE
and yes it can be lower case.
Now you commented on to-many-references to OpenCOBOL
Where are these shown as it should not be mentioned in the GC manuals :
Programmers Guide, Sample Programs, Quick Reference ?
There is a wee problem in that the sourceforge site was being used for
when the compiler was called OpenCobol and we have not change the name
of it and YES we should at least have a link to the new name and
content. @Simon ?
Vince
Last edit: Simon Sobisch 2020-07-01
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
There is a wee problem in that the sourceforge site was being used for when the compiler was called OpenCobol and we have not change the name of it and YES we should at least have a link to the new name and content.
You may ask SF via its support tickets for a possible forward, this would be useful.
The last time that I checked there was only an option to permanently change the project name - which will break any link and any svn checkout directly, which is obviously a very bad thing - or setup a forward noteto a completely different page.
A symlink would be best. It is possible to set this up for me in the file releases [I did so to support both the old gnu-cobol and gnucobol directory for example] and it should theoretically be possible for the SF staff to also do this on the project level - but it definitely isn't for me as an admin of this SF project.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2020-07-01
cobcrun worked!
Thank you!
However:
cobc -x hello.cob did indeed give an executable load module, hello.
./hello
./hello: error while loading shared libraries: libcob.so.4: cannot open shared object file: No such file or directory
It seems that make install should put the libraries where they should be: /usr/local/lib
Sorry 'bout that. That's where they are.
How do I get the program to pick up the libraries?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You can omit the line with mysql if you will never use the mysql rdbms
service.
As I run a x64 system I could also add
/usr/lib64
but for some reason I don't so you can or not
One you have done this now run sudo ldconfig
Remember to rerun ldconfig when ever you install a later version of the
compiler but must admit I some times forget and I have not noticed a
problem --- yet :)
.
Now rerun ./hello and check that it now works.
There are some other environment settings you can do (ok, I have) under
my user id and these are in the file ./.bashrc_profile
Here is what I have and I have removed one's you will not want or
require but ignore the lines with --- ditto lines with <<< which is my
notes to you >>>
cat ~/.bashrc
::sh# .bashrc# User specific aliases and functions# Source global definitionsif[-f/etc/bashrc];then./etc/bashrcfi# << the above should be present already or similar >>exportCOB_SET_TRACE=YESexportCOB_TRACE_FILE=${HOME}/trace.log# << these 2 only if you want to do tracingof your programs when testing >>exportCOB_SCREEN_ESC=YESexportCOB_SCREEN_EXCEPTIONS=YESexportCOB_LIBRARY_PATH=~/bin# << this is my user directory for programs >>#exportPATH=PATH;~/bin# << and here too >>exportTMPDIR=~/tmp# <<<< You might want this one or as ~/tmp
That should keep you going
Vince
Last edit: Simon Sobisch 2020-07-01
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm running Manjaro Linux (an Arch derivative) on a Raspberry Pi 4B.
I downloaded GnuCOBOL (can you remove the way-too-many references to OpenCOBOL?).
Compiled and installed it. ./configure, make, make install.
Entered the hello.cob program:
* HELLO.COB Gnu COBOL FAQ example
IDENTIFICATION DIVISION.
PROGRAM-ID. hello.
PROCEDURE DIVISION.
DISPLAY "Hello, world".
STOP RUN.
[ted@jamie gnucobol-3.1-rc1]$ cobc hello.cob [No diagnostics; produced hello.so]
[ted@jamie gnucobol-3.1-rc1]$ ./hello.so
Segmentation fault (core dumped)
[ted@jamie gnucobol-3.1-rc1]$
Hmm... a little poking around:
[ted@jamie gnucobol-3.1-rc1]$ file hello.so
hello.so: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), statically linked, BuildID[sha1]=18ce78df3384de536b65c7ab127dbfa0855282e2, not stripped
[ted@jamie gnucobol-3.1-rc1]$
You cannot directly run a shared object (so).
Either produce an executable with
cobc -x hello.cob(resulting in a callable./hello) or, what I'd always suggest use the GnuCOBOL module runner with your current so:cobcrun hello.Couple of things come to mind :
1. Did you build and test the compiler under the Pi ?
Assuming you have.
Recompile hello.cob by running :
cobc -x -free hello.cob
./hello
Does it now work ?
Notes : the '-free' is needed if the program source is not a fixed
format or you have not included the source code line that starts in
cc8 of :.
>>SOURCE FREE
and yes it can be lower case.
Now you commented on to-many-references to OpenCOBOL
Where are these shown as it should not be mentioned in the GC manuals :
Programmers Guide, Sample Programs, Quick Reference ?
There is a wee problem in that the sourceforge site was being used for
when the compiler was called OpenCobol and we have not change the name
of it and YES we should at least have a link to the new name and
content. @Simon ?
Vince
Last edit: Simon Sobisch 2020-07-01
You may ask SF via its support tickets for a possible forward, this would be useful.
The last time that I checked there was only an option to permanently change the project name - which will break any link and any svn checkout directly, which is obviously a very bad thing - or setup a forward noteto a completely different page.
A symlink would be best. It is possible to set this up for me in the file releases [I did so to support both the old gnu-cobol and gnucobol directory for example] and it should theoretically be possible for the SF staff to also do this on the project level - but it definitely isn't for me as an admin of this SF project.
cobcrun worked!
Thank you!
However:
cobc -x hello.cob did indeed give an executable load module, hello.
./hello
./hello: error while loading shared libraries: libcob.so.4: cannot open shared object file: No such file or directory
It seems that make install should put the libraries where they should be: /usr/local/lib
Sorry 'bout that. That's where they are.
How do I get the program to pick up the libraries?
I am assuming you are running under Linux so you need to tell the system
where the cobol libraries are so to do that :
Create a file in /etc/ld.so.conf.d
called what ever you want but I suggest
gnu-cobol.conf
and in that create the following lines :
You can omit the line with mysql if you will never use the mysql rdbms
service.
As I run a x64 system I could also add
/usr/lib64
but for some reason I don't so you can or not
One you have done this now run sudo ldconfig
Remember to rerun ldconfig when ever you install a later version of the
compiler but must admit I some times forget and I have not noticed a
problem --- yet :)
.
Now rerun
./helloand check that it now works.There are some other environment settings you can do (ok, I have) under
my user id and these are in the file ./.bashrc_profile
Here is what I have and I have removed one's you will not want or
require but ignore the lines with --- ditto lines with <<< which is my
notes to you >>>
That should keep you going
Vince
Last edit: Simon Sobisch 2020-07-01
Most systems don't auto-load from /usr/local/lib.
You may want to add it to
LD_LIBRARY_PATH, for example in the profile or bahsrc.