Skip to content

Conversation

@cocoa-xu
Copy link
Contributor

@cocoa-xu cocoa-xu commented Mar 17, 2023

This PR makes it silently fallback to compile or ignore when there is no precompiled binary for the current target (i.e., no corresponding entry existing in the checksum.exs) instead of an error message.

Related issue: elixir-sqlite/exqlite#243

@cocoa-xu cocoa-xu changed the title Display info instead of error message when a target is unavailable Slient instead of error message when a target is unavailable Mar 17, 2023
@cocoa-xu cocoa-xu changed the title Slient instead of error message when a target is unavailable Slient instead of displaying error message when a target is unavailable Mar 17, 2023
@cocoa-xu cocoa-xu changed the title Slient instead of displaying error message when a target is unavailable Silent instead of displaying error message when a target is unavailable Mar 17, 2023
@warmwaffles
Copy link

This is definitely a nice to have. I believe the ergonomics will lend itself well here. If the precompiled target is not available it should just build the binaries.

@josevalim
Copy link
Member

@cocoa-xu can you please try the commit I pushed? I moved the warning inside the first case to pass less info around :)

@cocoa-xu
Copy link
Contributor Author

cocoa-xu commented Mar 17, 2023

@josevalim It works as intended! No error messages and straightly fallbacks to compile. :)

Before (master branch)

$ export TARGET_ARCH=aarch128
$ iex -S mix  
Erlang/OTP 25 [erts-13.1.5] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit]

==> exqlite
Error happened while installing exqlite from precompiled binary: cannot find download url for current target `"aarch128--"`. Available targets are: [{"x86_64-linux-musl", "2.16"}, {"x86_64-linux-musl", "2.15"}, {"riscv64-linux-musl", "2.16"}, {"riscv64-linux-musl", "2.15"}, {"aarch64-linux-musl", "2.16"}, {"aarch64-linux-musl", "2.15"}].

Attempting to compile exqlite from source...
 CC sqlite3_nif.o
 CC sqlite3.o
 LD sqlite3_nif.so
ld: warning: -undefined dynamic_lookup may not work with chained fixups
Compiling 13 files (.ex)
Generated exqlite app
Interactive Elixir (1.14.3) - press Ctrl+C to exit (type h() ENTER for help)

After

$ export TARGET_ARCH=aarch128
$ iex -S mix
Erlang/OTP 25 [erts-13.1.5] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit]

==> exqlite
 CC sqlite3_nif.o
 CC sqlite3.o
 LD sqlite3_nif.so
ld: warning: -undefined dynamic_lookup may not work with chained fixups
Compiling 13 files (.ex)
Generated exqlite app
iex(1)>

@josevalim josevalim merged commit 7d2f62f into elixir-lang:master Mar 17, 2023
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

@cocoa-xu cocoa-xu deleted the cx-info-unavailable-target branch March 17, 2023 19:13
@josevalim
Copy link
Member

0.7.6 out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants