开发者

How do I build a PPAPI plugin on Linux?

开发者 https://www.devze.com 2023-02-04 22:18 出处:网络
How do I build a PPAPI plugin for Chromi开发者_StackOverflow中文版um on Linux? For example, I want to build the stub example provided by the project. http://src.chromium.org/viewvc/chrome/trunk/src/p

How do I build a PPAPI plugin for Chromi开发者_StackOverflow中文版um 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" 
0

精彩评论

暂无评论...
验证码 换一张
取 消