r-lib / ragg

Graphic Devices Based on AGG
https://ragg.r-lib.org
Other
172 stars 24 forks source link

When linking with library flags generated by `pkg-config`, the `-ljpeg` flag is duplicated #153

Closed georgestagg closed 9 months ago

georgestagg commented 9 months ago

See discussion in #152 for more context. The short version is that duplicated link flags fails when building for webR/Wasm with Emscripten.


In the package's configure script, pkg-config is used to find libjpeg,

https://github.com/r-lib/ragg/blob/792c1e10fa0ebcd7d89ff3e5227f51e8d299ec82/configure#L8

but later, the -ljpeg flag is also manually appended,

https://github.com/r-lib/ragg/blob/792c1e10fa0ebcd7d89ff3e5227f51e8d299ec82/configure#L37-L39

If we are relying on pkg-config and the existence of jpeg.pc, can we remove the additional -ljpeg?

Alternatively, should https://github.com/r-lib/ragg/commit/fa87a16a1bd19ce2680ddc22ee3bd576e189ddd7 be reverted? The argument for that is that older versions of libjpeg did not install a jpeg.pc for pkg-config to use.

I don't particularly mind which of the two solutions we land on.

jeroen commented 9 months ago

As I am listed as the official author of this particular script, I'll use my executive powers here :)

I checked a few old linux distros and all of them install the libjpeg-turbo drop-in replacement instead of the original libjpeg implementation when you install libjpeg-dev or libjpeg-devel . The libjpeg-turbo library has always included a proper libjpeg.pc, so therefore requiring this is probably fine these days (otherwise we would have heard about it by now).