尝试使用llvm 4.2.1链接c ++代码时出错

时间:2010-09-09 15:01:22

标签: llvm

我正在尝试将一些gpl代码(不是我的!)从C ++转换为C,因此我可以在仅限c的项目中使用它。我读了关于llvm并且很兴奋,但我遇到了一个链接器错误,我不知道如何修复:

错误是:

Intrinsic prototype has incorrect number of arguments!
void (i8*, i8*, i64, i32, i1)* @llvm.memmove.p0i8.p0i8.i64
Broken module found, compilation aborted!
Stack dump:
0.  Running pass 'Function Pass Manager' on module 'ld-temp.o'.
1.  Running pass 'Module Verifier' on function '@_ZNSt15__copy_backwardILb1ESt26random_access_iterator_tagE8__copy_bIxEEPT_PKS3_S6_S4_'

以前有人见过这个吗?知道是什么原因引起的吗?

以下是我用来做到这一点的命令:

dhcp-100-140:src joeltucci$ llvm-g++ msb.C -c -emit-llvm
dhcp-100-140:src joeltucci$ llvm-g++ rabincmd.C -c -emit-llvm
In file included from rabincmd.C:27:
rabinpoly.h: In member function ‘u_int64_t rabinpoly::append8(u_int64_t, u_char) const’:
rabinpoly.h:56: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘long int’
rabincmd.C: In function ‘void printChunkContents(u_int64_t, const unsigned char*, int)’:
rabincmd.C:91: warning: too few arguments for format
rabincmd.C: In member function ‘virtual void ExtractChunkProcessor::internalCompleteChunk(u_int64_t, u_int64_t)’:
rabincmd.C:547: warning: deprecated conversion from string constant to ‘char*’
rabincmd.C:551: warning: deprecated conversion from string constant to ‘char*’
dhcp-100-140:src joeltucci$ llvm -ld m
mkrabincmd.sh      msb.C              msb.o              
mkverboseRabin.sh  msb.h              
dhcp-100-140:src joeltucci$ llvm -ld *.o -o program
-bash: llvm: command not found
dhcp-100-140:src joeltucci$ llvm-ld *.o -o program
-bash: llvm-ld: command not found
dhcp-100-140:src joeltucci$ llvm-
llvm-cpp-4.2  llvm-g++      llvm-g++-4.2  llvm-gcc      llvm-gcc-4.2  
dhcp-100-140:src joeltucci$ llvm-g++ *.o -o program
collect2: ld terminated with signal 6 [Abort trap]
Intrinsic prototype has incorrect number of arguments!
void (i8*, i8*, i64, i32, i1)* @llvm.memmove.p0i8.p0i8.i64
Broken module found, compilation aborted!
Stack dump:
0.  Running pass 'Function Pass Manager' on module 'ld-temp.o'.
1.  Running pass 'Module Verifier' on function '@_ZNSt15__copy_backwardILb1ESt26random_access_iterator_tagE8__copy_bIxEEPT_PKS3_S6_S4_'
dhcp-100-140:src joeltucci$ llvm-gcc --version
i686-apple-darwin10-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2332.3)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

dhcp-100-140:src joeltucci$ 
dhcp-100-140:src joeltucci$ 
dhcp-100-140:src joeltucci$ 
dhcp-100-140:src joeltucci$ llvm-g++ *.o -o program
llvm-g++      llvm-g++-4.2  
dhcp-100-140:src joeltucci$ llvm-gcc-4.2 --version
i686-apple-darwin10-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2332.3)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

1 个答案:

答案 0 :(得分:1)

好吧,你的问题可能是一个排队

llvm -ld *.o -o program -bash: llvm: command not found dhcp-100-140:src 

你列出的错误很可能与找不到llvm -ld有关,因此你在下一个命令中缺少一些所需的文件.....你的意思是llvm-ld吗?