lunasvg icon indicating copy to clipboard operation
lunasvg copied to clipboard

WIP: Use a git submodule for plutovg

Open bkmgit opened this issue 2 years ago • 4 comments

Partially addresses https://github.com/sammycage/lunasvg/issues/110

Building the examples fails. Error messages:

/usr/bin/ld: ../3rdparty/plutovg/example/libplutovg.a(plutovg.c.o): in function `stbi_write_bmp':
plutovg.c:(.text+0x945): multiple definition of `stbi_write_bmp'; CMakeFiles/svg2png.dir/svg2png.cpp.o:svg2png.cpp:(.text+0x60f): first defined here
/usr/bin/ld: ../3rdparty/plutovg/example/libplutovg.a(plutovg.c.o): in function `stbi_write_tga':
plutovg.c:(.text+0xdd2): multiple definition of `stbi_write_tga'; CMakeFiles/svg2png.dir/svg2png.cpp.o:svg2png.cpp:(.text+0x6bc): first defined here
/usr/bin/ld: ../3rdparty/plutovg/example/libplutovg.a(plutovg.c.o): in function `stbi_write_png':
plutovg.c:(.text+0x3446): multiple definition of `stbi_write_png'; CMakeFiles/svg2png.dir/svg2png.cpp.o:svg2png.cpp:(.text+0x23e8): first defined here
collect2: error: ld returned 1 exit status

Dynamic linking also fails:

[100%] Linking CXX shared library liblunasvg.so
/usr/bin/ld: 3rdparty/plutovg/example/libplutovg.a(plutovg.c.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: 3rdparty/plutovg/example/libplutovg.a(plutovg-blend.c.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: 3rdparty/plutovg/example/libplutovg.a(plutovg-rle.c.o): relocation R_X86_64_32S against `.text' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: 3rdparty/plutovg/example/libplutovg.a(plutovg-font.c.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: 3rdparty/plutovg/example/libplutovg.a(sw_ft_raster.c.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: 3rdparty/plutovg/example/libplutovg.a(sw_ft_stroker.c.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: 3rdparty/plutovg/example/libplutovg.a(sw_ft_math.c.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: 3rdparty/plutovg/example/libplutovg.a(plutovg.c.o): warning: relocation against `stbi__flip_vertically_on_write' in read-only section `.text'
collect2: error: ld returned 1 exit status

Maybe libplutovg can also be compiled as shared library by overriding configuration, as described here

Suggestions for fixing above welcome, but will keep working on them.

bkmgit avatar Oct 16 '22 16:10 bkmgit

Lemme update plutovg first

sammycage avatar Oct 16 '22 16:10 sammycage

Lemme update plutovg first

sammycage avatar Oct 16 '22 16:10 sammycage

@sammycage

Lemme update plutovg first

Do you have any updates on this? Are there any divergences between 3rdparty/plutovg and the actual plutovg repo? As I understand 3rdparty/plutovg is a superset of the actual plutovg repo, as more features were added.

https://github.com/sammycage/plutovg/issues/31

ivantishchenko avatar Feb 01 '24 13:02 ivantishchenko

@ivantishchenko Well done! I'm kind of busy right now, but I'll let you know when I have time to do so.

sammycage avatar Feb 02 '24 01:02 sammycage