Skip to content

Can I specify different LDFLAGS for compiling different libraries? #197

Description

@JamesLavin

Yesterday morning, I accidentally closed Vix NIF recompilation failing with "pipe.c:3:10: fatal error: 'glib-object.h' file not found" #190. Github won't let me re-open it. (I thought I was canceling my unsaved comment.)

In that thread, I posted my problems compiling with Burrito due to missing header file errors. I eventually got past those problems (by using CFLAGS) and then hit a new class of problem, which I'm now stuck on.

My problem now is that the LDFLAGS env var that may fix my vix compilation problem breaks the compilation of bcrypt_elixir. I'm wondering whether it's possible to specify different LDFLAGS for different dependencies.

Re-posting below what I shared there yesterday morning. (I also posted potentially useful advice from ChatGPT but won't repost that here.)...

I just tried export LDFLAGS="-L/usr/lib/x86_64-linux-gnu -llibvips.so.42", which might possibly fix my problem. But it doesn't work because it breaks bcrypt_elixir:

--> Going to recompile NIF for cross-build: bcrypt_elixir -> x86_64-linux
rm -f /priv/bcrypt_nif.so
mkdir -p "/tmp/burrito_build_E36F48199B21A012/lib/bcrypt_elixir-3.3.2/priv"
zig cc -target x86_64-linux -O2 -dynamic -shared -Wl,-undefined=dynamic_lookup  -I/usr/include/vips -I/usr/lib/x86_64-linux-gnu/vips-modules-8.14 -I/usr/include/glib-2.0 -I/usr/include/c++/12/parallel -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/lib/x86_64-linux-gnu -I/lib/x86_64-linux-gnu -I/usr/include/my_vips -Wall -Wno-format-truncation -I"/tmp/unpacked_erts_DE31B3848312B743/otp_x86_64_linux_28.0.2/erts-16.0.2/include" -Ic_src -fPIC -shared -L/usr/lib/x86_64-linux-gnu -llibvips.so.42 c_src/bcrypt_nif.c c_src/blowfish.c -o "/tmp/burrito_build_E36F48199B21A012/lib/bcrypt_elixir-3.3.2/priv/bcrypt_nif.so"
error: unable to find dynamic system library 'libvips.so.42' using strategy 'mode_first'. searched paths:
  /usr/lib/x86_64-linux-gnu/liblibvips.so.42.so
  /usr/lib/x86_64-linux-gnu/liblibvips.so.42.a
make: *** [Makefile:33: _lib_name] Error 1
--> Failed to rebuild bcrypt_elixir 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions