AIX Open Source

AIX Open Source

Share your experiences and connect with fellow developers to discover how to build and manage open source software for the AIX operating system

 View Only
  • 1.  gcc: strange error message at config stage

    Posted Wed April 19, 2023 08:04 AM
    Edited by C- -T Wed April 19, 2023 08:04 AM

    Hi,

    while trying to build curl from source configure bails out with some crazy error...

    configure:34032: checking run-time libs availability
    configure:34088: gcc -O2 -o conftest -maix64 -I/opt/freeware/include -Werror-implicit-function-declaration -O2 -Wno-system-headers -maix64 -I/opt/freeware/include -I/opt/freeware/include   -I/opt/freeware/include -L/opt/freeware/lib64 -L/opt/freeware/lib -Wl,-blibpath:/opt/freeware/lib64:/opt/freeware/lib:/usr/lib:/lib -L/opt/freeware/lib   -L/opt/freeware/lib64 conftest.c -lnghttp2 -lssh2  -lssl -lcrypto -lldap -llber -lz  >&5
    Could not load program gcc:
    Could not load module /opt/freeware/lib/libiconv.a(libiconv.so.2).
            Dependent module /opt/freeware/lib64/libgcc_s.a(shr.o) could not be loaded.
            The module has an invalid magic number.
    Could not load module gcc-10.
            Dependent module /opt/freeware/lib/libiconv.a(libiconv.so.2) could not be loaded.
    Could not load module .
    configure:34088: $? = 255
    configure: program exited with status 255
    configure: failed program was:
    | /* confdefs.h */
    


    i checked some libraries and gcc, but i see no context between the error message and the situation on the compiler side and installed libs.

    root@aixbuildhostng: /home/packagebuilder/test/curl-7.86.0 #
    root@aixbuildhostng: /home/packagebuilder/test/curl-7.86.0 # gcc -v
    Using built-in specs.
    COLLECT_GCC=gcc
    COLLECT_LTO_WRAPPER=/opt/freeware/libexec/gcc/powerpc-ibm-aix7.1.0.0/10/lto-wrapper
    Target: powerpc-ibm-aix7.1.0.0
    Configured with: ../gcc-10.3.0/configure --prefix=/opt/freeware --mandir=/opt/freeware/man --infodir=/opt/freeware/info --with-local-prefix=/opt/freeware --enable-languages=c,c++,fortran,go --enable-version-specific-runtime-libs --disable-nls --disable-libstdcxx-pch --disable-werror --enable-libstdcxx-filesystem-ts --with-gcc-major-version-only --program-suffix=-10 --with-cpu=default32 --host=powerpc-ibm-aix7.1.0.0
    Thread model: aix
    Supported LTO compression algorithms: zlib
    gcc version 10.3.0 (GCC)
    
    root@aixbuildhostng: /home/packagebuilder/test/curl-7.86.0 # ar -X64 tv /opt/freeware/lib64/libgcc_s.a
    rwxr-xr-x     0/0     376375 Dec 15 11:02 2021 shr.o
    root@aixbuildhostng: /home/packagebuilder/test/curl-7.86.0 # ar -X64 tv /opt/freeware/lib/libiconv.a
    rwxr-xr-x   203/1     1227053 Jun 02 11:18 2022 libiconv.so.2
    r--r--r--     0/0     310767 Jul 04 11:17 2022 shr4_64.o
    root@aixbuildhostng: /home/packagebuilder/test/curl-7.86.0 # echo $OBJECT_MODE
    64
    root@aixbuildhostng: /home/packagebuilder/test/curl-7.86.0 # echo $LIBPATH
    
    


    any idea?

    best

    chris



    ------------------------------
    I regret starting this entire conversation
    ------------------------------



  • 2.  RE: gcc: strange error message at config stage

    Posted Wed April 19, 2023 08:32 AM

    Hi,

    Please share the configure script options passed to ./configure and env output . 



    ------------------------------
    Ranjit Ranjan
    IBM
    Ranjit.Ranjan@ibm.com
    ------------------------------



  • 3.  RE: gcc: strange error message at config stage

    Posted Wed April 19, 2023 10:25 AM
    root@aixbuildhostng: /home/packagebuilder/test/curl-7.86.0 # env
    SHELL=/usr/bin/bash
    LC__FASTMSG=true
    HISTSIZE=2000
    ODMDIR=/etc/objrepos
    HISTTIMEFORMAT=%F %T |
    AUTHSTATE=compat
    EDITOR=vi
    ENV=/root/.kshrc
    PWD=/home/packagebuilder/test/curl-7.86.0
    LOGNAME=root
    TZ=Europe/Vienna
    OBJECT_MODE=64
    LDFLAGS=-L/opt/freeware/lib64 -L/opt/freeware/lib -Wl,-blibpath:/opt/freeware/lib64:/opt/freeware/lib:/usr/lib:/lib
    HOME=/root
    LANG=en_US
    AIXTHREAD_SCOPE=S
    NMON=Bc
    CPPFLAGS=-maix64 -I/opt/freeware/include
    SSH_CONNECTION=172.17.8.4 55877 172.17.10.95 22
    TERM=xterm
    USER=root
    CURL_CA_BUNDLE=/etc/itsv-ca-bundle.crt
    AR=/usr/bin/ar -X32_64
    LOGIN=root
    SHLVL=1
    LOCPATH=/usr/lib/nls/loc
    EXTENDED_HISTORY=ON
    MAILMSG=[YOU HAVE NEW MAIL]
    PS1=root@aixbuildhostng: $PWD #
    SSH_CLIENT=172.17.8.4 55877 22
    PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java8_64/jre/bin:/opt/freeware/bin:/opt/freeware/sbin:.:/usr/lib/instl:/usr/local/bin:/opt/freeware/bin:/usr/es/sbin/cluster:/usr/es/sbin/cluster/utilities:/usr/es/sbin/cluster/cspoc
    CC=gcc -O2
    HISTFILESIZE=2000
    CFLAGS=-maix64 -I/opt/freeware/include
    MAIL=/usr/spool/mail/root
    SSH_TTY=/dev/pts/0
    OLDPWD=/home/packagebuilder/test
    _=/usr/bin/env
    NLSPATH=/usr/lib/nls/msg/%L/%N:/usr/lib/nls/msg/en_US/%N:/usr/lib/nls/msg/%L/%N.cat:/usr/lib/nls/msg/en_US/%N.cat:/usr/lib/nls/msg/%l.%c/%N:/usr/lib/nls/msg/%l.%c/%N.cat
    root@aixbuildhostng: /home/packagebuilder/test/curl-7.86.0 # ./configure  --prefix=/home/packagebuilder/apachelibinc --with-ssl --with-ca-path=/var/ssl/certs/ --enable-shared --enable-static --enable-ldap --with-libssh2 --without-zstd --with-nghttp2


    ------------------------------
    I regret starting this entire conversation
    ------------------------------



  • 4.  RE: gcc: strange error message at config stage

    Posted Wed April 19, 2023 10:47 AM

    gcc being a 32-bit binary has /opt/freeware/lib as it's libpath , so it should not go to /opt/freeware/lib64 to look for libgcc_s.a unless LIBPATH is set. 
    You don't have LIBPATH set which makes this error very surprising. Can you paste the output of "ldd /opt/freeware/bin/gcc" ? 



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



  • 5.  RE: gcc: strange error message at config stage

    Posted Thu April 20, 2023 04:16 AM
    root@aixbuildhostng: /root # file /opt/freeware/bin/gcc
    /opt/freeware/bin/gcc: executable (RISC System/6000) or object module
    
    root@aixbuildhostng: /root # ldd /opt/freeware/bin/gcc
    /opt/freeware/bin/gcc needs:
             /usr/lib/libc.a(shr.o)
             /opt/freeware/lib/libiconv.a(libiconv.so.2)
             /unix
             /usr/lib/libcrypt.a(shr.o)
             /opt/freeware/lib/libgcc_s.a(shr.o)
    
    root@aixbuildhostng: /root # dump -Xany -TvH /opt/freeware/bin/gcc
    
    /opt/freeware/bin/gcc:
    
                            ***Loader Section***
                          Loader Header Information
    VERSION#         #SYMtableENT     #RELOCent        LENidSTR
    0x00000001       0x000000d4       0x0000307c       0x00000168
    
    #IMPfilID        OFFidSTR         LENstrTBL        OFFstrTBL
    0x00000003       0x000259d0       0x00000385       0x00025b38
    
    
                            ***Import File Strings***
    INDEX  PATH                          BASE                MEMBER
    0      /opt/freeware/src/packages/BUILD/gcc-build-10.3.0/prev-powerpc-ibm-aix7.1.0.0/libstdc++-v3/src/.libs:/opt/freeware/src/packages/BUILD/gcc-build-10.3.0/prev-powerpc-ibm-aix7.1.0.0/libstdc++-v3/libsupc++/.libs:/opt/freeware/src/packages/BUILD/gcc-build-10.3.0/./prev-gcc:/opt/freeware/lib:/usr/lib:/lib
    1                                    libc.a              shr.o
    2      /opt/freeware/lib             libiconv.a          libiconv.so.2
    


    ------------------------------
    I regret starting this entire conversation
    ------------------------------



  • 6.  RE: gcc: strange error message at config stage

    Posted Thu April 20, 2023 05:15 AM

    i did a build with no cflags/ldflags and the least possible configure options and it went through without errors, so it must have something to do with the  flags.
    as i took the flags from your curl spec file one to one  i can not comprehend whats going on here.

    root@aixbuildhostng: /home/packagebuilder/test/curl-7.86.0 # ./configure  --without-ssl --without-nghttp2
    ...
    configure: Configured to build curl/libcurl:
    
      Host setup:       powerpc-ibm-aix7.1.5.0
      Install prefix:   /usr/local
      Compiler:         gcc
       CFLAGS:          -Werror-implicit-function-declaration -O2 -Wno-system-headers -pthread
       CPPFLAGS:        -isystem /opt/freeware/include
       LDFLAGS:         -L/opt/freeware/lib
       LIBS:            -lldap -llber -lzstd -lz
    
      curl version:     7.86.0
      SSL:              no      (--with-{openssl,gnutls,nss,mbedtls,wolfssl,schannel,secure-transport,amissl,bearssl,rustls} )
      SSH:              no      (--with-{libssh,libssh2})
      zlib:             enabled
      brotli:           no      (--with-brotli)
      zstd:             enabled (libzstd)
      GSS-API:          no      (--with-gssapi)
      GSASL:            no      (libgsasl not found)
      TLS-SRP:          no      (--enable-tls-srp)
      resolver:         POSIX threaded
      IPv6:             enabled
      Unix sockets:     enabled
      IDN:              no      (--with-{libidn2,winidn})
      Build libcurl:    Shared=yes, Static=no
      Built-in manual:  enabled
      --libcurl option: enabled (--disable-libcurl-option)
      Verbose errors:   enabled (--disable-verbose)
      Code coverage:    disabled
      SSPI:             no      (--enable-sspi)
      ca cert bundle:   no
      ca cert path:
      ca fallback:
      LDAP:             enabled (OpenLDAP)
      LDAPS:            enabled
      RTSP:             enabled
      RTMP:             no      (--with-librtmp)
      PSL:              no      (libpsl not found)
      Alt-svc:          enabled (--disable-alt-svc)
      Headers API:      enabled (--disable-headers-api)
      HSTS:             no      (--enable-hsts)
      HTTP1:            enabled (internal)
      HTTP2:            no      (--with-nghttp2, --with-hyper)
      HTTP3:            no      (--with-ngtcp2, --with-quiche --with-msh3)
      ECH:              no      (--enable-ech)
      WebSockets:       no      (--enable-websockets)
      Protocols:        DICT FILE FTP GOPHER HTTP IMAP LDAP LDAPS MQTT POP3 RTSP SMTP TELNET TFTP
      Features:         AsynchDNS IPv6 Largefile UnixSockets alt-svc libz threadsafe zstd
    ...
    root@aixbuildhostng: /home/packagebuilder/test/curl-7.86.0 # gmake -j 20
    Making all in lib
    ...
    root@aixbuildhostng: /home/packagebuilder/test/curl-7.86.0/src/.libs # ldd curl
    curl needs:
             /usr/lib/libc.a(shr.o)
             /usr/lib/libpthreads.a(shr_xpg5.o)
             /opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/10/../../../libcurl.a(libcurl.so.4)
             /opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/10/../../../libz.a(libz.so.1)
             /opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/10/../../../libldap.a(libldap-2.5.so.0)
             /opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/10/../../../liblber.a(liblber-2.5.so.0)
             /opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/10/../../../libzstd.a(libzstd.so.1)
             /unix
             /usr/lib/libcrypt.a(shr.o)
             /usr/lib/libpthreads.a(shr_comm.o)
             /opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/10/libgcc_s.a(shr.o)
             /opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/10/../../../libnghttp2.a(libnghttp2.so.14)
             /opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/10/../../../libssh2.a(libssh2.so.1)
             /opt/freeware/lib/libgssapi_krb5.a(libgssapi_krb5.so)
             /opt/freeware/lib/libkrb5.a(libkrb5.so)
             /opt/freeware/lib/libk5crypto.a(libk5crypto.so)
             /opt/freeware/lib/libcom_err.a(libcom_err.so)
             /usr/lib/libcrypto.a(libcrypto.so.1.1)
             /usr/lib/libssl.a(libssl.so.1.1)
             /opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/10/../../../libsasl2.a(libsasl2.so.3)
             /usr/lib/libs.a(shr.o)
             /usr/lib/libpthread.a(shr_xpg5.o)
             /usr/lib/librtl.a(shr.o)
             /opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/10/../../../libkrb5.so
             /opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/10/../../../libk5crypto.so
             /opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/10/../../../libcom_err.so
             /opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/10/../../../libkrb5support.so
             /opt/freeware/lib/libintl.a(libintl.so.8)
             /usr/lib/libdl.a(shr.o)
             /opt/freeware/lib/libiconv.a(libiconv.so.2)
    root@aixbuildhostng: /home/packagebuilder/test/curl-7.86.0/src/.libs # ./curl -V
    curl 7.86.0 (powerpc-ibm-aix7.1.5.0) libcurl/7.86.0 OpenSSL/1.1.1l zlib/1.2.13 libssh2/1.10.0 nghttp2/1.46.0
    Release-Date: 2022-10-26
    Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
    Features: alt-svc AsynchDNS GSS-API HSTS HTTP2 HTTPS-proxy IPv6 Kerberos Largefile libz NTLM NTLM_WB SPNEGO SSL threadsafe UnixSockets


    ------------------------------
    I regret starting this entire conversation
    ------------------------------



  • 7.  RE: gcc: strange error message at config stage

    Posted Thu April 20, 2023 07:29 AM

    further testing...by setting LIBPATH to contain /opt/freeware/lib BEFORE /opt/freeware/lib64 in the build script ,configure finished successfully. 
    still no idea why gcc insists in loading the 64 bit object before the 32 bit one, smells like a packaging issue in the gcc  package for aix 7.1

    #!/usr/bin/ksh
    export LIBPATH=/opt/freeware/lib:/opt/freeware/lib64:/usr/lib:/lib
    export OBJECT_MODE=64
    export AR="/usr/bin/ar -X32_64"
    export CC="/opt/freeware/bin/gcc -maix64"
    export CFLAGS="-I/opt/freeware/include"
    export CPPFLAGS="-I/opt/freeware/include"
    export LDFLAGS="-L/opt/freeware/lib64 -L/opt/freeware/lib -Wl,-blibpath:/opt/freeware/lib64:/opt/freeware/lib:/usr/lib:/lib"
    
    
    ./configure --prefix=/home/packagebuilder/apachelibinc \
                --with-openssl=/usr \
                --with-ca-path=/var/ssl/certs/ \
                --enable-shared \
                --enable-static \
                --enable-ldap \
                --with-libssh2 \
                --without-zstd \
                --with-nghttp2
    
    ...
     Host setup:       powerpc-ibm-aix7.1.5.0
      Install prefix:   /home/packagebuilder/apachelibinc
      Compiler:         /opt/freeware/bin/gcc -maix64
       CFLAGS:          -isystem /opt/freeware/include -Werror-implicit-function-declaration -O2 -Wno-system-headers -pthread
       CPPFLAGS:        -isystem /opt/freeware/include -isystem /opt/freeware/include -isystem /opt/freeware/include
       LDFLAGS:         -L/opt/freeware/lib64 -L/opt/freeware/lib -Wl,-blibpath:/opt/freeware/lib64:/opt/freeware/lib:/usr/lib:/lib -L/opt/freeware/lib -L/opt/freeware/lib64
       LIBS:            -lnghttp2 -lssh2 -lssl -lcrypto -lssl -lcrypto -lldap -llber -lz
    
      curl version:     7.86.0
      SSL:              enabled (OpenSSL)
      SSH:              enabled (libSSH2)
      zlib:             enabled
      brotli:           no      (--with-brotli)
      zstd:             no      (--with-zstd)
      GSS-API:          no      (--with-gssapi)
      GSASL:            no      (libgsasl not found)
      TLS-SRP:          no      (--enable-tls-srp)
      resolver:         POSIX threaded
      IPv6:             enabled
      Unix sockets:     enabled
      IDN:              no      (--with-{libidn2,winidn})
      Build libcurl:    Shared=yes, Static=no
      Built-in manual:  enabled
      --libcurl option: enabled (--disable-libcurl-option)
      Verbose errors:   enabled (--disable-verbose)
      Code coverage:    disabled
      SSPI:             no      (--enable-sspi)
      ca cert bundle:   no
      ca cert path:     /var/ssl/certs/
      ca fallback:      no
      LDAP:             enabled (OpenLDAP)
      LDAPS:            enabled
      RTSP:             enabled
      RTMP:             no      (--with-librtmp)
      PSL:              no      (libpsl not found)
      Alt-svc:          enabled (--disable-alt-svc)
      Headers API:      enabled (--disable-headers-api)
      HSTS:             enabled (--disable-hsts)
      HTTP1:            enabled (internal)
      HTTP2:            enabled (nghttp2)
      HTTP3:            no      (--with-ngtcp2, --with-quiche --with-msh3)
      ECH:              no      (--enable-ech)
      WebSockets:       no      (--enable-websockets)
      Protocols:        DICT FILE FTP FTPS GOPHER GOPHERS HTTP HTTPS IMAP IMAPS LDAP LDAPS MQTT POP3 POP3S RTSP SCP SFTP SMB SMBS SMTP SMTPS TELNET TFTP
      Features:         AsynchDNS HSTS HTTP2 HTTPS-proxy IPv6 Largefile NTLM NTLM_WB SSL UnixSockets alt-svc libz threadsafe


    ------------------------------
    I regret starting this entire conversation
    ------------------------------