I have discovered (while building Doxygen) that the iconv test fails on AIX with g++ because of incorrect (for AIX) linking. I took the test’s code:
(python-env-nepal) robb@nepal:/raid/proj/procyon/checkouts-procyon/robb/dle-sandbox/conan-doxygen_installer (master)$ echo "#include <iconv.h>
int main() { iconv(iconv_t(-1), 0, 0, 0, 0); }" > iconv_test.cpp
Build without adding iconv at link time -
(python-env-nepal) robb@nepal:/raid/proj/procyon/checkouts-procyon/robb/dle-sandbox/conan-doxygen_installer (master)$ g++ -o ictest iconv_test.cpp
ld: 0711-317 ERROR: Undefined symbol: .libiconv
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
collect2: error: ld returned 8 exit status
Now just specify -liconv on the link - which works -
(python-env-nepal) robb@nepal:/raid/proj/procyon/checkouts-procyon/robb/dle-sandbox/conan-doxygen_installer (master)$ g++ -o ictest iconv_test.cpp -liconv
The link command as produced by CMake (3.18.0 in this case)
(python-env-nepal) robb@nepal:/raid/proj/procyon/checkouts-procyon/robb/dle-sandbox/conan-doxygen_installer (master)$ /opt/freeware/bin/g++ -maix64 -pthread -maltivec -mvsx -DICONV_COMPILES -Wl,-bnoipath iconv_test.cpp -o ictest -Wl,-blibpath:/opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/8/pthread/ppc64:/opt/freeware/lib/pthread/ppc64:/opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/8:/opt/freeware/lib:/usr/lib:/lib /usr/lib/libiconv.a
ld: 0711-317 ERROR: Undefined symbol: .libiconv
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
collect2: error: ld returned 8 exit status
Here, specifying the full path to the shared library (/usr/lib/libiconv.a is an archive with three shared objects: 32-bit, 64-bit and an older 32-bit version).