Skip to content
Advertisement

‘undefined reference to’ Linker errors with latest LLVM from git (3.9.0svn) on Arch Linux

Prior to my Macbook Pro motherboard failure I was working on a programming language of mine with Flex, Bison, and LLVM. I honestly don’t recall the version of LLVM I was linking against at the time (I will try to find this out after I salvage the data from the drive), but I do know that the latest version I’m using now from git (clang version 3.9.0 (http://llvm.org/git/clang.git 7658b570923dcdfaaec04d837b7e8862eff895f8) (http://llvm.org/git/llvm.git 4edb79d2d975816fee53b814703812b2287ed455)) had a few minor API changes I had to compensate for.

I actually ended up replacing my Macbook with an MSI GS40 and chose Arch Linux as my new main OS. So my two primary variables here are Linux vs OS X and the different versions of LLVM/Clang/GCC involved.

I built LLVM the same way I did on OS X:

JavaScript

I didn’t realize until this time around that it makes a “prefix=” folder as the documentation for LLVM makes it appear as though this is the command (In reality you would omit the prefix=). So I just manually moved the output llvm folder to a new location and exported the include directory in my .bash_profile.

I have the project compiling now, but I am unable to link with LLVM and receive the following errors:

JavaScript

Oddly enough those should be in the LLVMSupport library which is being included.

My Makefile:

JavaScript

You will notice that I am including -v for verbose output so I can see all the libs and such being included by llvm-config. I have actually tried several different build parameters already, but just end up with even more linker issues.

Here is an example verbose output from the full build:

JavaScript

Note that I am currently including all LLVM components by simply using the --libs parameter to llvm-config. I have tried to modify this as well by just selecting the various components I needed with the same results.

The warning: unknown warning option '-Wno-maybe-uninitialized'; is also new in this version of LLVM apparently as I wasn’t getting that warn before.

I’m sure this is possible on Arch as one of the searches I found with similar errors was on the Arch Wiki, but you can see that I am already following that advice that was answered on this stackoverflow post.

Any help with this would be greatly appreciated.

For those that are interested some relevant information can be found in the following links:

Advertisement

Answer

Great…

So this appears to be a bug with ABI incompatability between GCC 5.0 and Clang. 🙁

More information here and the open bug.

I can fix easily for now by switching from clang++ to g++ in my Makefile.

Funny thing is g++ seems to build WAY faster then clang ever was. I’m talking orders of magnitude faster.

Advertisement