Emscripten不从静态库链接

时间:2013-10-02 18:03:05

标签: c++ emscripten

我有一个程序,我想通过Emscripten进行交叉编译。所以我创建了一个静态库foo_core,现在尝试通过以下方式将其链接到一个html页面:

$ em++ -std=c++11 -s VERBOSE=1 main.cpp.o -o example.html libfoo_core.js
VERBOSE is on, this generates a lot of output and can slow down compilation
adding ___cxa_atexit and deps atexit
adding _atexit and deps 
warning: unresolved symbol: _Z12fooiiii

现在我当然试着找出为什么_Z12fooiiii丢失了。最后做:

$ grep -r _Z12fooiiii *
example.html: __Z12fooiiii(50, 50, 50, 255);
libfoo_core.js:,0,__Z12fooiiii,0,__ZNSt3__16locale5facetD2Ev,0,__ZTv0_n12_NSt3__113basic_istreamIwNS_11char_traitsIwEEED1Ev,0,__ZNSt3__112system_errorD0Ev
libfoo_core.js:function __Z12fooiiii($r, $g, $b, $a) {

显示,该函数实际存在于libfoo_core.js中。 所以我现在很困惑,非常感谢有人向我解释为什么这不起作用。

1 个答案:

答案 0 :(得分:2)

如果你编译bitcode并且库有足够的.bc(例如libfoo_core.bc),它就有用了!

相关问题