Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

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

fix proxychains ld flags #20355

Closed
wants to merge 1 commit into from
Closed

fix proxychains ld flags #20355

wants to merge 1 commit into from

Conversation

roxma
Copy link
Contributor

@roxma roxma commented Nov 12, 2016

Withou the patch, I got an error with proxychains4 git submodule add ...

[roxma@nixos:~/test]$ nix-env -i proxychains
replacing old ‘proxychains-4.2.0’
installing ‘proxychains-4.2.0’

[roxma@nixos:~/test]$ proxychains4 git submodule add git@github.com:haad/proxychains.git
[proxychains] config file found: /home/roxma/test/proxychains.conf
[proxychains] preloading /nix/store/vq6lvswd1qq6119c96b767axilil88i7-proxychains-4.2.0/lib/libproxychains4.so
[proxychains] DLL init
[proxychains] DLL init
sedbasename: symbol lookup error: /nix/store/vq6lvswd1qq6119c96b767axilil88i7-proxychains-4.2.0/lib/libproxychains4.so: undefined symbol: dlerror
: symbol lookup error: /nix/store/vq6lvswd1qq6119c96b767axilil88i7-proxychains-4.2.0/lib/libproxychains4.so: undefined symbol: dlerror
sed: symbol lookup error: /nix/store/vq6lvswd1qq6119c96b767axilil88i7-proxychains-4.2.0/lib/libproxychains4.so: undefined symbol: dlerror
basename: symbol lookup error: /nix/store/vq6lvswd1qq6119c96b767axilil88i7-proxychains-4.2.0/lib/libproxychains4.so: undefined symbol: dlerror
/nix/store/dilcmbv8rlvv5l9vkig7y6rx0jbs0f0z-gettext-0.19.8/bin/gettext: symbol lookup error: /nix/store/vq6lvswd1qq6119c96b767axilil88i7-proxychains-4.2.0/lib/libproxychains4.so: undefined symbol: dlerror
/nix/store/dilcmbv8rlvv5l9vkig7y6rx0jbs0f0z-gettext-0.19.8/bin/envsubst: symbol lookup error: /nix/store/vq6lvswd1qq6119c96b767axilil88i7-proxychains-4.2.0/lib/libproxychains4.so: undefined symbol: dlerror
/nix/store/dilcmbv8rlvv5l9vkig7y6rx0jbs0f0z-gettext-0.19.8/bin/envsubst: symbol lookup error: /nix/store/vq6lvswd1qq6119c96b767axilil88i7-proxychains-4.2.0/lib/libproxychains4.so: undefined symbol: dlerror
uname: symbol lookup error: /nix/store/vq6lvswd1qq6119c96b767axilil88i7-proxychains-4.2.0/lib/libproxychains4.so: undefined symbol: dlerror
[proxychains] DLL init
[proxychains] DLL init
[proxychains] DLL init
[proxychains] DLL init
[proxychains] DLL init
sed: symbol lookup error: /nix/store/vq6lvswd1qq6119c96b767axilil88i7-proxychains-4.2.0/lib/libproxychains4.so: undefined symbol: dlerror
/nix/store/dilcmbv8rlvv5l9vkig7y6rx0jbs0f0z-gettext-0.19.8/bin/gettext: symbol lookup error: /nix/store/vq6lvswd1qq6119c96b767axilil88i7-proxychains-4.2.0/lib/libproxychains4.so: undefined symbol: dlerror
/nix/store/dilcmbv8rlvv5l9vkig7y6rx0jbs0f0z-gettext-0.19.8/bin/envsubst: symbol lookup error: /nix/store/vq6lvswd1qq6119c96b767axilil88i7-proxychains-4.2.0/lib/libproxychains4.so: undefined symbol: dlerror
/nix/store/dilcmbv8rlvv5l9vkig7y6rx0jbs0f0z-gettext-0.19.8/bin/envsubst: symbol lookup error: /nix/store/vq6lvswd1qq6119c96b767axilil88i7-proxychains-4.2.0/lib/libproxychains4.so: undefined symbol: dlerror

Using the patch:


[roxma@nixos:~/test]$ nix-env -f ~/nixpkgs -i proxychains
replacing old ‘proxychains-4.2.0’
installing ‘proxychains-4.2.0’

[roxma@nixos:~/test]$ proxychains4 git submodule add git@github.com:haad/proxychains.git
[proxychains] config file found: /home/roxma/test/proxychains.conf
[proxychains] preloading /nix/store/sna49dpbb34gp7hgdkj5y1d4clrzffys-proxychains-4.2.0/lib/libproxychains4.so
[proxychains] DLL init
[proxychains] DLL init
[proxychains] DLL init
[proxychains] DLL init
[proxychains] DLL init
[proxychains] DLL init
[proxychains] DLL init
[proxychains] DLL init
[proxychains] DLL init
[proxychains] DLL init
[proxychains] DLL init
[proxychains] DLL init
[proxychains] DLL init
[proxychains] DLL init
[proxychains] DLL init
[proxychains] DLL init
[proxychains] DLL init
[proxychains] DLL init
[proxychains] DLL init
Cloning into '/home/roxma/test/proxychains'...
[proxychains] DLL init
[proxychains] Strict chain  ...  10.0.2.2:1080  ...  192.30.253.112:22  ...  OK
remote: Counting objects: 794, done.
[proxychains] DLL init
remote: Total 794 (delta 0), reused 0 (delta 0), pack-reused 794
Receiving objects: 100% (794/794), 457.87 KiB | 130.00 KiB/s, done.
Resolving deltas: 100% (471/471), done.
[proxychains] DLL init
[proxychains] DLL init
[proxychains] DLL init
[proxychains] DLL init
[proxychains] DLL init
[proxychains] DLL init
[proxychains] DLL init
[proxychains] DLL init

@mention-bot
Copy link

@roxma, thanks for your PR! By analyzing the history of the files in this pull request, we identified @womfoo, @peti and @bjornfor to be potential reviewers.

@roxma
Copy link
Contributor Author

roxma commented Nov 12, 2016

Thiis issue is fixed in proxychains with this commit 4 years ago.

But there's no release since then. I'm not sure this is the right way, anyway, I post a simple patch here.

roxma referenced this pull request in haad/proxychains Nov 12, 2016
roxma referenced this pull request in haad/proxychains Nov 12, 2016
@joachifm
Copy link
Contributor

You can fetch an individual commit as a patch. Whether it'll apply is another matter :)

@roxma
Copy link
Contributor Author

roxma commented Nov 13, 2016

@joachifm
You mean I shoud fetch the individual commit instead of creating a patch myself?
I'm wondering, since there's no newer release is provided by proxychains's git repo by now, how to give an appropriate version number of that commit?

@joachifm
Copy link
Contributor

It's not any different than using your own patch, if they both do the same thing and both apply to the same base. In that scenario, the commit doesn't need a version number any more (or less, I suppose) than your patch does.

@womfoo
Copy link
Member

womfoo commented Nov 16, 2016

@roxma I'd leave the version number as-is since this fix just adds a linker flag.

I also agree with @joachifm to keep patches out of nixpkgs if they can be pulled online. You can do this with fetchpatch - see 4e59b1a for an example.

@roxma
Copy link
Contributor Author

roxma commented Nov 25, 2016

Sorry for the late reply.

I tried using the specific commit as a patch. It does not work as expected for me.

b/pkgs/tools/networking/proxychains/default.nix
index ed19f9d..75acf23 100644
--- a/pkgs/tools/networking/proxychains/default.nix
+++ b/pkgs/tools/networking/proxychains/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub } :
+{ stdenv, fetchpatch, fetchFromGitHub } :
 stdenv.mkDerivation rec {
   name = "proxychains-${version}";
   version = "4.2.0";
@@ -16,4 +16,12 @@ stdenv.mkDerivation rec {
     license = stdenv.lib.licenses.gpl2Plus;
     platforms = stdenv.lib.platforms.linux;
   };
+
+  patches = [
+    (fetchpatch { /* glibmm 2.50 fix */
+     url = https://github.com/haad/proxychains/commit/fb30a834a797c7e1a924f46d6746f3c230298e1d.patch;
+     sha256 = "1viwqm8bd0q696kfr6wjzv2hca25inxw727cyapsjffi1scq6d9c";
+     })
+  ];
+
 }

Got an error here Hunk #1 FAILED at 86.

[roxma@nixos:~/git/nixpkgs/pkgs/tools/networking/proxychains]$ nix-env -f ~/git/nixpkgs -i proxychains
installing ‘proxychains-4.2.0’
these derivations will be built:
  /nix/store/m03ijgpiy17qmw2qqpc425ydlsnk4srj-proxychains-4.2.0.drv
building path(s) ‘/nix/store/1nlijjz70ffah7al1r12c34m2aj2qf3m-proxychains-4.2.0’
unpacking sources
unpacking source archive /nix/store/93584awi5dalhhra43pvk8cpw76w0m6z-proxychains-proxychains-4.2.0-src
source root is proxychains-proxychains-4.2.0-src
patching sources
applying patch /nix/store/gmmx4kx5qpzyp78bvshmxki6hplj974k-fb30a834a797c7e1a924f46d6746f3c230298e1d.patch
patching file Makefile
patching file configure
Hunk #1 FAILED at 86.
1 out of 1 hunk FAILED -- saving rejects to file configure.rej
builder for ‘/nix/store/m03ijgpiy17qmw2qqpc425ydlsnk4srj-proxychains-4.2.0.drv’ failed with exit code 1
error: build of ‘/nix/store/m03ijgpiy17qmw2qqpc425ydlsnk4srj-proxychains-4.2.0.drv’ failed

@joachifm
Copy link
Contributor

@roxma if the upstream patch fails to apply, we can use yours until a new release is made. I believe your original patch easily reduces to a single sed call, however, please consider doing that instead; it's fairly common to do ad-hoc patching like this inline in Nixpkgs.

@roxma
Copy link
Contributor Author

roxma commented Nov 25, 2016

I just updated the PR, I pull all the commits as patch on the configure file until I reach a working one.

====
EDIT:

diff --git a/pkgs/tools/networking/proxychains/default.nix b/pkgs/tools/networking/proxychains/default.nix
index ed19f9d..f40a392 100644
--- a/pkgs/tools/networking/proxychains/default.nix
+++ b/pkgs/tools/networking/proxychains/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub } :
+{ stdenv, fetchpatch, fetchFromGitHub } :
 stdenv.mkDerivation rec {
   name = "proxychains-${version}";
   version = "4.2.0";
@@ -16,4 +16,37 @@ stdenv.mkDerivation rec {
     license = stdenv.lib.licenses.gpl2Plus;
     platforms = stdenv.lib.platforms.linux;
   };
+
+  patches = [
+
+    /* fix ld flags */
+
+    /* Fix library settings. */
+    (fetchpatch {
+     url = https://github.com/haad/proxychains/commit/2eb641758ba15d9f931e6b599ef14523d5ebf6d5.patch;
+     sha256 = "1rzwg7vrrlpjf0s4m5gbzfhb75ahwcm2m9x4l7w3n92gfzb066b5";
+     })
+     /* Add OS specific LD, C flags this enables use to use -pthread and -lpt… */
+    (fetchpatch {
+     url = https://github.com/haad/proxychains/commit/fb30a834a797c7e1a924f46d6746f3c230298e1d.patch;
+     sha256 = "1viwqm8bd0q696kfr6wjzv2hca25inxw727cyapsjffi1scq6d9c";
+     })
+     /* Use same LD parameters where is it possible. */
+    (fetchpatch {
+     url = https://github.com/haad/proxychains/commit/93bbad6ccbe6006a909c094e22569a9ed2d207fa.patch;
+     sha256 = "05vvwa5whi34l8wbzkhhqyfss5xh0f9gbw8859c7592n069875ib";
+     })
+     /* Make linux and mac options similar.*/
+    (fetchpatch {
+     url = https://github.com/haad/proxychains/commit/dcbafb0279a5e0e4dc1055afb533d3909327b6bb.patch;
+     sha256 = "1ydicfja68z984pqqh90689cacv8xyfr935h1qh40xbbsd84vd44";
+     })
+     /* Fix Linux compile issue */
+    (fetchpatch {
+     url = https://github.com/haad/proxychains/commit/86dfc828f196c255a18d6730cd16816b35e2fbaf.patch;
+     sha256 = "1113yjwyj17kfq23aw4gk9vaw8m47l2n45ffj8chlis8wyqphm8g";
+     })
+
+  ];
+
 }

@roxma
Copy link
Contributor Author

roxma commented Nov 25, 2016

I can use a sed call if you prefer that way. Is there any example I can refer to?

@roxma
Copy link
Contributor Author

roxma commented Nov 25, 2016

OK. I'm using sed now, It looks simpler.

====
EDIT:

diff --git a/pkgs/tools/networking/proxychains/default.nix b/pkgs/tools/networking/proxychains/default.nix
index ed19f9d..0c6df85 100644
--- a/pkgs/tools/networking/proxychains/default.nix
+++ b/pkgs/tools/networking/proxychains/default.nix
@@ -16,4 +16,10 @@ stdenv.mkDerivation rec {
     license = stdenv.lib.licenses.gpl2Plus;
     platforms = stdenv.lib.platforms.linux;
   };
+
+  preConfigure = ''
+  # patch, add -ldl flag
+  sed -i Makefile -e '/-lpthread/a LDFLAGS+=-ldl'
+  '';
+
 }

@roxma
Copy link
Contributor Author

roxma commented Nov 25, 2016

By the way, I found proxychains-ng and It looks more well-maintained. Maybe It's worth to create another package for this.

@joachifm
Copy link
Contributor

Merged. Thank you

@joachifm joachifm closed this in 78f81c5 Nov 25, 2016
@Janik-Haag Janik-Haag added the 12. first-time contribution This PR is the author's first one; please be gentle! label Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
12. first-time contribution This PR is the author's first one; please be gentle!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants