我如何在Linux上构建PPAPI插件? [英] How do I build a PPAPI plugin on Linux?
问题描述
我如何在Linux上为Chromium创建一个PPAPI插件?
例如,我想构建项目提供的存根示例。 http://src.chromium .org / viewvc / chrome / trunk / src / ppapi / examples / stub / stub.cc?view =标记
到目前为止,我有以下Makefile
libexample.so.1.0.1:example.o
g ++ -shared -Wl,-soname,libexample。 so.1 -o libexample.so.1.0.1 example.o -lc -lppapi_cpp -lppapi_cpp_objects -L / home / carlos / Desktop / ppapi / example /
example.o:
g ++ -fPIC -Wall -g -c stub.cc -o example.o -I / home / carlos / Desktop /
clean:
rm example.o libexample.so.1.0。 1
运行:
google-chrome -d --register-pepper-plugins =/ home / carlos / Desktop / ppapi / examples / stub / libexample.so.1.0.1; application / x-ppapi-example
但是,libexample.so.1.0.1缺少符号。
nm libexample.so.1.0.1 --demangle -u | grep pp ::
给我这个:
U pp :: Module :: Get()
用于pp :: Module
的U typeinfo for pp :: Instance
这些符号在哪里?
我发现那
make -n
允许重现复杂的Makefile正在做什么。从那里,这是一个试验和错误的问题。下面是适用于我的Makefile。
libppapi_example.so:stub.o
g ++ -shared -pthread - Wl,-z,noexecstack -Wl,-soname = libppapi_example.so -o libppapi_example.so -Wl, - start-group stub.o libppapi_cpp.a libppapi_cpp_objects.a -Wl, - end-group
stub.o:
g ++'-DNO_HEAPCHECKER''-DCHROMIUM_BUILD''-DENABLE_REMOTING = 1''-DENABLE_GPU = 1''-D__STDC_FORMAT_MACROS''-DDYNAMIC_ANNOTATIONS_ENABLED = 1''-D_DEBUG'-I / home / carlos / Desktop / chromium / src / -Werror -pthread -fno-exceptions -Wall -Wno -unused-parameter -Wno-missing-field-initializers -D_FILE_OFFSET_BITS = 64 -fvisibility = hidden -pipe -fPIC -fno-strict- aliasing -fPIC -fvisibility = hidden -fvisibility = hidden -O0 -g -fno-rtti -fno-threadsafe-statics -fvisibility -inlines-hidden -MMD -MF stub.odraw -c -o stub.o stub.cc
clean:
rm -f stub.odraw stub.o libppapi_example.so
运行:
google-chrome -d --register-pepper -plugins =/家/ carlos / Desktop / ppapi / examples / stub / libppapi_example.so; application / x-ppapi-example
How do I build a PPAPI plugin for Chromium on Linux?
For example, I want to build the stub example provided by the project. http://src.chromium.org/viewvc/chrome/trunk/src/ppapi/examples/stub/stub.cc?view=markup
So far I have the following Makefile
libexample.so.1.0.1:example.o
g++ -shared -Wl,-soname,libexample.so.1 -o libexample.so.1.0.1 example.o -lc -lppapi_cpp -lppapi_cpp_objects -L /home/carlos/Desktop/ppapi/example/
example.o:
g++ -fPIC -Wall -g -c stub.cc -o example.o -I /home/carlos/Desktop/
clean:
rm example.o libexample.so.1.0.1
run:
google-chrome -d --register-pepper-plugins="/home/carlos/Desktop/ppapi/examples/stub/libexample.so.1.0.1;application/x-ppapi-example"
However, libexample.so.1.0.1 is missing symbols.
nm libexample.so.1.0.1 --demangle -u | grep pp::
Gives me this:
U pp::Module::Get()
U typeinfo for pp::Module
U typeinfo for pp::Instance
Where are those symbols?
I found out that
make -n
allows one to reproduce what a complicated Makefile is doing. From there, it was a matter of some trial and error. Below is the Makefile that works for me.
libppapi_example.so:stub.o
g++ -shared -pthread -Wl,-z,noexecstack -Wl,-soname=libppapi_example.so -o libppapi_example.so -Wl,--start-group stub.o libppapi_cpp.a libppapi_cpp_objects.a -Wl,--end-group
stub.o:
g++ '-DNO_HEAPCHECKER' '-DCHROMIUM_BUILD' '-DENABLE_REMOTING=1' '-DENABLE_GPU=1' '-D__STDC_FORMAT_MACROS' '-DDYNAMIC_ANNOTATIONS_ENABLED=1' '-D_DEBUG' -I/home/carlos/Desktop/chromium/src/ -Werror -pthread -fno-exceptions -Wall -Wno-unused-parameter -Wno-missing-field-initializers -D_FILE_OFFSET_BITS=64 -fvisibility=hidden -pipe -fPIC -fno-strict-aliasing -fPIC -fvisibility=hidden -fvisibility=hidden -O0 -g -fno-rtti -fno-threadsafe-statics -fvisibility-inlines-hidden -MMD -MF stub.o.d.raw -c -o stub.o stub.cc
clean:
rm -f stub.o.d.raw stub.o libppapi_example.so
run:
google-chrome -d --register-pepper-plugins="/home/carlos/Desktop/ppapi/examples/stub/libppapi_example.so;application/x-ppapi-example"
这篇关于我如何在Linux上构建PPAPI插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!