0

I tried to generate LLVM intermediate code by calling

llvm-gcc -emit-llvm -I/mypath/ -c main.c -o main.o

It works perfectly without any warnings or errors if I manually type this command in the terminal.

However I have built a website that can automate this process by calling exec function in PHP like below.

exec("llvm-gcc -emit-llvm -I/mypath/ -c main.c -o main.o",$msg,$ret);

It will still generate .o file with a warning. The warning says that

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.

The php command will still return 0, which is successful. However when I run the generated .o file, it will throw invalid bitcode signature error.

The server is running ubuntu and Apache. My llvm-gcc version is 2.9 which uses 4.2.1 gcc.

Any help will do. Thank you!

Tianyu
  • 95
  • 1
  • 6

1 Answers1

0

The best thing would be to update the GCC to 4.5.4. But if you just want to hide the warning, simply define dragonegg_disable_version_check.

$command = 'dragonegg_disable_version_check=1'
         . ' llvm-gcc -emit-llvm -I/mypath/'
         . ' -c main.c -o main.o';
exec($command,$msg,$ret);

For the invalid bit code signature error -- see this questions.

Community
  • 1
  • 1
emcconville
  • 23,800
  • 4
  • 50
  • 66
  • I will try to update GCC. But the weird thing is that I can run this command manually without warnings. Why is that? – Tianyu Feb 02 '14 at 05:40