compile errors on omnios with llvm
This is some kind of hint for others, which may have the same problems I had.
I wanted to compile llvm 3.1 on omnios, an illumos distribution but it did not work out like I wanted it to. One of the first errors I got was a linking error.
Text relocation remains referenced
against symbol offset in file
llvm::LoopBase<llvm::MachineBasicBlock, llvm::MachineLoop>::getLoopPredecessor() const 0x149a /tmp/build_gibheer/llvm-3.1.src/Release/lib/libLLVMCodeGen.a(MachineLICM.o)
llvm::LoopBase<llvm::MachineBasicBlock, llvm::MachineLoop>::getExitBlocks(llvm::SmallVectorImpl<llvm::MachineBasicBlock*>&) const 0x6200 /tmp/build_gibheer/llvm-3.1.src/Release/lib/libLLVMCodeGen.a(MachineLICM.o)
ld: fatal: relocations remain against allocatable but non-writable sections
The problem in this case is, that parts of the llvm code are not compiled position independent (PIC). As I learned, this can be solved with the following setting.
LDFLAGS="-mimpure-text -Wl,-ztextwarn"
This changes the way of linking to only warn about position independent code, but still link it all together. It is not a nice solution, but with this, it is possible to find out, where it is gooing wrong.
After that problem partially solved, I had another problem. Solaris supports 32bit and 64bit programs on the same environment, just like you can do on linux with multilib. The first compile of llvm produced 32bit binaries. When trying to compile llvm for 64bit, it was just impossible. I tried different things, like setting CFLAGS
, LDFLAGS
, OTHER_OPTIONS
whatever there was and the only thing to get it compiled for 64bit is to overwrite CC
and CXX
. It seems like the Makefile just ignores the CFLAGS and therefore does only compile the code for the hostsystem seemingly bitness.
But both of these problems got solved with 3.2, which I tried from svn and they work. The release date of 3.2 is only 7 days away, so hopefully it will still work by then. Nice thing is, Rubinius can already use it :D