llvm-g++ does not work!

Hi,

I am using PinaVM which is a prototype of a SystemC front-end based on "LLVM". The only version that it works with is 2.8. Also to test PinaVM, we need llvm-g++ (I think clang does not work). However, when I want to run an example, i get the following error, which i think is related to llvm-g++:

reza@RezaUbuntu:~/pinavm-pinavm/systemc-examples/jerome-chain$ make promela
llvm-g++ -fno-inline-functions -I…/…/external/systemc-2.2.0/src/ -I…/…/external/TLM-2009-07-15/include/tlm -I…/…/external/basic -emit-llvm -c main.cpp -o main.bc
Potential incompatible plugin version. GCC: 4.5.3. Expected: 4.5.4
Defines 'dragonegg_disable_version_check' as env variable to remove this warning
Please note that unexpected errors might occur.
llvm-link main.bc -o main.linked.bc
llvm-link: main.bc:1:1: error: expected top-level entity
ELF??4(VS???
^
llvm-link: error loading file 'main.bc'
make: *** [main.linked.bc] Error 1

It shows the main.bc is not a bitcode file. Most likely the llvm-g++ is broken. Would you please let me know your opinion about it, and tell me how i can fix it?

Thank you,
Reza

I don't know if you noticed this warning, but it seems to say that the DragonEgg plugin that you're using with GCC wants a newer version of GCC. You might want to try using the Dragonegg plugin with GCC 4.5.4 or later.

-- John T.

The issue here (even if you get dragonegg working) is that the thing that most newer linuxes install when you apt-get llvm-gcc isn't actually llvm-gcc, it's gcc with the dragonegg plugin. Even if the plugin issues are sorted out, the "fake" llvm-gcc doesn't support -emit-llvm so this wouldn't work.

You'll probably need to pull a 2.8 of it from llvm.org or a different repository.

-Gordon

Hi Gordan,

The issue here (even if you get dragonegg working) is that the thing that most newer linuxes install when you apt-get llvm-gcc isn't actually llvm-gcc, it's gcc with the dragonegg plugin. Even if the plugin issues are sorted out, the "fake" llvm-gcc doesn't support -emit-llvm so this wouldn't work.

you can use -flto instead of -emit-llvm, but then you have to use -S rather than
-c.

Ciao, Duncan.

Hi Reza,

I am using PinaVM which is a prototype of a SystemC front-end based on "LLVM".
The only version that it works with is 2.8. Also to test PinaVM, we need
llvm-g++ (I think clang does not work). However, when I want to run an example,
i get the following error, which i think is related to llvm-g++:

this is not llvm-g++, this is the dragonegg plugin which someone (not the LLVM
project) is distributing as "llvm-gcc", an endless source of confusion.

reza@RezaUbuntu:~/pinavm-pinavm/systemc-examples/jerome-chain$ make promela
llvm-g++ -fno-inline-functions -I../../external/systemc-2.2.0/src/
-I../../external/TLM-2009-07-15/include/tlm -I../../external/basic -emit-llvm -c
main.cpp -o main.bc

First off, dragonegg doesn't know -emit-llvm, use -fplugin-arg-dragonegg-emit-ir
or -flto instead. Secondly, to stop the LLVM IR produced being passed to the
system assembler, use -S rather than -c (in which case the output would better
be named main.ll). In all this gives:

llvm-g++ -fno-inline-functions -I../../external/systemc-2.2.0/src/ -I../../external/TLM-2009-07-15/include/tlm -I../../external/basic -flto -S main.cpp -o main.ll

Potential incompatible plugin version. GCC: 4.5.3. Expected: 4.5.4

What's more, the GCC and dragonegg versions don't match. This is a bad idea.
Where did you get "llvm-gcc" from? You should ask them to fix this.

Ciao, Duncan.