2010-11-25 63 views
1

我正在使用项目的一部分boost(只有message_queue)。如果我使用本地代码,则hpp文件很好。但我需要在LLVM位码文件(我执行我在程序的位码),消息队列,并得到以下错误:如何从boost创建库?

LLVM ERROR: Program used external function 'shm_unlink' which could not be resolved! 

有人告诉我,构建库升压所需的部分是解决这个问题的最好方法。

我做什么(在升压目录):

gcc -I . -c boost/interprocess/ipc/message_queue.hpp -o ipc.o 
ar -cvq libipc.a ipc.o 
ranlib libipc.a 

,然后在我的程序目录:现在

llvm-g++ -Wall -O3 -static -L../../Release/lib -lipc -I../../include -I../../../boost_1_44_0 -fexceptions -emit-llvm tmp.cpp -o tmp.bc 

,如果我包括我在程序的升压头,我得到:

../../Release/lib/libipc.a: could not read symbols: Archive has no index; run ranlib to add one 

如果我不包含它们,我会得到一些与message_queue未声明有关的错误。

我在做什么错?更重要的是,我该如何解决这个问题?

回答

0

shm_unlink,iirc在实时库librt中提供。将链接[gcc flag -lrt]添加到您的版本