Hi, im trying to build libskia.so and use it in my application. I can build the shared object successfully, but when I link my program against it, I got an error saying:
/tmp/ccRxLGCL.o: In function `SkStrFind(char const*, char const*)':
main.cpp:(.text+0x136): undefined reference to `SkToS32(long)'
collect2: error: ld returned 1 exit status
That libskia.so was built in release mode, and I checked src/core/SkDebug.cpp and found that SkToS32 only present in debug mode. I didn't set the SK_DEBUG macro but my program still trying to use that function.
If I build the shared object in debug mode, then I got a compile error when building the library:
GYP_GENERATORS environment variable not set, using default
GYP_GENERATORS is "ninja"
Updating projects from gyp files...
ninja -C out/Debug most
ninja: Entering directory `out/Debug'
[104/1024] LINK skpdiff
FAILED: c++ -m64 -pie -Wl,-rpath=\$ORIGIN/lib/ -Wl,-rpath-link=lib/ -o skpdiff -Wl,--start-group obj/tools/skpdiff/skpdiff.skpdiff_main.o obj/tools/skpdiff/skpdiff.SkDiffContext.o obj/tools/skpdiff/skpdiff.SkImageDiffer.o obj/tools/skpdiff/skpdiff.SkPMetric.o obj/tools/skpdiff/skpdiff.skpdiff_util.o obj/tools/skpdiff/skpdiff.SkDifferentPixelsMetric_cpu.o obj/gyp/libflags.a obj/gyp/libpicture_utils.a -Wl,--end-group lib/libskia.so -lrt -lpng -lz -lgif
/usr/bin/ld: obj/tools/skpdiff/skpdiff.SkDiffContext.o: undefined reference to symbol 'pthread_mutexattr_settype@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
[104/1024] LINK skhello
FAILED: c++ -m64 -pie -Wl,-rpath=\$ORIGIN/lib/ -Wl,-rpath-link=lib/ -o skhello -Wl,--start-group obj/tools/skhello.skhello.o obj/gyp/libflags.a libskia_pdf.a obj/gyp/libskflate.a -Wl,--end-group lib/libskia.so -lpng -lz -lgif
/usr/bin/ld: libskia_pdf.a(pdf.SkPDFStream.o): undefined reference to symbol 'pthread_mutexattr_settype@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
[104/1024] LINK render_pdfs
FAILED: c++ -m64 -pie -Wl,-rpath=\$ORIGIN/lib/ -Wl,-rpath-link=lib/ -o render_pdfs -Wl,--start-group obj/tools/render_pdfs.render_pdfs_main.o obj/gyp/libflags.a libskia_pdf.a obj/gyp/libpicture_utils.a obj/gyp/libproc_stats.a obj/gyp/libskflate.a -Wl,--end-group lib/libskia.so -lpng -lz -lgif
/usr/bin/ld: libskia_pdf.a(pdf.SkPDFStream.o): undefined reference to symbol 'pthread_mutexattr_settype@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
[104/1024] LINK lua_app
ninja: build stopped: subcommand failed.
make: *** [most] Error 1
I wonder if there is any mistake in the way I build the libskia.so, which is:
./gyp_skia
export GYP_DEFINES="skia_shared_lib=1"
make BUILDTYPE=Release -j4
(then copy out/Release/lib/libskia.so to my project source folder along with skia's include directory)
(compile my program using:)
g++ main.cpp -o test -I include/core -I include/config -L. -lskia
Thank in advance