Skip to content

AIX XL C/C++ V16.1 comes with clang/clang++ but is not fully clang compatible #3474

@kdekker

Description

@kdekker

I did this

IBM quite recently released Xl C/C++ V16.1 for AIX (see announcement). This compiler comprises the 'good old' known xlc (and variants) C-compiler, but this product now also contains xlclang and xlclang++. Apparently, support for newer standards like C11/C++11/C++14 is not added to XL C/C++ but to xlclang (C) or xlclang++ (C++). The xlclang compiler supports some/most of the clang compiler but not all. When calling configure with the following flags:

LDFLAGS="-L/vobs/obj.AIX71/thirdparty/OpenSSL/64bit/openssl-1.1.1/build/lib -L/vobs/obj.AIX71/thirdparty/zlib/64bit/zlib-1.2.11/build/lib" LIBS="-lm -ldl /vobs/tt/../common/thirdparty/zlib/build/IBM_RS6000/64bit/lib/libz.a" CC="xlclang" CFLAGS="-O2 -qinlglue -qtune=balanced -qmaxmem=-1 -qstrict -brtl -qro -qarch=pwr4 -qcheck=divzero -qalias=noansi -qfuncsect=noimplicitstaticref -qcheck=nullptr -qchars=unsigned -std=c11 -q64 " AR="/usr/bin/ar -X 32_64" MAKE=gmake MAKEFLAGS= MFLAGS= ./configure --prefix=/vobs/obj.AIX71/thirdparty/cURL/64bit/curl-7.61.1/build --with-ssl=/vobs/tt/../common/thirdparty/OpenSSL/build/IBM_RS6000/64bit --with-zlib=/vobs/tt/../common/thirdparty/zlib/build/IBM_RS6000/64bit --disable-silent-rules --enable-ipv6 --disable-shared --disable-ldap --disable-manual --without-libidn2 --without-libssh2 || rm -f "/vobs/obj.AIX71/thirdparty/cURL/64bit/curl-7.61.1/config.status"

(with xlclang in the PATH, /opt/IBM/xlC/16.1.0/bin/xlclang)

I then get a configure result that adds -Qunused flag. See (part of) configure output:

checking if cpp -P is needed... no
checking if compiler is DEC/Compaq/HP C... no
checking if compiler is HP-UX C... no
checking if compiler is IBM C... no
checking if compiler is Intel C... no
checking if compiler is clang... yes
checking if compiler is GNU C... no
checking if compiler is LCC... no
checking if compiler is SGI MIPSpro C... no
checking if compiler is SGI MIPS C... no
checking if compiler is SunPro C... no
checking if compiler is Tiny C... no
checking if compiler is Watcom C... no
checking if compiler accepts some basic options... yes
configure: compiler options added: -Qunused-arguments 

Unfortunately, the -Qunused flag is not supported by IBM's xlclang, see:

gmake[2]: Entering directory '/vobs/obj.AIX71/thirdparty/cURL/64bit/curl-7.61.1/lib' /bin/sh ../libtool --tag=CC --mode=compile xlclang -DHAVE_CONFIG_H -I../include -I../lib -I../lib -DBUILDING_LIBCURL -DCURL_STATICLIB -DCURL_HIDDEN_SYMBOLS -I/vobs/tt/../common/thirdparty/zlib/build/IBM_RS6000/64bit/include -I/vobs/tt/../common/thirdparty/OpenSSL/build/IBM_RS6000/64bit/include -I/vobs/tt/../common/thirdparty/OpenSSL/build/IBM_RS6000/64bit/include/openssl -fvisibility=hidden -O2 -qinlglue -qtune=balanced -qmaxmem=-1 -qstrict -brtl -qro -qarch=pwr4 -qcheck=divzero -qalias=noansi -qfuncsect=noimplicitstaticref -qcheck=nullptr -qchars=unsigned -std=c11 -q64 -Qunused-arguments -MT libcurl_la-file.lo -MD -MP -MF .deps/libcurl_la-file.Tpo -c -o libcurl_la-file.lotest -f 'file.c' || echo './'file.c libtool: compile: xlclang -DHAVE_CONFIG_H -I../include -I../lib -I../lib -DBUILDING_LIBCURL -DCURL_STATICLIB -DCURL_HIDDEN_SYMBOLS -I/vobs/tt/../common/thirdparty/zlib/build/IBM_RS6000/64bit/include -I/vobs/tt/../common/thirdparty/OpenSSL/build/IBM_RS6000/64bit/include -I/vobs/tt/../common/thirdparty/OpenSSL/build/IBM_RS6000/64bit/include/openssl -fvisibility=hidden -O2 -qinlglue -qtune=balanced -qmaxmem=-1 -qstrict -brtl -qro -qarch=pwr4 -qcheck=divzero -qalias=noansi -qfuncsect=noimplicitstaticref -qcheck=nullptr -qchars=unsigned -std=c11 -q64 -Qunused-arguments -MT libcurl_la-file.lo -MD -MP -MF .deps/libcurl_la-file.Tpo -c file.c -o libcurl_la-file.o **/opt/IBM/xlC/16.1.0/bin/.orig/xlclang: warning: 1501-216 command option -Qunused-arguments is not recognized - passed to ld** mv -f .deps/libcurl_la-file.Tpo .deps/libcurl_la-file.Plo

See also the compiler reference manual at compiler ref

I expected the following

I'm not sure how to fix this. It is probably easy to adjust configure in such way that -Qunused is not added if $CC maches xlclang. In that case, this option can be omitted. However, I don't know the procedure 'how to add support for a new compiler'.

Because I'm building a static libcurl, I don't really suffer from this issue. That may probably change for people who like to build a shared library. In that case, the linker is invoked with incorrect options.

I would be nice if configure fully recognizes AIX's xlclang and passes correct compiler flags to it.

A similar/related thing is another compiler option that does not work correctly (but does not raise further errors):

checking whether the xlclang linker (/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... /opt/IBM/xlC/16.1.0/bin/.orig/xlclang: error: 1501-294 No input file specified. Please use -qhelp for more information.
AIX lib.a(lib.so.V)

I think that _xl_clang is probably more XL than clang. Please refer to IBM's compiler reference documentation for more information about what options are supported.

In case if greater details are wanted, test or something else, feel free to ask. If wanted, I can upload configure related files.

curl/libcurl version

[curl -V output]
curl 7.61.1

operating system

AIX 7.1 TL4

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions