Error with gmp when compiling helloworl in COBOL
Asked Answered
R

1

12

I want to run this hello world program, in COBOL :

Identification Division. program-id. HelloWorld.
Procedure Division.
Display 'Bonjour '.
Display 'Comment allez vous ? ' .
goback.

But, I have this error :

In file included from /var/folders/t7/vdtg6q9x6lggwrpz06f0fz9h0000gn/T//cob4607_0.c:13:
/usr/local/Cellar/open-cobol/1.1/include/libcob.h:24:10: fatal error: 'gmp.h' file not found
#include <gmp.h>
         ^
1 error generated.

To compile, I did : cobc -x -free helloworld.cob

The COBOL compiler I use is open-cobol which I installed with the following command line : brew install open-cobol.

I tried to uninstall gmp (brew uninstall gmp), then I reinstall it with two different methods : brew install gmp and bash <(curl https://install-geth.ethereum.org -L). And I still have the same error.

Rudolph answered 8/1, 2016 at 9:15 Comment(3)
It would be good to ask this of the GnuCOBOL forum at SourceForge,Net. GnuCOBOL is the new name for OpenCOBOL. I'd also suggest upgrading to GnuCOBOL 1.1 which is more up-to-date.Idler
Here's a current topic on osx and GnuCOBOL: sourceforge.net/p/open-cobol/discussion/help/thread/101df6ee/…Idler
Thank you for your answers. I tried to reinstall with the following line code : sudo port -v selfupdate && \ sudo port install gmp db46 gettext && \ ./configure --prefix=/opt/local --with-db CPPFLAGS="-I/opt/local/include/db46" LDFLAGS="-L/opt/local/lib/db46" && \ make && \ sudo make install && \ cobc --help And I have the same errorRudolph
R
3

So, first I uninstalled open-cobol (brew uninstall open-cobol) and then I installed GnuCOBOL (brew install gnu-cobol). It is the new name for OpenCobol (thanks to Bill Woodger).

I even tried to do this, but the installation was very long so I stopped it. But this is normal (!!). I found here some people who are doing the same remark : Setting up COBOL Compiler under Mac OS? (it took me 60min).

Now, I can compile with Terminal (cobc -x filename.cob && ./filename) or by using OpenCobolIDE.

Rudolph answered 11/1, 2016 at 9:29 Comment(1)
Good work. Sorry not to be more useful, but I know zero about Macs except that they keep the rain off.Idler

© 2022 - 2024 — McMap. All rights reserved.