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.  linking gobject-2.0 with run-time link (-brtl) results in load-time error

    Posted Wed September 09, 2020 11:13 AM

    When I want to link libgobject-2.0 (glib2-2.56.1-2.ppc) with -brtl link option I get this error on load-time:

    ./out

    (process:8323300): GLib-GObject-WARNING **: 16:28:46.774: cannot register existing fundamental type 'gchar' (as 'gchar')
    **
    GLib-GObject:ERROR:gvaluetypes.c:455:_g_value_types_init: assertion failed: (type == G_TYPE_CHAR)Resources lost(coredump)
    Compilation and linkage is done with (xlC or xlC_r or g++):
    xlC_r -D__AIX -g -q64 -Wl,-b64 -Wl,-brtl -bl:_lmap -qlanglvl=nullptr -I/usr/include -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/opt/freew are/include -L/opt/freeware/lib64 -L/opt/freeware/lib -lm -lcairo -lpango-1.0 -lpangocairo-1.0 -lgobject-2.0 - lglib-2.0 -lpcre2-8 CairoReportBase.C InvoiceReport.C InvoiceReportBase.C PangoHelper.C StandardReportBase.C main.C -o out
    or
    g++ -D__AIX -g -maix64 -Wl,-b64 -Wl,-brtl -I/usr/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/cairo -I/usr/include/pango-1.0 -I/opt/freeware/include -lm -lcairo -lpango-1.0 -lpangocairo-1.0 -lgobject-2.0 -lglib-2.0 -L/opt/freeware/lib64 -L/opt/freeware/lib -lpcre2-8 CairoReportBase.C InvoiceReport.C InvoiceReportBase.C PangoHelper.C StandardReportBase.C main.C -o out_gnu

    Without -brtl the load-time error does not occur.
    With -brtl set and defining /opt/freeware/lib/libgobject-2.0.a directly instead of -lgobject-2.0 the load-time error does not occur, too.

    But the object in archive /opt/freeware/lib/libgobject-2.0.a and the object in /opt/freeware/lib64/libgobject-2.0.so.0 seems to be the same (checked with sum and dump).​
    dbx out
    Type 'help' for help.
    [using memory image in core]
    reading symbolic information ...

    IOT/Abort trap in pthread_kill at 0x900000000558f94 ($t1)
    0x900000000558f94 (pthread_kill+0xd4) e8410028 ld r2,0x28(r1)
    (dbx) where
    pthread_kill(??, ??) at 0x900000000558f94
    _p_raise(??) at 0x9000000005587e4
    raise.raise(??) at 0x900000000039d68
    abort() at 0x9000000000563e4
    internal error: unexpected value 120 at line 5201 in file stabstring.c
    internal error: unexpected value 120 at line 5201 in file stabstring.c
    internal error: unexpected value 120 at line 5201 in file stabstring.c
    internal error: unexpected value 120 at line 5201 in file stabstring.c
    internal error: unexpected value 120 at line 5201 in file stabstring.c
    internal error: unexpected value 120 at line 5201 in file stabstring.c
    internal error: unexpected value 120 at line 5201 in file stabstring.c
    internal error: unexpected value 120 at line 5201 in file stabstring.c
    internal error: unexpected value 120 at line 5201 in file stabstring.c
    internal error: unexpected value 120 at line 5201 in file stabstring.c
    internal error: unexpected value 120 at line 5201 in file stabstring.c
    internal error: expected char ',', found 's__LC_locale:,1088,64;__meth_ptr:165,1152,64;__data_ptr:165,1216,64;;'
    internal error: expected char ',', found '__LC_locale:,1088,64;__meth_ptr:165,1152,64;__data_ptr:165,1216,64;;'
    internal error: expected char ';', found '_LC_locale:,1088,64;__meth_ptr:165,1152,64;__data_ptr:165,1216,64;;'
    internal error: unexpected value 44 at line 5201 in file stabstring.c
    internal error: expected char ',', found '1088,64;__meth_ptr:165,1152,64;__data_ptr:165,1216,64;;'
    internal error: unexpected value 120 at line 5201 in file stabstring.c
    internal error: unexpected value 120 at line 5201 in file stabstring.c
    internal error: expected char ',', found 's_LC_locale_objhdl:,128,64;;'
    internal error: expected char ',', found '_LC_locale_objhdl:,128,64;;'
    internal error: expected char ';', found 'LC_locale_objhdl:,128,64;;'
    internal error: unexpected value 44 at line 5201 in file stabstring.c
    internal error: expected char ',', found '128,64;;'
    internal error: unexpected value 120 at line 5201 in file stabstring.c
    internal error: unexpected value 120 at line 5201 in file stabstring.c
    internal error: unexpected value 120 at line 5201 in file stabstring.c
    ... ---==== the stack trace is very long ===---
    internal error: unexpected value 120 at line 5201 in file stabstring.c
    internal error: unexpected value 120 at line 5201 in file stabstring.c
    internal error: unexpected value 120 at line 5201 in file stabstring.c
    internal error: unexpected value 120 at line 5201 in file stabstring.c
    internal error: unexpected value 66 at line 5201 in file stabstring.c
    internal error: expected char ',', found '1828=*1815,256,64;qname:369,320,32;global_gdata:964,384,64;_prot:1829=u8iface_entries:1780,0,64;offsets:1780,0,64;;,448,64;prerequisites:1826,512,64;supers:1830=ar117;0;0;1519,576,64;;'
    internal error: expected char ',', found '=*1815,256,64;qname:369,320,32;global_gdata:964,384,64;_prot:1829=u8iface_entries:1780,0,64;offsets:1780,0,64;;,448,64;prerequisites:1826,512,64;supers:1830=ar117;0;0;1519,576,64;;'
    internal error: expected char ';', found '*1815,256,64;qname:369,320,32;global_gdata:964,384,64;_prot:1829=u8iface_entries:1780,0,64;offsets:1780,0,64;;,448,64;prerequisites:1826,512,64;supers:1830=ar117;0;0;1519,576,64;;'
    internal error: unexpected value 66 at line 5201 in file stabstring.c
    internal error: expected char ',', found '-1,96,32;class_init_base:1545,128,64;class_finalize_base:1546,192,64;class_init:1547,256,64;class_finalize:1548,320,64;class_data:318,384,64;class:317,448,64;;'
    internal error: expected char ';', found ',32;class_init_base:1545,128,64;class_finalize_base:1546,192,64;class_init:1547,256,64;class_finalize:1548,320,64;class_data:318,384,64;class:317,448,64;;'
    internal error: unexpected value 120 at line 5201 in file stabstring.c
    internal error: unexpected value 66 at line 5201 in file stabstring.c
    gtype.gobject_init(), line 4423 in "gtype.c"
    gtype.gobject_init_ctor(), line 4488 in "gtype.c"
    gtype._GLOBAL__I_65535_0_gtype.c_BA64600E_0xcd4a8275a3eeda() at 0x900000006a9db90
    cceurC4c._GLOBAL__FI_libgobject_2_0_so() at 0x9000000072574a4
    mod_init1(??, ??) at 0x9fffffff000b4f0
    usl_init_mods(??, ??) at 0x9fffffff000c2b0
    usl_exec_init_modsx(??, ??, ??) at 0x9fffffff000b3a0
    call_chkpntblk.usl_exec_init_mods() at 0x9fffffff0001184
    (dbx)

    dump -X64 -H out

    out:

    ***Loader Section***
    Loader Header Information
    VERSION# #SYMtableENT #RELOCent LENidSTR
    0x00000001 0x00000073 0x00000189 0x00000182

    #IMPfilID OFFidSTR LENstrTBL OFFstrTBL
    0x0000000b 0x00002390 0x00000e23 0x00002512


    ***Import File Strings***
    INDEX PATH BASE MEMBER
    0 /opt/freeware/lib64:/opt/freeware/lib:/opt/IBM/xlmass/8.1.3/lib/aix61:/opt/IBM/xlc/13.1.3/lib:/opt/IBM/xlC/13.1.3/lib:/usr/lib:/lib
    1 libcairo.a libcairo.so.2
    2 libpango-1.0.a libpango-1.0.so.0
    3 libpangocairo-1.0.a libpangocairo-1.0.so.0
    4 libgobject-2.0.so
    5 libglib-2.0.so
    6 libpcre2-8.a libpcre2-8.so.0
    7 libC.a shr_64.o
    8 libC.a ansi_64.o
    9 libpthreads.a shr_xpg5_64.o
    10 libc.a shr_64.o
    The program above is only a prototype and will be linked to many more libraries from us (self made libraries) at the end and we want to use the -brtl option to keep the program size small. Defining /opt/freeware/lib/libgobject-2.0.a at linkage would be possibly a workaround.

    But why does it not work to link libgobject-2.0.so with run-time linking (-brtl) enabled?


    Some more environment information:
    oslevel
    7100-03-04-1441

    xlc -qversion
    IBM XL C/C++ for AIX, V13.1.3 (5725-C72, 5765-J07)
    Version: 13.01.0003.0000
    LIBPATH and LD_LIB_PATH not set.

    Installed rpms (all from AIX Toolbox with yum):
    AIX-rpm-7.1.3.30-2.ppc
    ImageMagick-7.0.10.23-1.ppc
    ImageMagick-libs-7.0.10.23-1.ppc
    apr-1.5.2-1.ppc
    apr-util-1.5.4-1.ppc
    bash-5.0-1.ppc
    bzip2-1.0.8-2.ppc
    ca-certificates-2019.01.10-2.ppc
    cairo-1.14.6-2waixX11.ppc
    cairo-devel-1.14.6-2waixX11.ppc
    curl-7.71.1-1.ppc
    cyrus-sasl-2.1.26-3.ppc
    db-6.2.38-2.ppc
    expat-2.2.9-2.ppc
    expat-devel-2.2.9-2.ppc
    file-5.38-1.ppc
    file-libs-5.38-1.ppc
    fontconfig-2.11.95-4.ppc
    fontconfig-devel-2.11.95-4.ppc
    freetype2-2.8-1.ppc
    freetype2-devel-2.8-1.ppc
    gcc-8.3.0-2.ppc
    gcc-c++-8.3.0-2.ppc
    gcc-cpp-8.3.0-2.ppc
    gdbm-1.18.1-1.ppc
    gettext-0.19.8.1-5.ppc
    ghostscript-9.50-1.ppc
    ghostscript-fonts-8.11-1.noarch
    git-2.20.4-1.ppc
    glib2-2.56.1-2.ppc
    glib2-devel-2.56.1-2.ppc
    gmp-6.1.2-1.ppc
    gzip-1.10-1.ppc
    harfbuzz-1.2.7-2.ppc
    info-6.6-2.ppc
    intltool-0.51.0-2.noarch
    jbigkit-devel-2.1-1.ppc
    jbigkit-libs-2.1-1.ppc
    krb5-libs-1.16.1-4.ppc
    less-557-1.ppc
    libXft-2.3.2-4waixX11.ppc
    libXrender-0.9.8-2waixX11.ppc
    libXrender-devel-0.9.8-2waixX11.ppc
    libffi-3.2.1-3.ppc
    libgcc-8.3.0-2.ppc
    libgomp-8.3.0-2.ppc
    libiconv-1.16-1.ppc
    libjpeg-9d-1.ppc
    libmpc-1.1.0-1.ppc
    libnghttp2-1.41.0-1.ppc
    libpaper-1.1.24-2.ppc
    libpng-1.6.27-3.ppc
    libpng-devel-1.6.27-3.ppc
    libssh2-1.9.0-1.ppc
    libstdc++-8.3.0-2.ppc
    libstdc++-devel-8.3.0-2.ppc
    libtiff-4.1.0-1.ppc
    libtiff-devel-4.1.0-1.ppc
    libunistring-0.9.9-2.ppc
    libwebp-1.0.2-1.ppc
    libxml2-2.9.9-1.ppc
    lzo-2.10-2.ppc
    make-4.2.1-5.ppc
    mpfr-4.0.2-2.ppc
    ncurses-6.2-1.ppc
    openldap-2.4.48-1.ppc
    p11-kit-0.23.16-1.ppc
    p11-kit-tools-0.23.16-1.ppc
    pango-1.40.1-2waixX11.ppc
    pango-devel-1.40.1-2waixX11.ppc
    pcre-8.33-1.ppc
    pcre-devel-8.33-1.ppc
    pcre2-10.34-1.ppc
    pcre2-devel-10.34-1.ppc
    perl-5.30.3-1.ppc
    pixman-0.34.0-1.ppc
    pkg-config-0.29.2-2.ppc
    pysqlite-2.8.3-2.ppc
    python-2.7.18-1.ppc
    python-devel-2.7.18-1.ppc
    python-iniparse-0.4-1.noarch
    python-pycurl-7.43.0-1.ppc
    python-tools-2.7.18-1.ppc
    python-urlgrabber-3.10.1-1.noarch
    readline-8.0-2.ppc
    readline-devel-8.0-2.ppc
    renderproto-0.11.1-1.ppc
    rsync-3.1.3-5.ppc
    serf-1.3.9-2.ppc
    sqlite-3.32.1-1.ppc
    subversion-1.10.6-2.ppc
    tcl-8.6.8-3.ppc
    tk-8.6.8-3.ppc
    urw-fonts-2.0-1.noarch
    wget-1.20.3-1.ppc
    xz-libs-5.2.5-1.ppc
    yum-3.4.3-7.noarch
    yum-metadata-parser-1.1.4-2.ppc
    zip-3.0-4.ppc
    zlib-1.2.11-1.ppc
    zlib-devel-1.2.11-1.ppc


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

    #AIXOpenSource


  • 2.  RE: linking gobject-2.0 with run-time link (-brtl) results in load-time error

    Posted Wed September 09, 2020 01:08 PM
    There is a packaging issue with glib2 rpm . It should only ship archives (.a) containing the .so libraries. 
    It should not ship .so libraries as such. We will fix this. In the meanwhile , suggest you to remove the all .so files delivered by glib2 rpm.

    The root cause of the problem here is when we use "-brtl" flag, "libraries ending with .so has more priority than .a and so the code links to .so. But other libraries like libcairo, libpangocairo  links to libglib-2.0.a(libgobject-2.0.a) . I see your application links to these libraries which already would have loaded libglib-2.0.a ,libgobject-2.0.a and tries to load libglib-2.0.so (libgobject-2.0.so). So there is a module initialization failure.

    ------------------------------
    Ayappan P
    ------------------------------



  • 3.  RE: linking gobject-2.0 with run-time link (-brtl) results in load-time error

    Posted Thu September 10, 2020 01:50 AM
    After removing all .so files from glib2 I have no troubles so far.

    Thanks!

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