Skia as a shared lib on OS X

285 views
Skip to first unread message

marcel.r...@googlemail.com

unread,
Dec 19, 2013, 8:52:33 AM12/19/13
to skia-d...@googlegroups.com
Hi,

I'm trying to build Skia as a shared library, because I want to use the Lua bindings.

A normal build works as it should. I check out the source, run `./gyp_skia`, `cd out; xcodebuild` and I get a working sample app.

When I attempt to get a shared library (by running `python gyp_skia -Dskia_shared_lib=1`), here is what I get after running `xcodebuild`:
    Ld ../xcodebuild/Coverage/bench normal x86_64
        cd ~/trunk/gyp
        setenv MACOSX_DEPLOYMENT_TARGET 10.8
        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -L~/trunk/gyp/../xcodebuild/Coverage -F~/trunk/gyp/../xcodebuild/Coverage -filelist ~/trunk/gyp/../xcodebuild/bench.build/Coverage/bench.build/Objects-normal/x86_64/bench.LinkFileList -mmacosx-version-min=10.8 -fprofile-arcs -ftest-coverage ~/trunk/xcodebuild/Coverage/libskia.dylib -lbench_timer ~/trunk/xcodebuild/Coverage/libflags.a ~/trunk/xcodebuild/Coverage/libjsoncpp.a -Xlinker -dependency_info -Xlinker ~/trunk/gyp/../xcodebuild/bench.build/Coverage/bench.build/Objects-normal/x86_64/bench_dependency_info.dat -o ~/trunk/gyp/../xcodebuild/Coverage/bench
    clang: error: no such file or directory: '~/trunk/xcodebuild/Coverage/libskia.dylib'


And indeed, there is no libskia.dylib, just a bunch of static libraries (.a), but not anything called libskia or skia_lib. Attempting to build just skia_lib with `xcodebuild -scheme skia_lib` succeeds, but does not yield either a static or a shared lib either.




If I just do `./gyp_skia; cd out; xcodebuild -scheme skia_lib`, (i.e the non-shared-library build) I still don't get anything called libskia, but from the terminal output, it seems that the primary result of the skia_lib configuration is libskia_skgpu.a
Overall, it seems like setting `skia_shared_lib=1` does not actually lead to the shared library being linked/created correctly on OS X.




Is there any way to fix this or to use the Lua bindings with a static library?

Eric Boren

unread,
Dec 20, 2013, 9:48:20 AM12/20/13
to skia-d...@googlegroups.com
Hi Marcel,

The short version is that, no, we don't currently support building a shared library on OSX.  This is due to a GYP limitation which requires us to build our optimizations in a separate target from the rest of the code.  More discussion is here: https://code.google.com/p/skia/issues/detail?id=175

But you should absolutely be able to link against the static libraries.  At a minimum, you'll need libskia_core.a, libskia_ports.a, libskia_opts.a, libskia_utils.a, and libskia_skgpu.a, plus the Lua sources under third_party.

Eric


--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To post to this group, send email to skia-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/skia-discuss.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages