AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.

 View Only
  • 1.  gcc on the AIX 6.1

    Posted Fri December 20, 2013 01:06 AM

    Originally posted by: liuqiong023


    I have installed gcc 4.8 on the AIX 6.1, the library path is set as also.

    the gcc version and libray path:

    # gcc -v
    Using built-in specs.
    COLLECT_GCC=gcc
    COLLECT_LTO_WRAPPER=/opt/freeware/libexec/gcc/powerpc-ibm-aix6.1.0.0/4.8.1/lto-wrapper
    Target: powerpc-ibm-aix6.1.0.0
    Configured with: ../configure --with-as=/usr/bin/as --with-ld=/usr/bin/ld --enable-languages=c,c++,fortran --prefix=/opt/freeware --mandir=/opt/freeware/man --infodir=/opt/freeware/info --enable-threads --enable-version-specific-runtime-libs --enable-decimal-float=dpd --host=powerpc-ibm-aix6.1.0.0 --target=powerpc-ibm-aix6.1.0.0
    Thread model: aix
    gcc version 4.8.1 (GCC)
    # echo $LD_LIBRARY_PATH
    /opt/freeware/lib/gcc:/usr/include
    # echo $LIBPATH
    /opt/freeware/lib/gcc:/usr/include

    The errors will occur when I build my software, but it is built successfully on the other system platform(just as Solaris, Hp UX, MacOS, Linux).

    It seem like the include file(string.h and stdio.h) can not been found, so the strcpy and memset was not declared.

    The error is list as following:

    ../ipc/base/IPCClientConnection.cpp: In member function 'bool IPCClientConnection::connect(const string&)':
    ../ipc/base/IPCClientConnection.cpp:91:34: error: 'strcpy' was not declared in this scope
      strcpy(un.sun_path, port.c_str());
                                      ^
    ../ipc/base/IPCClientConnection.cpp: In member function 'int IPCClientConnection::do_read()':
    ../ipc/base/IPCClientConnection.cpp:149:3: error: 'memset' is not a member of 'std'
       std::memset(data, 0, sizeof(data));
       ^
    ../ipc/base/IPCClientConnection.cpp:149:3: note: suggested alternative:
    In file included from /usr/include/sys/thread.h:41:0,
                     from /usr/include/sys/ptrace.h:28,
                     from /usr/include/sys/proc.h:48,
                     from /usr/include/sys/pri.h:43,
                     from /usr/include/sys/sched.h:38,
                     from /usr/include/sched.h:51,
                     from /opt/freeware/lib/gcc/powerpc-ibm-aix6.1.0.0/4.8.1/include-fixed/pthread.h:73,
                     from /opt/freeware/lib/gcc/powerpc-ibm-aix6.1.0.0/4.8.1/include/c++/powerpc-ibm-aix6.1.0.0/bits/gthr-posix.h:35,
                     from /opt/freeware/lib/gcc/powerpc-ibm-aix6.1.0.0/4.8.1/include/c++/powerpc-ibm-aix6.1.0.0/bits/gthr-default.h:30,
                     from /opt/freeware/lib/gcc/powerpc-ibm-aix6.1.0.0/4.8.1/include/c++/powerpc-ibm-aix6.1.0.0/bits/gthr.h:148,
                     from /opt/freeware/lib/gcc/powerpc-ibm-aix6.1.0.0/4.8.1/include/c++/ext/atomicity.h:33,
                     from /opt/freeware/lib/gcc/powerpc-ibm-aix6.1.0.0/4.8.1/include/c++/bits/basic_string.h:39,
                     from /opt/freeware/lib/gcc/powerpc-ibm-aix6.1.0.0/4.8.1/include/c++/string:52,
                     from ../ipc/base/IPCConnection.h:18,
                     from ../ipc/base/IPCClientConnection.h:16,
                     from ../ipc/base/IPCClientConnection.cpp:1:
    /usr/include/sys/time.h:260:18: note:   'memset'
     extern void     *memset(void *, int, size_t);

     

    So, Maybe the library path is not set accurately. what should I do for this issue?

     I set the library path by the below way:
    edit the /.dtprofile and /etc/profile, add two lines:
    export LD_LIBRARY_PATH=/opt/freeware/lib/gcc:/usr/include
    export LIBPATH=/opt/freeware/lib/gcc:/usr/include
     



  • 2.  Re: gcc on the AIX 6.1

    Posted Mon December 23, 2013 04:41 PM

    Originally posted by: flodstrom


    This does not look like any linking problems, you seem to have undeclared functions?

    What is the command you use to get that error?

    Another thing worth mentioning is that LD_LIBRARY_PATH has no meaning in AIX. However LIBPATH do have a meaning in AIX and the value you have it set to doesn't make any sence (/usr/include ?!?). Also having LIBPATH set in your global environment can cause other problems, I suggest you unset/remove LIBPATH (as in don't use it at all).