sergei-mironov / asterisk-dongle-setup

Playground project aimed at setting up Asterisk server and the GSM stack on Nix.
29 stars 4 forks source link

TG2SIP Compile Issue #2

Closed AlphaJosh closed 2 years ago

AlphaJosh commented 2 years ago

I am running ./run.sh as my non-root user and I am getting the following error:

+ nix-build -A asterisk -o result-asterisk -K
/nix/store/yka01vcbdipz864lrnbyp2bl9bk5w7ag-asterisk+opus-16.19.1
+ nix-build -A asterisk-conf -o result-conf
/nix/store/yrxylb2f8jafp1yycln1q8wg0d33q1ks-asterisk-conf
+ nix-build -A python-scripts -o result-python
/nix/store/041r220sp8pfiv9i0pmymyg0j845zd8q-python-scripts-1.0
+ nix-build -A tg2sip -o result-tg2sip
these 2 derivations will be built:
  /nix/store/x8zg1gvjk1fa96v8klc39db7q8z1qaxl-pjsip+opus-2.9.drv
  /nix/store/zh3nyjcyj6vdrixd0cf9nkbr4fj9gbfj-tg2sip.drv
building '/nix/store/x8zg1gvjk1fa96v8klc39db7q8z1qaxl-pjsip+opus-2.9.drv'...
unpacking sources
unpacking source archive /nix/store/yhyr53nwzh014h8aw1ickmpsvxiidm3a-source
source root is source
patching sources
applying patch /nix/store/s7rbydn67vcsmqkqz87g873g1p2jrhx8-fix-aarch64.patch
patching file aconfigure
Hunk #1 FAILED at 9174.
1 out of 1 hunk FAILED -- saving rejects to file aconfigure.rej
error: builder for '/nix/store/x8zg1gvjk1fa96v8klc39db7q8z1qaxl-pjsip+opus-2.9.drv' failed with exit code 1;
       last 8 log lines:
       > unpacking sources
       > unpacking source archive /nix/store/yhyr53nwzh014h8aw1ickmpsvxiidm3a-source
       > source root is source
       > patching sources
       > applying patch /nix/store/s7rbydn67vcsmqkqz87g873g1p2jrhx8-fix-aarch64.patch
       > patching file aconfigure
       > Hunk #1 FAILED at 9174.
       > 1 out of 1 hunk FAILED -- saving rejects to file aconfigure.rej
       For full logs, run 'nix log /nix/store/x8zg1gvjk1fa96v8klc39db7q8z1qaxl-pjsip+opus-2.9.drv'.
error: 1 dependencies of derivation '/nix/store/zh3nyjcyj6vdrixd0cf9nkbr4fj9gbfj-tg2sip.drv' failed to build

Any help would be appreciated

sergei-mironov commented 2 years ago

First of all, thank you for even trying to build this project. The setup is rater complex and I may miss some important points, so pelase ask if you see any troubles.

Regarding the pjsip the problem: it is likely in some recent changes made by nixpkgs authors. The nix upstream started to diverge from tg2sip's expectations some time ago, so I had to downgrade pjsip version. Looking at your error I think that they probably introduced more changes wich is not compatible with pjsip-2.9 which is only acceptable by tg2sip.

I see 2 options how to fix it:

  1. Use an older version of nixpkgs. Last time I checked, the following commit worked: https://github.com/NixOS/nixpkgs/commit/3e55f1df9d5d156dbcaa37fe452d7c765d41981d You may need to know how to use standalone nixpkgs trees instead of pre-installed by nix-channels (adjusting NIX_PATH, etc - check the Nix manual or ask here) update: or try changing the very first line of ./default.nix to something like pkgs ? import /path/to/your/nixpkgs {} This option is probably the most promising.
  2. Figure out how to improve my current code for downgrading pjsip here. One probably needs to add another line or two in order to disable the patching (in a hope that it is not important).

Note that rather than running run.sh, you can build pjsip and other components one-by-one like this

$ nix-build -A pjsip default.nix
...
/nix/store/srf9p5nw1hkjmxbns1fa26wwwfzxv09k-pjsip+opus-2.9
sergei-mironov commented 2 years ago

fix-aarch64.patch

BTW, are you trying to build everything for ARM?

AlphaJosh commented 2 years ago

No, on Debian 10 x64.

Thats the silly part, the patch looks like it is for ARM. I dont know NixOS so this is quite a learning curve.

sergei-mironov commented 2 years ago

No, on Debian 10 x64.

Thats the silly part, the patch looks like it is for ARM. I dont know NixOS so this is quite a learning curve.

OK then. I've checked my version of nixpkgs -it also has this patch. Nix applies it unconditionally to fix something related to ARM. In my nixpkgs it works fine. Probably, you have a newer nixpkgs which comes with a newer patch which is no longer compatible with the pjsip version I pinned manually. I've added a line which disables all the patches, it should help.

AlphaJosh commented 2 years ago

Boom baby! Compiled, thank you.

I have a couple more questions but I will open them up as different issue