qnighy/libwebp-sys2-rs

Static Build Undefined References

Closed this issue · 0 comments

Hi there,

When building 0.1.6 (with "1_1" and "static" features), I'm getting undefined reference errors during the linking stage along the lines of:

picture_csp_enc.c:(.text.ImportYUVAFromRGBA+0x109): undefined reference to `SharpYuvInit'
          /usr/bin/ld: picture_csp_enc.c:(.text.ImportYUVAFromRGBA+0x110): undefined reference to `SharpYuvGetConversionMatrix'

The missing references come from the scripts in the c_src/sharpyuv/ directory. I played around a little and was able to fix the issues by adding the following to your library's build script:

.file("c_src/sharpyuv/sharpyuv.c")
.file("c_src/sharpyuv/sharpyuv_cpu.c")
.file("c_src/sharpyuv/sharpyuv_csp.c")
.file("c_src/sharpyuv/sharpyuv_dsp.c")
.file("c_src/sharpyuv/sharpyuv_gamma.c")
.file("c_src/sharpyuv/sharpyuv_sse2.c")

I didn't seem to need sharpyuv_neon.c, but my system is x86-64, so that one is probably needed too.

Apologies for not opening a pull request; I wasn't sure where in that script you'd want to place them. 😉