By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account
  • Elixir & Erlang/OTP versions (elixir --version): Elixir 1.34.4, OTP 25
  • Operating system: MacOS Monterey 12.4
  • How have you started Livebook (mix phx.server, livebook CLI, Docker, etc): App
  • Livebook version (use git rev-parse HEAD if running with mix): 0.6.3
  • Current behavior

    Evaluating the livebook found at vix gibhub , I get this error:

    ==> vix
    cc -O3 -std=c11 -finline-functions -Wall -Werror -Wmissing-prototypes -D_POSIX_C_SOURCE=200809L -fPIC -I /Applications/Livebook.app/Contents/Resources/rel/erts-13.0.2/include -I /Applications/Livebook.app/Contents/Resources/rel/usr/include `pkg-config vips --cflags`  -c -o /Users/herman/Library/Caches/mix/installs/elixir-1.13.4-erts-13.0.2/70ef28b7cf5fcd83faf30ab0985d93df/deps/vix/c_src/pipe.o /Users/herman/Library/Caches/mix/installs/elixir-1.13.4-erts-13.0.2/70ef28b7cf5fcd83faf30ab0985d93df/deps/vix/c_src/pipe.c
    /bin/sh: pkg-config: command not found
    /Users/herman/Library/Caches/mix/installs/elixir-1.13.4-erts-13.0.2/70ef28b7cf5fcd83faf30ab0985d93df/deps/vix/c_src/pipe.c:3:10: fatal error: 'glib-object.h' file not found
    #include <glib-object.h>
             ^~~~~~~~~~~~~~~
    1 error generated.
    make[1]: *** [/Users/herman/Library/Caches/mix/installs/elixir-1.13.4-erts-13.0.2/70ef28b7cf5fcd83faf30ab0985d93df/deps/vix/c_src/pipe.o] Error 1
    make: *** [all] Error 2
    could not compile dependency :vix, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile vix", update it with "mix deps.update vix" or clean it with "mix deps.clean vix"
    ** (Mix.Error) Could not compile with "make" (exit status: 2).
    You need to have gcc and make installed. Try running the
    commands "gcc --version" and / or "make --version". If these programs
    are not installed, you will be prompted to install them.
        (mix 1.13.4) lib/mix.ex:515: Mix.raise/2
        (elixir_make 0.6.3) lib/mix/tasks/compile.make.ex:154: Mix.Tasks.Compile.ElixirMake.run/1
        (mix 1.13.4) lib/mix/task.ex:397: anonymous fn/3 in Mix.Task.run_task/3
        (mix 1.13.4) lib/mix/tasks/compile.all.ex:92: Mix.Tasks.Compile.All.run_compiler/2
        (mix 1.13.4) lib/mix/tasks/compile.all.ex:72: Mix.Tasks.Compile.All.compile/4
        (mix 1.13.4) lib/mix/tasks/compile.all.ex:59: Mix.Tasks.Compile.All.with_logger_app/2
        (mix 1.13.4) lib/mix/tasks/compile.all.ex:36: Mix.Tasks.Compile.All.run/1
        (mix 1.13.4) lib/mix/task.ex:397: anonymous fn/3 in Mix.Task.run_task/3
    

    I thought I missed libvips (a prerequisite), but it is installed.

    Expected behavior

    I expected it to install/build :vix

    When I use the same Livebook using livebook server, it does not have the same issue.

    Yup. The app runs in a very limited environment:

    # MyApp.app/Contents/MacOS/MyApp
    #!/bin/sh
    osascript -e "tell app \"System Events\" to display dialog \"$(env)\""
              

    So yeah, we basically need to manipulate $PATH somehow but worth noting that such notebook is not reproducible, in order to run it we need to run in a specific and implicit build environment. So it's a no-no for sharing but obviously it is an important scenario for just exploring things. For that I think it'd be best to manually adjust $PATH by calling System.put_env("PATH", ...) before Mix.install call. Would that work?

    We're also hoping to see packages not needing build environment thanks to projects like:

  • https://github.com/philss/rustler_precompiled
  • https://github.com/cocoa-xu/fennec_precompile
  • @wojtekmach I added

    path = System.get_env("PATH")
    System.put_env("PATH", path <> ":/opt/homebrew/bin")

    That got me further but now it complains it cannot find "erl_nif.h".