Closed izzues closed 2 years ago
Hi,
libz.so.1 => not found
It seems like you are missing libz.so.1
(zlib). Have you tried installing it?
The No such file or directory
error you get is the loader's weird way of telling you it's missing.
I see a test is performed in the build script, but it's not checking for zlib?
The test checks that certain libraries were compiled statically into curl-impersonate. I added it because sometimes the linker would insist on linking things dynamically. zlib specifically is not meant to be compiled statically into curl-impersonate since it is ubiquitous on most Linux systems.
About the correctness of the test itself, grep
will return success if any of the static libraries was accidentally linked dynamically, and therefore the result is negated with !
(we want the build to fail in that case).
Thank you for your response and corrections!
I forgot to mention that I did install zlib, but it still wouldn't work.
After doing more research, I found out this is a common issue in NixOS and a workaround is to patch the binary.
The proper solution would be to package curl-impersonate for NixOS. I'll leave that as a suggestion, but since this isn't specific to curl-impersonate, I'm closing this. Thanks again!
If anyone else struggles with this in the future, here's a default.nix
derivation that works using the workaround I mentioned. Keep in mind I'm just a noob so it may not be the best way to do it.
{ stdenv,
lib,
autoPatchelfHook,
fetchzip,
zlib,
}:
stdenv.mkDerivation rec {
name = "curl-impersonate-${version}";
version = "0.5.0";
src = fetchzip {
url = "https://github.com/lwthiker/curl-impersonate/releases/download/v${version}/curl-impersonate-v${version}.x86_64-linux-gnu.tar.gz";
sha256 = "sha256-1EQRwLbrfRZfOzsn+EPO1orF+D39JucKh0wMKx5L9vc=";
stripRoot = false;
};
nativeBuildInputs = [
autoPatchelfHook
];
buildInputs = [
zlib
];
installPhase = ''
mkdir -p $out/bin
cp -r $src/* $out/bin
'';
postFixup = ''
autoPatchelf .
'';
}
Assuming you have Nix installed, you can check this works by running nix-build -E "with import <nixpkgs> {}; callPackage ./default.nix {}" && ./result/bin/curl_chrome99 google.com
.
Hey,
I downloaded the binaries from the Releases page. It works on Debian, but on NixOS I'm getting the following error:
When I run
ldd [...]/curl-impersonate-chrome
, this is what I see:Unsure if related: I see a test is performed in the build script, but it's not checking for zlib? In addition, I don't think it works as expected (if I'm not mistaken,
grep -q
returns success if any of the patterns is found):https://github.com/lwthiker/curl-impersonate/blob/1b46a3fb88f92ae95b1374d1c3fbdf433002cad0/firefox/Dockerfile.alpine#L94