Programming Languages on Power

Power Programming Languages

IBM Power, including the AIX, IBM i, and Linux operating systems, support a wide range of programming languages, catering to both traditional enterprise applications and modern development needs.


#Power


#Servers
#Programminglanguages
 View Only
  • 1.  Exceptions with XL C++ compiler

    Posted 06/24/20 04:16 AM
    Edited by JING CHEN 06/24/20 07:49 AM
    Disclaimer: This post is migrated from IBM Developer Answers that is no longer in use. Its original author is rural_juror, posted on Feb. 14, 2020.

    I'm trying to compile a code but the linker complains about missing references to __IBMCPlusPlusExceptionV3 and __UnsupportedConditionalExpressionDestruction.

    This pure C code uses a static C++ library (which uses exception) which has to be compiled in a bit of a particular way. Long story short, it takes individually compiled object files, uses the objcopy utility to rename some of the symbols, then uses ar and ranlib to make a static library (`.a`).

    The problem is apparently that the XL compiler at the last stage has no information that the library uses exceptions, so doesn't link to necessary symbols. So how am I supposed to manually tell the linker where to find these?

    -------------------------------------------------------------
    Question asked by rural_juroron Feb. 14, 2020
    -------------------------------------------------------------


    #C/C++andFortran


  • 2.  RE: Exceptions with XL C++ compiler

    Posted 06/24/20 04:18 AM
    Edited by JING CHEN 06/24/20 06:54 AM

    Are you using xlc to link? If so, try linking with xlC. The missing symbols are from the XL C/C++ personality routines library libibmc++.so. The xlC invocation command links it in by default. Alternatively, you can link in the library manually by adding:

    -L/opt/ibm/xlC/16.1.1/lib -R/opt/ibm/lib -libmc++

    to your link line. If you don't want your binary to depend on the IBM libibmc++.so library, you can statically link it in by linking with xlC and adding -qstaticlink=xllibs.

    -----------------------------------------------------------
    Answered by Rafik_Zurob on Feb. 17, 2018
    -----------------------------------------------------------





  • 3.  RE: Exceptions with XL C++ compiler

    Posted 06/24/20 04:20 AM
    Edited by JING CHEN 06/24/20 07:50 AM
    Thanks! -libmc++ was sufficient actually (I guess the library is already in the search path). Yes, I was using xl to link (through mpicc), the problem was that the exception containing code was no linked with xl.

    ----------------------------------------------------
    Replied by rural_juroron Feb. 19, 2020
    ----------------------------------------------------