Error Building LLVM on AIX 6

I get the following problem building LLVM 2.7 on AIX 6:

gmake[1]: Entering directory `/home/home/ac/psimmons/llvm/llvm-2.7/lib/System'
llvm[1]: Compiling Path.cpp for Release build
In file included from Path.cpp:262:
Unix/Path.inc: In static member function 'static llvm::sys::Path llvm::sys::Path::GetTemporaryDirectory(std::string*)':
Unix/Path.inc:142: error: 'mkdtemp' was not declared in this scope
Unix/Path.inc: In static member function 'static llvm::sys::Path llvm::sys::Path::GetMainExecutable(const char*, void*)':
Unix/Path.inc:365: error: 'Dl_info' was not declared in this scope
Unix/Path.inc:365: error: expected `;' before 'DLInfo'
Unix/Path.inc:366: error: 'DLInfo' was not declared in this scope
Unix/Path.inc:366: error: 'dladdr' was not declared in this scope
gmake[1]: *** [/home/home/ac/psimmons/llvm/llvm-2.7/lib/System/Release/Path.o] Error 1
gmake[1]: Leaving directory `/home/home/ac/psimmons/llvm/llvm-2.7/lib/System'
gmake: *** [all] Error 1
-bash-3.2$ pwd

Is this a known problem? How should I go about fixing this?

Thanks,
--Patrick

mkdtemp is missing on at least AIX 5.1:

http://www.gnu.org/software/hello/manual/gnulib/mkdtemp.html

though it's part of the posix standard.

The dynamic library routines like dladdr and dlinfo don't really seem
to exist on AIX, but that's what you'll need a replacement for. The
way to go about fixing this would be to find the routines that do
exist that will perform something resembling the same tasks and port
the code to use them on AIX.

Sorry there's not much more I can do to help.

-eric

Dear Patrick,

Documentation on some AIX routines to do the same thing can be found at http://publib.boulder.ibm.com/infocenter/comphelp/v8v101/index.jsp?topic=/com.ibm.xlcpp8a.doc/proguide/ref/dynamic_load.htm.

Interestingly enough, the same page suggests that AIX does, in fact, support dlopen() and friends for POSIX compatibility. You might need to find out if there's a header file or a #define (e.g. _POSIX) that you need to include/define to get dlopen() and friends working on AIX. The above web page provides the name of an AIX document which should aid in determining how to use dlopen() on AIX.

-- John T.

Eric Christopher wrote:

While dlopen() is part of POSIX, dladdr() and dlinfo() are not. So the
problem is really that Path.inc assumes that if HAVE_DLFNC_H is defined
then it also has dladdr/dlinfo.

The solution is to use realpath(), which is part of POSIX:

   http://www.opengroup.org/onlinepubs/9699919799/functions/realpath.html