teamon / rsvg Goto Github PK
View Code? Open in Web Editor NEWRender SVG into PNG in Elixir
Render SVG into PNG in Elixir
Currently this lib does not compile on Linux:
$ mix test --only os:alpine
...
#12 0.937 mkdir -p "/app/_build/test/lib/rsvg/priv"
#12 0.939 Package librsvg-2.0 was not found in the pkg-config search path.
#12 0.939 Perhaps you should add the directory containing `librsvg-2.0.pc'
#12 0.939 to the PKG_CONFIG_PATH environment variable
#12 0.939 Package 'librsvg-2.0', required by 'virtual:world', not found
#12 0.939 cc -g -O3 -Wall -Wno-format-truncation -fPIC -I/usr/local/lib/erlang/erts-13.1.2/include -shared c_src/rsvg.c -o /app/_build/test/lib/rsvg/priv/rsvg.so
#12 0.959 c_src/rsvg.c:2:10: fatal error: librsvg/rsvg.h: No such file or directory
#12 0.959 2 | #include <librsvg/rsvg.h>
#12 0.959 | ^~~~~~~~~~~~~~~~
#12 0.959 compilation terminated.
#12 0.961 make: *** [Makefile:20: /app/_build/test/lib/rsvg/priv/rsvg.so] Error 1
#12 0.963 ** (Mix) Could not compile with "make" (exit status: 2).
...
$ mix test --only os:ubuntu
#13 0.748 mkdir -p "/app/_build/test/lib/rsvg/priv"
#13 0.752 cc -g -O3 -Wall -Wno-format-truncation -fPIC -I/usr/local/lib/erlang/erts-13.1.2/include -shared -pthread -I/usr/include/librsvg-2.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/aarch64-linux-gnu -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/aarch64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -lrsvg-2 -lm -lgio-2.0 -lgdk_pixbuf-2.0 -lgobject-2.0 -lglib-2.0 -lcairo c_src/rsvg.c -o /app/_build/test/lib/rsvg/priv/rsvg.so
#13 0.873 Compiling 1 file (.ex)
#13 0.887
#13 0.887 10:36:37.419 [warning] The on_load function for module Elixir.RSVG returned:
#13 0.887 {:error,
#13 0.887 {:load_failed,
#13 0.887 'Failed to load NIF library: \'/app/_build/test/lib/rsvg/priv/rsvg.so: undefined symbol: g_object_unref\''}}
#13 0.887
#13 0.888 Generated rsvg app
#13 1.007 Excluding tags: [:os]
#13 1.007
#13 1.016 =WARNING REPORT==== 14-Dec-2022::10:36:37.553777 ===
#13 1.016 The on_load function for module Elixir.RSVG returned:
#13 1.016 {error,{load_failed,"Failed to load NIF library: '/app/_build/test/lib/rsvg/priv/rsvg.so: undefined symbol: g_object_unref'"}}
#13 1.016
I am running on a M1 macbook. librsvg
is installed using brew
.
I entered iex
and tried to install the library from git. The installation failed.
Erlang/OTP 25 [erts-13.1.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit] [dtrace]
Interactive Elixir (1.14.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> Mix.install([{:rsvg, "~> 0.1.0", git: "https://github.com/teamon/rsvg.git"}])
* Getting rsvg (https://github.com/teamon/rsvg.git)
remote: Enumerating objects: 36, done.
remote: Counting objects: 100% (36/36), done.
remote: Compressing objects: 100% (21/21), done.
remote: Total 36 (delta 8), reused 35 (delta 7), pack-reused 0
origin/HEAD set to main
mkdir -p ./priv
cc -g -O3 -ansi -Werror -I/opt/homebrew/Cellar/erlang/25.1.1/lib/erlang/erts-13.1.1/include -fPIC -shared -dynamiclib -undefined dynamic_lookup -I/opt/homebrew/Cellar/librsvg/2.55.1/include/librsvg-2.0 -I/opt/homebrew/Cellar/gdk-pixbuf/2.42.10/include/gdk-pixbuf-2.0 -I/opt/homebrew/Cellar/jpeg-turbo/2.1.4/include -I/opt/homebrew/Cellar/libtiff/4.4.0_1/include -I/opt/homebrew/Cellar/glib/2.74.3/include -I/opt/homebrew/Cellar/cairo/1.16.0_5/include/cairo -I/opt/homebrew/Cellar/glib/2.74.3/include -I/opt/homebrew/Cellar/glib/2.74.3/include/glib-2.0 -I/opt/homebrew/Cellar/glib/2.74.3/lib/glib-2.0/include -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/Cellar/pcre2/10.40/include -I/opt/homebrew/Cellar/pixman/0.40.0/include/pixman-1 -I/opt/homebrew/Cellar/fontconfig/2.14.1/include -I/opt/homebrew/opt/freetype/include/freetype2 -I/opt/homebrew/Cellar/libpng/1.6.39/include/libpng16 -I/opt/homebrew/Cellar/libxcb/1.15/include -I/opt/homebrew/Cellar/libxrender/0.9.10/include -I/opt/homebrew/Cellar/libxext/1.3.5/include -I/opt/homebrew/Cellar/libx11/1.8.2/include -I/opt/homebrew/Cellar/libxcb/1.15/include -I/opt/homebrew/Cellar/libxau/1.0.10/include -I/opt/homebrew/Cellar/libxdmcp/1.1.3/include -I/opt/homebrew/Cellar/xorgproto/2022.2/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/ffi -L/opt/homebrew/Cellar/librsvg/2.55.1/lib -L/opt/homebrew/Cellar/glib/2.74.3/lib -L/opt/homebrew/Cellar/gdk-pixbuf/2.42.10/lib -L/opt/homebrew/Cellar/glib/2.74.3/lib -L/opt/homebrew/opt/gettext/lib -L/opt/homebrew/Cellar/cairo/1.16.0_5/lib -lrsvg-2 -lm -lgio-2.0 -lgdk_pixbuf-2.0 -lgobject-2.0 -lglib-2.0 -lintl -lcairo -o priv/rsvg.so c_src/rsvg.c
ld: warning: -undefined dynamic_lookup may not work with chained fixups
==> rsvg
Compiling 1 file (.ex)
10:50:24.792 [warning] The on_load function for module Elixir.RSVG returned:
{:error,
{:load_failed,
'Failed to load NIF library: \'dlopen(/Users/tallakt/Library/Caches/mix/installs/elixir-1.14.2-erts-13.1.1/4d9812d4f8daadd40fa0549837020dc5/_build/dev/lib/rsvg/priv/rsvg.so, 0x0002): tried: \'/Users/tallakt/Library/Caches/mix/installs/elixir-1.14.2-erts-13.1.1/4d9812d4f8daadd40fa0549837020dc5/_build/dev/lib/rsvg/priv/rsvg.so\' (no such file)\''}}
Generated rsvg app
:ok
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.