Skip to content

Is it possible to compile Vix using Burrito? #204

@JamesLavin

Description

@JamesLavin

Thanks for creating vix! It's really useful.

I've been struggling for months to use Burrito to build a distributable single-file binary for my Elixir project. Everything works except vix compilation.

I keep hitting pipe.c:3:10: fatal error: 'glib-object.h' file not found and ld.lld: error: unable to find library -l:libvips.so.42.

Initially, I suspected it was a libvips/vips packaging problem with my distribution (Fedora 41). But I subsequently tried building on a different Fedora 42 machine and on a third Debian 12 machine and hit the same failure on all three, so it's less likely to be a packaging bug.

That leaves three other layers of the onion to investigate. I opened tickets with the other two layers (see below) and am still searching for an answer, so I'm opening this ticket in hopes someone can figure out why I can't compile libvips and vix with Burrito.

I documented my compilation failures more thoroughly here, but here's a typical failure:

--> Going to recompile NIF for cross-build: bcrypt_elixir -> x86_64-linux
rm -f /priv/bcrypt_nif.so
mkdir -p "/tmp/burrito_build_E1D93FB39C98499D/lib/bcrypt_elixir-3.3.2/priv"
zig cc -target x86_64-linux -O2 -dynamic -shared -Wl,-undefined=dynamic_lookup  -g -O3 -Wall -Wno-format-truncation -I"/tmp/unpacked_erts_789F496DB36D057E/otp_x86_64_linux_28.0.2/erts-16.0.2/include" -Ic_src -fPIC -shared  c_src/bcrypt_nif.c c_src/blowfish.c -o "/tmp/burrito_build_E1D93FB39C98499D/lib/bcrypt_elixir-3.3.2/priv/bcrypt_nif.so"
--> Successfully re-built bcrypt_elixir for x86_64-linux!
--> Going to recompile NIF for cross-build: exqlite -> x86_64-linux
 CC sqlite3_nif.o
 CC sqlite3.o
 LD sqlite3_nif.so
--> Successfully re-built exqlite for x86_64-linux!
--> Going to recompile NIF for cross-build: vix -> x86_64-linux
Cleaning build artifacts...
g_object/g_value.c:1:10: fatal error: 'glib-object.h' file not found
    1 | #include <glib-object.h>
      |          ^~~~~~~~~~~~~~~
1 error generated.
g_object/g_type.c:1:10: fatal error: 'glib-object.h' file not found
    1 | #include <glib-object.h>
      |          ^~~~~~~~~~~~~~~
1 error generated.
g_object/g_param_spec.c:2:10: fatal error: 'glib-object.h' file not found
    2 | #include <glib-object.h>
      |          ^~~~~~~~~~~~~~~
1 error generated.
g_object/g_object.c:1:10: fatal error: 'glib-object.h' file not found
    1 | #include <glib-object.h>
      |          ^~~~~~~~~~~~~~~
1 error generated.
g_object/g_boxed.c:1:10: fatal error: 'glib-object.h' file not found
    1 | #include <glib-object.h>
      |          ^~~~~~~~~~~~~~~
1 error generated.
vix.c:1:10: fatal error: 'glib-object.h' file not found
    1 | #include <glib-object.h>
      |          ^~~~~~~~~~~~~~~
1 error generated.
vips_operation.c:1:10: fatal error: 'glib-object.h' file not found
    1 | #include <glib-object.h>
      |          ^~~~~~~~~~~~~~~
1 error generated.
vips_interpolate.c:1:10: fatal error: 'glib-object.h' file not found
    1 | #include <glib-object.h>
      |          ^~~~~~~~~~~~~~~
1 error generated.
vips_image.c:1:10: fatal error: 'glib-object.h' file not found
    1 | #include <glib-object.h>
      |          ^~~~~~~~~~~~~~~
1 error generated.
vips_foreign.c:1:10: fatal error: 'glib-object.h' file not found
    1 | #include <glib-object.h>
      |          ^~~~~~~~~~~~~~~
1 error generated.
In file included from vips_boxed.c:2:
./g_object/g_boxed.h:5:10: fatal error: 'glib-object.h' file not found
    5 | #include <glib-object.h>
      |          ^~~~~~~~~~~~~~~
1 error generated.
In file included from utils.c:1:
./utils.h:5:10: fatal error: 'glib-object.h' file not found
    5 | #include <glib-object.h>
      |          ^~~~~~~~~~~~~~~
1 error generated.
pipe.c:3:10: fatal error: 'glib-object.h' file not found
    3 | #include <glib-object.h>
      |          ^~~~~~~~~~~~~~~
1 error generated.
Setting up precompiled libvips...

16:23:13.726 [debug] Fetching https://github.com/akash-akya/sharp-libvips/releases/download/v1.2.0/sharp-libvips-linux-x64.tar.gz

16:23:14.491 [debug] Extracting to /tmp/burrito_build_E1D93FB39C98499D/lib/vix-0.35.0/priv/sharp-libvips-linux-x64.tar.gz
 CC     pipe.c
 CC     utils.c
 CC     vips_boxed.c
 CC     vips_foreign.c
 CC     vips_image.c
 CC     vips_interpolate.c
 CC     vips_operation.c
 CC     vix.c
 CC     g_boxed.c
 CC     g_object.c
 CC     g_param_spec.c
 CC     g_type.c
 CC     g_value.c
 LD     vix.so
ld.lld: error: unable to find library -l:libvips.so.42
make[1]: *** [Makefile:158: /tmp/burrito_build_E1D93FB39C98499D/lib/vix-0.35.0/priv/vix.so] Error 1
make: *** [Makefile:9: compile] Error 2
--> Failed to rebuild vix for x86_64-linux!
** (exit) 1
    (burrito 1.4.0) lib/steps/patch/recompile_nifs.ex:133: Burrito.Steps.Patch.RecompileNIFs.maybe_recompile_nif/8
    (elixir 1.18.4) lib/enum.ex:987: Enum."-each/2-lists^foreach/1-0-"/2
    (burrito 1.4.0) lib/steps/patch/recompile_nifs.ex:23: Burrito.Steps.Patch.RecompileNIFs.execute/1
    (burrito 1.4.0) lib/builder/builder.ex:140: anonymous fn/3 in Burrito.Builder.run_phase/2
    (elixir 1.18.4) lib/enum.ex:2546: Enum."-reduce/3-lists^foldl/2-0-"/3
    (elixir 1.18.4) lib/enum.ex:987: Enum."-each/2-lists^foreach/1-0-"/2
    (burrito 1.4.0) lib/builder/builder.ex:88: Burrito.Builder.build/1
    (mix 1.18.4) lib/mix/tasks/release.ex:1079: Mix.Tasks.Release.run_steps/1

Thanks in advance to anyone who takes time to read and consider this issue!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions