Problems building llvm on AIX

Hi,

Has anyone succeeded in building llvm on AIX?

Currently I am investigating several tools for code analyses and I came upon Clang. We at CCV run our core business applications on RS6000/AIX. At our department we develop those applications.

The reviews on clang look very promising. I was able to build and run it on Linux (SuSE 12.1) without any problems. I tested it with valgrind sources and was impressed by the issues it found.

Building it on AIX is a total disaster however. I had to add some code (added dladdr() function), change Makefiles etc. but that wasn’t to much of an issue.

I first tried to build it using cmake

That stopped at the point of not being able to find mach-o/dyld.h. After fixing that, lots of ‘undeclared’ (symbols), ‘unknown type name’ and ‘dereferencing pointer to incomplete type’ errors came up.

After that, I made a new build directory and followed the ‘Getting Started with LLVM’ instructions. That is, using configure.

Running make returned the following errors:

llvm-3.1/llvm/lib/Support/DynamicLibrary.cpp: In static member function ‘static llvm::sys::DynamicLibrary llvm::sys::DynamicLibrary::getPermanentLibrary(const char*, std::string*)’:

llvm-3.1/llvm/lib/Support/DynamicLibrary.cpp:77:56: error: ‘dlopen’ was not declared in this scope

llvm-3.1/llvm/lib/Support/DynamicLibrary.cpp:79:35: error: ‘dlerror’ was not declared in this scope

llvm-3.1/llvm/lib/Support/DynamicLibrary.cpp:96:19: error: ‘dlclose’ was not declared in this scope

llvm-3.1/llvm/lib/Support/DynamicLibrary.cpp: In member function ‘void* llvm::sys::DynamicLibrary::getAddressOfSymbol(const char*)’:

llvm-3.1/llvm/lib/Support/DynamicLibrary.cpp:104:32: error: ‘dlsym’ was not declared in this scope

llvm-3.1/llvm/lib/Support/DynamicLibrary.cpp: In static member function ‘static void* llvm::sys::DynamicLibrary::SearchForAddressOfSymbol(const char*)’:

llvm-3.1/llvm/lib/Support/DynamicLibrary.cpp:145:39: error: ‘dlsym’ was not declared in this scope

llvm-3.1/llvm/lib/Support/DynamicLibrary.cpp: In member function ‘void* llvm::sys::DynamicLibrary::getAddressOfSymbol(const char*)’:

llvm-3.1/llvm/lib/Support/DynamicLibrary.cpp:105:1: warning: control reaches end of non-void function [-Wreturn-type]

I don’t remember how I fixed that. dlfcn.h was already included in DynamicLibrary.cpp. Anyway, somehow I managed.

Now building llvm stops at the point of linking fpcmp. It compiles fpcmp.cpp alright, but make comes with the following messages:

llvm[2]: Compiling fpcmp.cpp for Release build

llvm[2]: Linking Release executable fpcmp (without symbols)

ld: 0706-027 The -R $ORIGIN/…/lib flag is ignored.

ld: 0706-027 The -R /ccvunix/cdndev/user/cdndadm/Tools/llvm-3.0/build/Release/bin flag is ignored.

ld: 0711-327 WARNING: Entry point not found: xport-dynamic

ld: 0711-244 ERROR: No csects or exported symbols have been saved.

collect2: error: ld returned 8 exit status

make[2]: *** [/ccvunix/cdndev/user/cdndadm/Tools/llvm-3.0/build/Release/bin/fpcmp] Error 1

make[2]: Leaving directory `/ccvunix/cdndev/user/cdndadm/Tools/llvm-3.0/build/utils/fpcmp’

make[1]: *** [fpcmp/.makeall] Error 2

make[1]: Leaving directory `/ccvunix/cdndev/user/cdndadm/Tools/llvm-3.0/build/utils’

make: *** [all] Error 1

I’ve searched the internet and tried al suggestions that were given for this error message. None of them, however, in combination with llvm. Nothing worked. I really would like to use clang, but I am desperate on how to continue. I tried cross compiling it on the linux machine, but that wasn’t a straight forward action either. At least not for me. I started with llvm version 3.1 and tried 3.0. Alas, no luck.

I tried gcc version 4.2.0-3, version 4.6.2 and version 4.7.1

I’m working on a RS6000, AIX 6.1

Does anyone have any ideas on how to solve this?

Thanks

Marcel

The linker on AIX uses -e to indicate the executable's entry point. Remove "-export-dynamic" from your linking options.

-K