Open-source Languages & Tools for z/OS

 View Only
  • 1.  Binding Error, unable to resolve libcurl symbols

    Posted 10-19-2020 11:44
    Hello,

    I'm trying to bind a SIMPLE.C (http get ), through XL C/C++ catalogue procedure CBCXB. I see some Symbols unresolved. Any help is very well appreciated

    Here is my BIND.SYSLIN

    INCLUDE '/C/Rocket/curl/lib/libcurl.a'
    INCLUDE SYSLIB(IOSTREAM)
    INCLUDE SYSLIB(COMPLEX)
    INCLUDE SYSLIB(C128N)

    Bind errors
    IEW2339S 1035 THE INCLUDE DATA SET SPECIFIED BY DDNAME /0000001 IS AN ARCHIVE FILE.

    IEW2456E 9207 SYMBOL curl_easy_cleanup UNRESOLVED. M
    IEW2456E 9207 SYMBOL fprintf UNRESOLVED. MEMBER COUL
    IEW2456E 9207 SYMBOL curl_easy_strerror UNRESOLVED.
    IEW2456E 9207 SYMBOL curl_easy_perform UNRESOLVED. M
    IEW2456E 9207 SYMBOL curl_easy_setopt UNRESOLVED. ME
    IEW2456E 9207 SYMBOL curl_easy_init UNRESOLVED. MEMB
    IEW2653E 5112 ENTRY CEESTART FROM OBJECT MODULE IS NO


    ------------------------------


    ------------------------------

    ------------------------------
    Thanks,
    Sree
    ------------------------------


  • 2.  RE: Binding Error, unable to resolve libcurl symbols

    ROCKETEER
    Posted 10-20-2020 01:59
    Hello Sree,

    The libcurl.a file is a so-called 'archive library' and cannot be specified in an INCLUDE statement, as explicitly stated in the binder doc:
    https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.4.0/com.ibm.zos.v2r4.ieab100/acwarchlib.htm

    Looks like you need to specify it in the LIBRARY statement as described here:
    https://www.ibm.com/support/knowledgecenter/SSLTBW_2.4.0/com.ibm.zos.v2r4.ieab100/library.htm

    You might need an AUTOCALL statement, too.

    Please note that CBCXB is intended for 32-bit programs and might be incompatible with libcurl.a since the tools we provde are compiled in 64-bit ASCII mode. According to the following list of procedures, CBCQB should be used instead.

    https://www.ibm.com/support/knowledgecenter/SSLTBW_2.2.0/com.ibm.zos.v2r2.cbcux01/batchbind.htm

    Is there any reason you need to compile your program via JCL rather than do it from USS command line? In the command line, it's way easier to specify the compiler or linker parameters, and typically, less 'black magic' is needed to make it work.

    Regards,
    Vladimir

    ------------------------------
    Vladimir Ein
    Rocket Software
    ------------------------------



  • 3.  RE: Binding Error, unable to resolve libcurl symbols

    Posted 10-20-2020 18:11
    Hello Vladimir,

    Thank you for the guidance, I was able to do a successful bind with the help of some useful information provided in the IBM support knowledge links.

    I have a specific requirement where in I have to make Rest calls from a C program in the mainframe. Hence I'm trying to compile and linkedit through XL C/C++ compiler.

    The Challenge which I had faced earlier at compilation time was the code page issue with the headers .The headers files in uss were in codepage ASCII ISO8859-1,  So while compiling the XL c/C++ compiler  was unable to convert to EBCDIC 1047, hence got lots of codepage errors. It seems AUTOCONV wasn't happening. So I had to manually convert the headers in USS by using iconv command.

    While porting the LIBCURL to USS, I had followed the README.ZOS instructions. Is there a way for the Header files to be in EBCDIC 1047 while porting the cURL to USS??

    ------------------------------
    Vasu Sree
    ------------------------------



  • 4.  RE: Binding Error, unable to resolve libcurl symbols

    ROCKETEER
    Posted 10-27-2020 02:06
    Hello Sree,

    The XL C/C++ compiler can be invoked from different environments: from a batch job, in a TSO session, or in a USS shell. You can find more details in the chapter "Compiling" of XL C/C++ User's Guide:

    https://www.ibm.com/support/knowledgecenter/SSLTBW_2.4.0/com.ibm.zos.v2r4.cbcux01/clemvs.htm

    In particular, the following topics describe various environments:

    https://www.ibm.com/support/knowledgecenter/SSLTBW_2.4.0/com.ibm.zos.v2r4.cbcux01/mvscomp.htm
    https://www.ibm.com/support/knowledgecenter/SSLTBW_2.4.0/com.ibm.zos.v2r4.cbcux01/tsocc2.htm
    https://www.ibm.com/support/knowledgecenter/SSLTBW_2.4.0/com.ibm.zos.v2r4.cbcux01/compwel.htm

    Of these three, USS shell provides the easiest way to call XL C to compile and link-edit your z/OS program. To use it, you need to install an SSH client on your PC - PuTTY would be a good choice:

    https://www.putty.org/

    Once installed, run the SSH client and connect to your mainframe via SSH. Then, you can invoke XL C from SSH command line like this:

    xlc -qascii -q64 -L/path/to/libcurl -o my-program my-program.c -lcurl

    This will compile and link your program into an executable file 'my-program', which can be run on z/OS. The -L and -l parameters also specify to link it with libcurl.

    The headers shipped with libcurl are by default tagged as ISO8859-1. There's no need to convert them manually to EBCDIC. USS converts tagged files on-the-fly for you, provided that automatic conversion is enabled. That's how we compile curl and other open source tools.

    To enable automatic conversion, set the following environment variables in your SSH session:

    export _CEE_RUNOPTS="FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)"
    export _BPXK_AUTOCVT=ON
    export _TAG_REDIR_ERR=txt
    export _TAG_REDIR_IN=txt
    export _TAG_REDIR_OUT=txt

    More details about file tags and automatic conversion can be found here:

    https://www.ibm.com/support/knowledgecenter/SSLTBW_2.4.0/com.ibm.zos.v2r4.bpxb200/xpascii.htm
    https://www.ibm.com/support/knowledgecenter/SSLTBW_2.4.0/com.ibm.zos.v2r4.bpxb200/uenha.htm
    https://www.ibm.com/support/knowledgecenter/SSLTBW_2.4.0/com.ibm.zos.v2r4.bpxa400/bpxug292.htm
    https://www.ibm.com/support/knowledgecenter/SSLTBW_2.4.0/com.ibm.zos.v2r4.bpxa400/bpxug294.htm
    https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.4.0/com.ibm.zos.v2r4.bpxb200/bpxkenv.htm
    https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.4.0/com.ibm.zos.v2r4.bpxa500/chtag.htm

    I know it looks like a long list of URLs; these pages describe tagging and conversion from different perspectives. Tagging is an integral feature of Unix/USS on z/OS, and it's important to be familiar with it.

    Regards,
    Vladimir

    ------------------------------
    Vladimir Ein
    Rocket Software
    ------------------------------