How to use ported library in NaCl module?

2019-08-05 05:18发布

I want to use openssl library in my NaCl module. Luckily it is ported already as in https://code.google.com/p/naclports/. However, its kind of pity but I don't know how to add the library to the toolchain. I did as instructed in the Readme file:

...nacl_sdk/pepper_33/naclports/src$ python build_tools/naclports.py install openssl Already installed 'openssl' [x86_64/newlib]

And then I tried to compile this simple C code, and the compiler complaint some errors which are because of linking problem with openssl/evp.h.

This is my Makefile: link. Please let me know how to make it run.

2条回答
再贱就再见
2楼-- · 2019-08-05 05:52

Build naclports. Look in naclports/README.rst for instructions.

查看更多
冷血范
3楼-- · 2019-08-05 05:59

NaCl actually consists of several different toolchains. naclports will build and install a given library to just one of them at time. The libraries and headers get installed directly into the toolchain so there is no need to -L or -I on the command line.

In this case you have built and installed the x86_64 newlib version of openssl. This means that you should be able to build the x86_64 newlib version of your app (add TOOLCHAIN=newlib NACL_ARCH=x86_64 to your make call).

To build all the other versions of openssh you can use the "make_all.sh" script at the top level of naclports (e.g. ./make_all.sh openssl).

查看更多
登录 后发表回答