Open Source Development

Power Open Source Development

Explore the open source tools and capabilities for building and deploying modern applications on IBM Power platforms including AIX, IBM i, and Linux.


#Power


#Power

 View Only
  • 1.  Not possible to link pcre library 8.42 or 8.43

    Posted Mon July 20, 2020 11:37 AM
    It's not possible to link pcre library 8.42 or 8.43 from AIX Toolbox. pcre library 8.33 works.

    Sample source main.C:
    #include <iostream>
    #include <string>
    #include <pcrecpp.h>
    int main() {
     std::string line = "BLAH FASL";
     std::cout << "before: " << line << std::endl;
     pcrecpp::RE re(" ");
     re.Replace("", &line);
     std::cout << "after: " << line << std::endl;
     return 0;
    }

    Compile command and output:
    # xlC -bnoquiet -I/opt/freeware/include -lpcre -lpcrecpp main.C -o out
    (ld): halt 4
    (ld): setopt tmplrename
    (ld): setfflag 4
    (ld): cdtors 0 all 0 s
    (ld): savename out
    (ld): filelist 11 1
    (ld): i /lib/crt0.o
    (ld): i /lib/crti.o
    (ld): lib /usr/lib/libpcre.a
    (ld): lib /usr/lib/libpcrecpp.a
    (ld): i /tmp/11730958_0.o
    (ld): lib /opt/IBM/xlc/13.1.3/lib/libxlopt.a
    (ld): lib /opt/IBM/xlc/13.1.3/lib/libxlipa.a
    (ld): lib /opt/IBM/xlc/13.1.3/lib/libxl.a
    (ld): lib /usr/lib/libC.a
    (ld): lib /usr/lib/libm.a
    (ld): lib /usr/lib/libc.a
    LIBRARY: Shared object libpcre.a[libpcre.so.1]: 57 symbols imported.
    LIBRARY: Shared object libpcrecpp.a[libpcrecpp.so.0]: 173 symbols imported.
    LIBRARY: Symbols imported from import file /usr/lib/libC.a[shr_32.imp]: 403
    LIBRARY: Symbols imported from import file /usr/lib/libC.a[shr2_32.imp]: 42
    LIBRARY: Symbols imported from import file /usr/lib/libC.a[shr3_32.imp]: 34
    LIBRARY: Symbols imported from import file /usr/lib/libC.a[ansi_32.imp]: 3720
    LIBRARY: Symbols imported from import file /usr/lib/libC.a[shr_64.imp]: 0
    LIBRARY: Symbols imported from import file /usr/lib/libC.a[shr2_64.imp]: 0
    LIBRARY: Symbols imported from import file /usr/lib/libC.a[shr3_64.imp]: 0
    LIBRARY: Symbols imported from import file /usr/lib/libC.a[ansi_64.imp]: 0
    LIBRARY: Shared object libc.a[shr.o]: 3306 symbols imported.
    LIBRARY: Shared object libc.a[meth.o]: 2 symbols imported.
    LIBRARY: Shared object libc.a[posix_aio.o]: 20 symbols imported.
    LIBRARY: Shared object libc.a[aio.o]: 18 symbols imported.
    LIBRARY: Shared object libc.a[pse.o]: 8 symbols imported.
    LIBRARY: Shared object libc.a[dl.o]: 4 symbols imported.
    LIBRARY: Shared object libc.a[pty.o]: 1 symbols imported.
    LIBRARY: Shared object libc.a[cthread.o]: 25 symbols imported.
    LIBRARY: Shared object libc.a[uchar.o]: 4 symbols imported.
    FILELIST: Number of previously inserted files processed: 11
    (ld): resolve
    RESOLVE: 85 of 14274 symbols were kept.
    (ld): addgl /usr/lib/glink.o
    ADDGL: Glink code added for 17 symbols.
    (ld): er full
    ld: 0711-318 ERROR: Undefined symbols were found.
    The following symbols are in error:
    Symbol Inpndx TY CL Source-File(Object-File) OR Import-File{Shared-object}
    RLD: Address Section Rld-type Referencing Symbol
    ----------------------------------------------------------------------------------------------
    .pcrecpp::RE::Init(const std::basic_string<char,std::char_traits<char>,std::allocator<char> >&,const pcrecpp::RE_Options*) [76] ER PR main.C(/tmp/11730958_0.o)
    00000110 .text R_RBR [14] .pcrecpp::RE::RE(const char*)
    .pcrecpp::RE::Replace(const pcrecpp::StringPiece&,std::basic_string<char,std::char_traits<char>,std::allocator<char> >*) const [88] ER PR main.C(/tmp/11730958_0.o)
    ld: 0711-317 ERROR: Undefined symbol: .pcrecpp::RE::Init(const std::basic_string<char,std::char_traits<char>,std::allocator<char> >&,const pcrecpp::RE_Options*)
    ld: 0711-317 ERROR: Undefined symbol: .pcrecpp::RE::Replace(const pcrecpp::StringPiece&,std::basic_string<char,std::char_traits<char>,std::allocator<char> >*) const
    00000358 .text R_RBR [20] .main
    .pcrecpp::RE::~RE() [90] ER PR main.C(/tmp/11730958_0.o)
    00000398 .text R_RBR [20] .main
    00000418 .text R_RBR [22] .pcrecpp::RE::__dftdt()
    ER: The return code is 8.
    ld: 0711-317 ERROR: Undefined symbol: .pcrecpp::RE::~RE()



    ------------------------------
    Emanuel Reisinger
    ------------------------------

    #AIXOpenSource


  • 2.  RE: Not possible to link pcre library 8.42 or 8.43

    Posted Tue July 21, 2020 02:17 AM
    The latest pcre is built with gcc compiler.
    This undefined symbol error is mostly due to symbol name mangling different while using xlc compiler to link with gcc compiled library.
    Can you try building with gcc ?

    ------------------------------
    SANGAMESH
    ------------------------------



  • 3.  RE: Not possible to link pcre library 8.42 or 8.43

    Posted Tue July 21, 2020 04:39 AM
    That's bad. We are using only xlc.
    I've installed gcc/g++. Now, it works linking pcre 8.42 or 8.43.

    So we have to stick on pcre version 8.33 when compiling with xlc and can't use the newest bugfixes any more.


    Compiling an app that requires libcairo, libpango and libglib (newest versions of that libraries) I have no problems using xlC or g++. But with libpcre I have to use a specific library version depending on which compiler is used (xlc: pcre-8.33, g++: pcre-8.42).

    Is it possible to provide the pcre library that works with xlc and gcc either? It seems for cairo, pango and glib it's possible.

    ------------------------------
    Emanuel Reisinger
    ------------------------------



  • 4.  RE: Not possible to link pcre library 8.42 or 8.43

    Posted Tue July 21, 2020 07:16 AM
    Looks like cairo, pango and glib library doesn't have C++ mangled symbols.
    We will check if still there are ways to link to library like libpcrecpp.

    ------------------------------
    SANGAMESH
    ------------------------------



  • 5.  RE: Not possible to link pcre library 8.42 or 8.43

    Posted Tue July 21, 2020 10:05 AM
    You are right, cairo, pango and glib have only c interfaces and therefore name mangling does not matter.

    I remembered name mangling and I would be satisfied if you could provide a libpcrecpp for xlC and a libpcrecpp-gcc or libpcrecpp-g++ for g++ compiler.
    I suggest this convention should be applied to all packages of aix toolbox.

    ------------------------------
    Emanuel Reisinger
    ------------------------------



  • 6.  RE: Not possible to link pcre library 8.42 or 8.43

    Posted Tue July 21, 2020 10:20 AM
    Hi Emanuel,

    This will be really huge and unmanageable task to provide all packages with xlc and gcc. 
    I don't think we will be able to do that. 
    We had the similar issue when we were providing packages with xlC. But there we had bigger challenge in those cases if user doesn't to have xlC license they were not able to build at all. Now as we have moved to gcc you will always be able to get the compiler from AIX toolbox.

    For a long run perspective we can look deep into if we can have compatible managing and de-mangling support in xlc and gcc but that all depends on community and work involved.

    We also publish SRPM for all packages. One thing you can do is download the SRPM for latest pcre and build it with xlc by just changing the compiler and flags in spec file. If you run into issue you can use this forum.
    Here is an article for building rpm on AIX using srpm. 
    https://developer.ibm.com/technologies/systems/articles/au-aix-build-open-source-rpm-packages/

    ------------------------------
    SANKET RATHI
    ------------------------------



  • 7.  RE: Not possible to link pcre library 8.42 or 8.43

    Posted Wed July 22, 2020 07:17 AM
    I suppose that's the reason why pcre2 does not provide C++ wrappers.

    If I understand you correctly, all packages from AIX toolbox are compiled with gcc now. Since when (date) is this done? With this information the correct packages can be downloaded from the ftp site.
    This information is important for developers regarding the used compiler and should be published on AIX toolbox website. Further an explanation on the website or in the FAQs why you moved to gcc would be helpful and interesting.
    Why do you moved to gcc?

    But the same applies to those who don't have a xlc license and use gcc. They could use the SRPM packages to build it with gcc.

    When developing an application it's economic to reuse code, using already implemented features (libraries). When the support for xlc decreases users who use xlc may switch to gcc. I suppose that's against IBM's business.
    So please do not decrease xlc support but rather increase it.

    ------------------------------
    Emanuel Reisinger
    ------------------------------



  • 8.  RE: Not possible to link pcre library 8.42 or 8.43

    Posted Wed July 22, 2020 09:59 AM
    Hi Emanuel,

    It is not about decreasing xlc support. We want to create more open environment for open source packages on AIX.
    So that many more can participate and not blocked by the compiler availability.
    All the version of gcc are available on our AIX toolbox repo that we have used to build the packages. 
    We moved to gcc 2-3 years before. It was a gradual process as and when we started republishing packages we started building with gcc. 
    Now anyone who want to contribute to AIX open source environment they can collaborate and use all the tools available on AIX toolbox. 



    ------------------------------
    SANKET RATHI
    ------------------------------