"deserialize primitive type 16 (vers=0, pos=15)" with Visual Studio

I followed the steps in "Getting Started with the LLVM System using Microsoft Visual Studio" in the document in LLVM page.

I made hello.c file exactly same shown in the page.
I made hello.bc on UNIX and transferred it to my Windows computer.
And I typed "llc -march=c hello.bc"
(Of course, I downloaded the latest version of LLVM and compiled with VS before this.)
But my command prompt can't run this with the following statement.

llc: bytecode didn't read correctly
Reason: Don't know how to deserialize primitive type 16 (vers=0, pos=15)

Hmmmm... Is there any body having been exposed to this?

Thanks,
Seung Jae Lee

Seung Jae Lee wrote:

I followed the steps in "Getting Started with the LLVM System using Microsoft Visual Studio" in the document in LLVM page.

I made hello.c file exactly same shown in the page.
I made hello.bc on UNIX and transferred it to my Windows computer.
And I typed "llc -march=c hello.bc"
(Of course, I downloaded the latest version of LLVM and compiled with VS before this.)
But my command prompt can't run this with the following statement.

llc: bytecode didn't read correctly
Reason: Don't know how to deserialize primitive type 16 (vers=0, pos=15)

Hmmmm... Is there any body having been exposed to this?

Thanks,
Seung Jae Lee

Assuming that you are using the same version of LLVM on both Windows and Unix, the most likely explanation is that you transfered the file hello.bc as a text file instead of a binary file.

Note that the last time I tried this, it no longer works. There are gcc runtime dependencies in the generated C code that will not link with VC++.

Jeff Cohen wrote:

Seung Jae Lee wrote:
  

I followed the steps in "Getting Started with the LLVM System using Microsoft Visual Studio" in the document in LLVM page.

I made hello.c file exactly same shown in the page.
I made hello.bc on UNIX and transferred it to my Windows computer.
And I typed "llc -march=c hello.bc"
(Of course, I downloaded the latest version of LLVM and compiled with VS before this.)
But my command prompt can't run this with the following statement.

llc: bytecode didn't read correctly
Reason: Don't know how to deserialize primitive type 16 (vers=0, pos=15)

Hmmmm... Is there any body having been exposed to this?

Thanks,
Seung Jae Lee
    
Assuming that you are using the same version of LLVM on both Windows and Unix, the most likely explanation is that you transfered the file hello.bc as a text file instead of a binary file.

Note that the last time I tried this, it no longer works. There are gcc runtime dependencies in the generated C code that will not link with VC++.

I just tried it myself, and it still doesn't work. There are no apparent GCC runtime dependencies this time, but the generated C code is relying on inline functions which are not supported by MS C. This could be fixed easily enough, but I'm not sure it's worth the effort. Any non-trivial program is going to have dependencies on the GCC runtime.

I'll update the documentation.

It is also possible that your CFE doesn't match your LLVM tree. They are version locked. If you have the 1.9 LLVM tree you must use LLVM 1.9 llvm-gcc. If you have LLVM CVS, you must use llvm-gcc svn.

-Chris