opus icon indicating copy to clipboard operation
opus copied to clipboard

test_unit_LPC_inv_pred_gain fails on i686 gcc10

Open luc65r opened this issue 5 years ago • 16 comments

The test silk/tests/test_unit_LPC_inv_pred_gain fails when building the i686 package on NixOS with gcc10 and binutils-2.34 https://github.com/NixOS/nixpkgs/pull/89793. All tests succeed with gcc9 and binutils-2.31.1.

Here is test-suite.log: https://termbin.com/c41r.

luc65r avatar Dec 23 '20 13:12 luc65r

@luc65r I cannot reproduce it on GCC-10 x86_64 or i386. But I am building on ubuntu. Can you try to share more logs. Like config.log, give all build flags etc. Also if you could run the test under valgrind or some other tool and try to get more info would also be helpful.

xnorpx avatar Dec 24 '20 06:12 xnorpx

Here is config.log: https://termbin.com/uhr0. With -fsanitize=address, the tests do pass... The backtrace from gdb:

#0  0xf7fcf5c9 in __kernel_vsyscall ()
#1  0xf7d15585 in raise () from /nix/store/vzwhgdhbyxahzxmyg571fcp3k914yzc3-glibc-2.32-10/lib/libc.so.6
#2  0xf7cfe2fd in abort () from /nix/store/vzwhgdhbyxahzxmyg571fcp3k914yzc3-glibc-2.32-10/lib/libc.so.6
#3  0xf7d567b4 in __libc_message () from /nix/store/vzwhgdhbyxahzxmyg571fcp3k914yzc3-glibc-2.32-10/lib/libc.so.6
#4  0xf7df24cc in __fortify_fail () from /nix/store/vzwhgdhbyxahzxmyg571fcp3k914yzc3-glibc-2.32-10/lib/libc.so.6
#5  0xf7df2499 in __stack_chk_fail () from /nix/store/vzwhgdhbyxahzxmyg571fcp3k914yzc3-glibc-2.32-10/lib/libc.so.6
#6  0x0807e044 in __stack_chk_fail_local ()
#7  0x08049637 in check_stability (A_Q12=0xffffcadc, order=16) at silk/tests/test_unit_LPC_inv_pred_gain.c:88
#8  0x00000000 in ?? ()

luc65r avatar Dec 24 '20 19:12 luc65r

Is this an old version of Opus or does it occur with master?

jmvalin avatar Dec 24 '20 20:12 jmvalin

Can you try to disable -fstack-protector-strong flag from opus build?

Should be doable with: -disable-stack-protector when building with autotools.

xnorpx avatar Dec 25 '20 06:12 xnorpx

I tested it on 1.3.1 and master with the same behavior.

When disabling stack protection, it segfaults.

luc65r avatar Dec 25 '20 19:12 luc65r

Can you get a stacktrace without stackprotection?

xnorpx avatar Dec 25 '20 19:12 xnorpx

I'm just getting this with gdb

#0  0x00000000 in ?? ()

luc65r avatar Dec 25 '20 19:12 luc65r

@luc65r do yo have instructions how to setup the environment to reproduce the issue?

xnorpx avatar Dec 25 '20 22:12 xnorpx

@xnorpx Either you make a vm with NixOS or you install Nix directy. If you choose the second solution, which seems more convenient:

  • curl -L https://nixos.org/nix/install | sh (as told here https://nixos.org/download.html#nix-quick-install)
  • Clone my branch https://github.com/luc65r/nixpkgs/tree/staging, and maybe upstream's staging too
  • Set doCheck to true in pkgs/development/libraries/libopus/default.nix
  • nix-build -A pkgsi686Linux.libopus to build, and with -K to keep the build directory in /tmp/nix-build-something
  • nix-shell -A pkgsi686Linux.libopus -I nixpkgs=./ to get an interactive shell where you can run phases manually (unpackPhase, cd source, configurePhase, buildPhase, checkPhase)
  • Add NIX_CFLAGS_COMPILE = [ "-fno-stack-protector" ]; in pkgs/development/libraries/libopus/default.nix to disable stack protection

luc65r avatar Dec 25 '20 22:12 luc65r

Thanks, got it compiling and could reproduce the issue.

I tried to use the -K option to be able to go to the tmp/nix-build-libopus-1.3.1.drv-1/opus-1.3.1 and modify code.

When trying to make again from that directory it says: /usr/bin/ld: i386 architecture of input file `something.o' is incompatible with i386:x86-64 output.

Is it possible to reproduce the build again with make in that directory?

Or can I point nix to fetch fron local copy of opus?

xnorpx avatar Dec 26 '20 01:12 xnorpx

Is it possible to reproduce the build again with make in that directory?

Not really. You can however modify the source in the nix-shell after the unpackPhase.

Or can I point nix to fetch fron local copy of opus?

Yes sure, you need to modify src in pkgs/development/libraries/libopus/default.nix:

src = ./path/to/source;

If you need to generate the configure script, you can add autoreconfHook to the arguments (at the top of the file) and add

nativeBuildInputs = [
  autoreconfHook
];

You can also fetch the source from github by adding fetchFromGitHub to the arguments, and:

src = fetchFromGitHub {
  owner = "xiph";
  repo = "opus";
  rev = "v1.3.1"; # tag or commit
  sha256 = ""; # you can put 52 zeros, watch it fail and then replace it with the hash it gives
};

If you need gdb, you can add it to arguments and to nativeBuildInputs

luc65r avatar Dec 26 '20 08:12 luc65r

thanks, will see if I can figure something out.

xnorpx avatar Dec 27 '20 04:12 xnorpx

@luc65r can you test with this branch?

https://github.com/xnorpx/opus/tree/dev/gcc10-1

or use patch with this commit: https://github.com/xnorpx/opus/commit/6e2209d3dcdd4c4cf3b38f9357ce829d932c8b48

it passed for me locally

xnorpx avatar Jan 01 '21 05:01 xnorpx

It passed for me too.

Thank you for your dedication!

luc65r avatar Jan 04 '21 10:01 luc65r

@luc65r can you reopen the issue so I can use it to track until I get the change into master?

xnorpx avatar Jan 04 '21 16:01 xnorpx

The fix I had was not good, my guess this is a compiler issue with inline optimization on i686 gcc10.

xnorpx avatar Jan 13 '21 05:01 xnorpx