首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Make error: emmake make在尝试构建libxml2时出现错误,找不到libxml.so.2

Make error: emmake make在尝试构建libxml2时出现错误,找不到libxml.so.2
EN

Stack Overflow用户
提问于 2021-02-04 09:41:26
回答 1查看 308关注 0票数 0

我的目标是用emscripten将我的C程序编译成wasm (我是通过emsdk安装的)。它使用libxml2。我正在遵循这里概述的步骤,使用适当的emscripten参数从源代码构建https://github.com/kripken/xml.js/blob/master/script/libxml2。当我运行emmake make时,我得到以下警告和错误:

代码语言:javascript
复制
...

CCLD     libxml2.la
emcc: warning: linking a library with `-shared` will emit a static object file.
This is a form of emulation to support existing build systems.  
If you want to build a runtime shared library use the SIDE_MODULE setting. [-Wemcc]
emcc: warning: ignoring unsupported linker flag: `--version-script=./libxml2.syms` [-Wlinkflags]
wasm-ld: error: cannot open libxml2.so.2: No such file or directory
emcc: error: '/home/willy/emsdk/upstream/bin/wasm-ld -o .libs/libxml2.so.2.9.9 .libs/SAX.o .libs/entities.o .libs/encoding.o -L/home/willy/emsdk/upstream/emscripten/system/local/lib .libs/error.o -L/home/willy/emsdk/upstream/emscripten/system/lib .libs/parserInternals.o -L/home/willy/emsdk/upstream/emscripten/cache/wasm .libs/parser.o .libs/tree.o .libs/hash.o .libs/list.o .libs/xmlIO.o .libs/xmlmemory.o .libs/uri.o .libs/valid.o .libs/xlink.o .libs/HTMLparser.o .libs/HTMLtree.o .libs/debugXML.o .libs/xpath.o .libs/xpointer.o .libs/xinclude.o .libs/nanohttp.o .libs/nanoftp.o .libs/catalog.o .libs/globals.o .libs/threads.o .libs/c14n.o .libs/xmlstring.o .libs/buf.o .libs/xmlregexp.o .libs/xmlschemas.o .libs/xmlschemastypes.o .libs/xmlunicode.o .libs/xmlreader.o .libs/relaxng.o .libs/dict.o .libs/SAX2.o .libs/xmlwriter.o .libs/legacy.o .libs/chvalid.o .libs/pattern.o .libs/xmlsave.o .libs/xmlmodule.o .libs/schematron.o .libs/xzlib.o /home/willy/emsdk/upstream/emscripten/cache/wasm/libc.a libxml2.so.2 --relocatable -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr' failed (1)
make[2]: *** [Makefile:1065: libxml2.la] Error 1
make[2]: Leaving directory '/home/willy/CWasmSandbox/libxml2-2.9.9'
make[1]: *** [Makefile:1484: all-recursive] Error 1
make[1]: Leaving directory '/home/willy/CWasmSandbox/libxml2-2.9.9'
make: *** [Makefile:897: all] Error 2

以我对emscripten有限的理解,我能收集到的唯一一件事是它试图访问在正常情况下将从libxml2.la生成的libxml2.so.2。但是libxml2.so.2没有生成,因为emscripten不生成共享对象。这个评估是正确的吗?我尝试将选项CFLAGS="-s SIDE_MODULE=1"传递给make,但它没有修复错误,而且可能是由于我对构建系统的了解有限而产生的一个愚蠢的想法。我也尝试过将libxml2.so.2从之前的安装拷贝到适当的目录中,但没有成功,而且也有点傻,因为emscripten对.so文件没有用处?我的下一步应该是什么?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-02-04 15:32:29

最简单的方法是退出共享库。

共享模块(side Module)有一个重要的限制:如果你打算在主应用程序中使用线程,它将无法工作。

所以只需更改./script/libxml2即可

代码语言:javascript
复制
-emconfigure ../libxml2/configure --with-http=no --with-ftp=no --with-python=no --with-threads=no
+emconfigure ../libxml2/configure --with-http=no --with-ftp=no --with-python=no --with-threads=no --enable-shared=no

构建./build/.libs/libxml2.a并将其与您的主应用程序链接。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66038210

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档