ArniDagur / python-adblock

Brave's adblock library in Python
https://pypi.org/project/adblock/
Apache License 2.0
58 stars 4 forks source link

[Linux] Offline build is failing, failure in name resolution #37

Closed tinywrkb closed 3 years ago

tinywrkb commented 3 years ago

I'm updating the qutebrowser Flatpak packaging and enabling python-adblock support.
I need to compile from source as there's no aarch64 binary release.
Flathub forbid network access during build-time so we build in offline mode.

Offline build is failing with

   Compiling rmp-serde v0.13.7
    error: proc-macro derive panicked
 --> /run/build/python3-adblock/cargo/vendor/psl-0.4.1/src/list.rs:6:10
  |
6 | #[derive(Psl, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Default)]
  |          ^^^
  |
  = help: message: failed to download the list: failed to lookup address information: Temporary failure in name resolution

error[E0599]: no method named `domain` found for struct `List` in the current scope
  --> /run/build/python3-adblock/cargo/vendor/psl-0.4.1/src/list.rs:28:20
   |
7  | pub struct List;
   | ---------------- method `domain` not found for this
...
28 |         match List.domain(input) {
   |                    ^^^^^^ method not found in `List`
   |
   = help: items from traits can only be used if the trait is implemented and in scope
note: `Psl` defines an item `domain`, perhaps you need to implement it
  --> /run/build/python3-adblock/cargo/vendor/psl-0.4.1/src/lib.rs:48:1
   |
48 | pub trait Psl {
   | ^^^^^^^^^^^^^

error[E0599]: no method named `suffix` found for struct `List` in the current scope
  --> /run/build/python3-adblock/cargo/vendor/psl-0.4.1/src/list.rs:51:20
   |
7  | pub struct List;
   | ---------------- method `suffix` not found for this
...
51 |         match List.suffix(input) {
   |                    ^^^^^^ method not found in `List`
   |
   = help: items from traits can only be used if the trait is implemented and in scope
note: `Psl` defines an item `suffix`, perhaps you need to implement it
  --> /run/build/python3-adblock/cargo/vendor/psl-0.4.1/src/lib.rs:48:1
   |
48 | pub trait Psl {
   | ^^^^^^^^^^^^^

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0599`.rde

error: could not compile `psl`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
💥 maturin failed
  Caused by: Failed to build a native library through cargo
  Caused by: Cargo build finished with "exit code: 101": `cargo rustc --message-format json --manifest-path Cargo.toml --offline --release --lib -- -C link-arg=-s`
Error: module python3-adblock: Child process exited with code 1

Is there anything useful that can help pinpoint the source of this issue? I can try generating a more detailed debug log if needed.

The packaging is in my adblock branch here, and specifically the python-adblock build commands are here.

p.s. It would be nice if binary releases for Linux aarch64 would be available.

ArniDagur commented 3 years ago

Thanks for pointing this out in an issue. This has been a pain for other (actual and potential) packagers of python-adblock. The problem is that one of our transitive dependencies tries to fetch the public suffix list from the network. I think this may have been fixed in a recent version of addr. I'm in the process of updating now.

Regarding ARM packaging, I agree. Especially given the new Macs. See https://github.com/ArniDagur/python-adblock/issues/11.

tinywrkb commented 3 years ago

@ArniDagur thanks for the reply. Let me know if testing is needed.

rushmorem commented 3 years ago

Yes, the recent versions of the psl crate no longer try to download the list at build time. Once you successfully update adblock-rust, this will go away.

ArniDagur commented 3 years ago

Hopefully the problem should be fixed now. If it's not, feel free to reopen this issue or create a new one.

tinywrkb commented 3 years ago

Thanks, I can confirm that it's now building correctly for me without network.

tinywrkb commented 3 years ago

p.s. I can successfully build now for aarch64.