Menu

Having error when compiling, libcob.lib is not found

enð
2022-05-26
2024-05-08
  • enð

    enð - 2022-05-26

    Hello, sorry it's my first time creating topics in sourceforge, I recently installed GnuCOBOL through chocolatey (choco install gnucobol) and everything works, except the actual compiling of COBOL programs, I tried with a simple hello world I had laying around, and whenever I try to compile (cobc PGMTEST.cbl -o PGMTEST.exe or cobc -x PGMTEST.cbl) I get the error message:
    gcc: error: /LIBPATH:C:\ProgramData\chocolatey\lib\gnucobol\tools\lib\libcob.lib: Invalid argument
    Which going deeper (or checking the actual LIBPATH given), I found out there's no libcob.lib in that same folder, theres a libcob.a, a libcob.dll.a and a libcob.la, but no libcob.lib, so is there something wrong with the package I installed? Or did I configure the compiler wrongly?

    Thanks in advance

     
    • Simon Sobisch

      Simon Sobisch - 2022-05-26

      If you did not set anything and just use that package, then the package ah be broken. Your fix is to copy libcob.dll.a to libcob.lib.

      mod edit to remove some reply-to

       

      Last edit: Brian Tiffin 2022-05-26
  • enð

    enð - 2022-05-26

    Oh ok thanks! that seems like an easy solution heh thanks a bunch.

     
  • enð

    enð - 2022-05-27

    Sorry to bother again, but it hasn't really fixed the thing, it's still throwing the same error, I'm attaching a screenshot of all: The test program, the lib folder and the command I use.

     
    • Simon Sobisch

      Simon Sobisch - 2022-05-27

      add -v to cobc and post the output as text, should be fixable
      Maybe also add the output of

      cobc --info
      
       

      Last edit: Simon Sobisch 2022-05-27
  • enð

    enð - 2022-05-27
    cobc -v
    cobc (GnuCOBOL) 3.1.2.0
    Built     Dec 26 2020 16:13:04  Packaged  Dec 23 2020 12:04:58 UTC
    C version (MinGW) "6.3.0"
    loading standard configuration file 'default.conf'
    cobc: error: no input files
    

    and:

    cobc --info
    cobc (GnuCOBOL) 3.1.2.0
    Copyright (C) 2020 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    Written by Keisuke Nishida, Roger While, Ron Norman, Simon Sobisch, Edward Hart
    Built     Dec 26 2020 16:13:04
    Packaged  Dec 23 2020 12:04:58 UTC
    C version (MinGW) "6.3.0"
    
    build information
    build environment        : i686-pc-mingw32
    CC                       : gcc
    C version                : (MinGW) "6.3.0"
    CPPFLAGS                 : -DCHTYPE_64 -DPDC_DLL_BUILD
                               -Dinitscr=initscr_x64 -I/mingw/include
    CFLAGS                   : -O2 -pipe -finline-functions -fsigned-char
                               -Wall -Wwrite-strings -Wmissing-prototypes
                               -Wno-format-y2k
    LD                       : c:/mingw/mingw32/bin/ld.exe
    LDFLAGS                  :
    
    GnuCOBOL information
    COB_CC                   : gcc
    COB_CFLAGS               : -pipe -DCHTYPE_64 -DPDC_DLL_BUILD
                               -Dinitscr=initscr_x64 -I/mingw/include
                               -I/mingw/include -Wno-unused -fsigned-char
                               -Wno-pointer-sign
      env: COB_CFLAGS        : -I"C:\ProgramData\chocolatey\lib\gnucobol\tools\include"
    COB_DEBUG_FLAGS          : -ggdb3 -fasynchronous-unwind-tables
    COB_LDFLAGS              :
    COB_LIBS                 : -L/mingw/lib -lcob -lm
      env: COB_LIBS          : /LIBPATH:"C:\ProgramData\chocolatey\lib\gnucobol\tools\lib\libcob.lib"
    COB_CONFIG_DIR           : /mingw/share/gnucobol/config
      env: COB_CONFIG_DIR    : C:\ProgramData\chocolatey\lib\gnucobol\tools\config
    COB_COPY_DIR             : /mingw/share/gnucobol/copy
    COB_MSG_FORMAT           : GCC
    COB_OBJECT_EXT           : o
    COB_MODULE_EXT           : dll
    COB_EXE_EXT              : .exe
    64bit-mode               : no
    BINARY-C-LONG            : 4 bytes
    endianness               : little-endian
    native EBCDIC            : no
    extended screen I/O      : pdcurses
    variable file format     : 0
    sequential file handler  : built-in
    indexed file handler     : BDB
    mathematical library     : GMP
    XML library              : disabled
    JSON library             : cjson
    
     

    Last edit: enð 2022-05-27
    • Simon Sobisch

      Simon Sobisch - 2022-05-27

      Sorry for not being specific enough. We'd need the output of "cobc all your options -v".

      But I've question already: where do all these environment variables come from, that are visible in "cobc --info"?

       
      • enð

        enð - 2022-05-27

        oh so you mean something like cobc ./PGMTEST.cbl -xv? Sorry I didn't know, I'm really new to posting errors and stuff hahahah, the other environment variables SHOULD come from the choco installation, as I've tried installing the MSYS2 version (mingw-x64-x86_64-gnucobol) but that gave me some configuration errors so I opted to go with chocolatey, but I should have erased all of the files from the MSYS2 version.

        For the command you ask it sends me this:

        cobc .\PGMTEST.cbl -xv
        cobc (GnuCOBOL) 3.1.2.0
        Built     Dec 26 2020 16:13:04  Packaged  Dec 23 2020 12:04:58 UTC
        C version (MinGW) "6.3.0"
        loading standard configuration file 'default.conf'
        command line:   C:\ProgramData\chocolatey\lib\gnucobol\tools\bin\cobc.exe -xv .\PGMTEST.cbl
        preprocessing:  .\PGMTEST.cbl -> C:\Users\f1eren\AppData\Local\Temp\cob10192_0.cob
        return status:  0
        parsing:        C:\Users\f1eren\AppData\Local\Temp\cob10192_0.cob (.\PGMTEST.cbl)
        return status:  0
        translating:    C:\Users\f1eren\AppData\Local\Temp\cob10192_0.cob -> C:\Users\f1eren\AppData\Local\Temp\cob10192_0.c (.\PGMTEST.cbl)
        executing:      gcc -c
                        -I"C:\ProgramData\chocolatey\lib\gnucobol\tools\include" -o
                        "C:\Users\f1eren\AppData\Local\Temp\cob10192_0.o"
                        "C:\Users\f1eren\AppData\Local\Temp\cob10192_0.c"
        return status:  0
        executing:      gcc -Wl,--export-all-symbols -Wl,--enable-auto-import
                        -Wl,--enable-auto-image-base -o "PGMTEST.exe"
                        "C:\Users\f1eren\AppData\Local\Temp\cob10192_0.o"
                        /LIBPATH:"C:\ProgramData\chocolatey\lib\gnucobol\tools\lib\libcob.lib"
        gcc: error: /LIBPATH:C:\ProgramData\chocolatey\lib\gnucobol\tools\lib\libcob.lib: Invalid argument
        return status:  1
        
         
        • Simon Sobisch

          Simon Sobisch - 2022-05-28

          I suggest to report to the choco repo that this package is broken.
          Then find out where the environment variables are set and adjust similar to the following

          -set "COB_LIBS=/LIBPATH:"C:\ProgramData\chocolatey\lib\gnucobol\tools\lib\libcob.lib""
          +set "COB_LIBS=/L"C:\ProgramData\chocolatey\lib\gnucobol\tools\lib""
          
           
          • enð

            enð - 2022-05-28

            Sorry to bother again, will do the report, but it still quite doesn't work, I've tried changing the variable a lil more trying with:
            - /L"C:\ProgramData\chocolatey\lib\gnucobol\tools\lib"
            - /L"C:\ProgramData\chocolatey\lib\gnucobol\tools\lib\libcob.lib"
            - "C:\ProgramData\chocolatey\lib\gnucobol\tools\lib\libcob.lib"
            - /LIBPATH"C:\ProgramData\chocolatey\lib\gnucobol\tools\lib"

            and only the third option let me compile (although no program I compiled with that showed any message (the hello world wouldn't show up)), so I'm still at a loss as to what to do...

             
            • Ralph Linkletter

              What runtime owns the .EXE ?
              If it is not the GnuCOBOL RTS the displays in a GnuCOBOL program are never to be seen - the STDIN, STDOUT handles are owned by the controlling .EXE (I think)
              Here is a wee bit of a test to ascertain whether the above is the case.
              Replace the "Hello World" with a call to ZMSGBOX2
              ZMSGBOX2 uses WinApi MessageBoxA iinstead of console services.
              See syntax and code below:

               

              Last edit: Ralph Linkletter 2022-05-28
            • Simon Sobisch

              Simon Sobisch - 2022-05-28

              Rechecked: you want /L"C:\ProgramData\chocolatey\lib\gnucobol\tools\lib" -lcob.

               
  • Anonymous

    Anonymous - 2024-05-08

    Hi guys, i'm having this exact same issue. Just installed GnuCobol with Chocolatey and it fails. I have set COB_LIBS=C:\ProgramData\chocolatey\lib\gnucobol\tools\lib but now ld.exe complains with:

    cobc -x testfunc.cob
    C:\ProgramData\chocolatey\lib\gnucobol\tools\bin/ld.exe: cannot find C:\ProgramData\chocolatey\lib\gnucobol\tools\lib: Permission denied
    collect2.exe: error: ld returned 1 exit status

     
    • Simon Sobisch

      Simon Sobisch - 2024-05-08

      as noted directly above:

      You want set "COB_LIBS=/L"C:\ProgramData\chocolatey\lib\gnucobol\tools\lib" -lcob".

      And once this is solved, I suggest to bring this to the attention of the maintainer of the choco package you use.

       

Anonymous
Anonymous

Add attachments
Cancel