NixOS / nixos

OBSOLETE (go to NixOS/nixpkgs) - NixOS, a Linux distribution based on the Nix package manager - OBSOLETE (go to NixOS/nixpkgs)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

segmentation fault

sjmackenzie opened this issue · comments

Just sudo nixos-rebuild --update test then, when I run commands like man configuration.nix or ps aux I get a Segmentation fault

[stewart@localhost:~/dev]$ ps aux
Segmentation fault

Can you post your nixos-version?

This is what I got

$ nixos-version
14.02pre37036.5e668f6 (Baboon)

Okay so the segmentation fault is really starting to get me down.

gdb fails.

[stewart@rivergod:~/dev]$ gdb
Segmentation fault

[stewart@rivergod:~/dev]$ ldd /nix/store/g8i1z783a5158bfybwws6qbd2lf8z0gn-gdb-7.6.2/bin/gdb
        linux-vdso.so.1 (0x00007fff6a0d7000)
        libreadline.so.6 => /nix/store/aacpvfiycczgw7njhrid05cqpn8n602s-readline-6.2/lib/libreadline.so.6 (0x00007f9072054000)
        libdl.so.2 => /home/stewart/.nix-profile/lib/libdl.so.2 (0x00007f9071e50000)
        libncursesw.so.5 => /home/stewart/.nix-profile/lib/libncursesw.so.5 (0x00007f9071bf5000)
        libm.so.6 => /home/stewart/.nix-profile/lib/libm.so.6 (0x00007f90718f7000)
        libpthread.so.0 => /home/stewart/.nix-profile/lib/libpthread.so.0 (0x00007f90716db000)
        libutil.so.1 => /home/stewart/.nix-profile/lib/libutil.so.1 (0x00007f90714d8000)
        libpython2.7.so.1.0 => /home/stewart/.nix-profile/lib/libpython2.7.so.1.0 (0x00007f90710fe000)
        libexpat.so.1 => /nix/store/iay21bxb5wvw66acqd9459ixss84b7l5-expat-2.1.0/lib/libexpat.so.1 (0x00007f9070ed5000)
        libc.so.6 => /home/stewart/.nix-profile/lib/libc.so.6 (0x00007f9070b25000)
        /nix/store/q784x64hp3nwdxx7lbgb16f74i2bhxxk-glibc-2.18/lib/ld-linux-x86-64.so.2 (0x00007f9072296000)

Any and all feedback is most welcome!

Have you done something "weird" with your environment? Like setting LD_PRELOAD/LD_LIBRARY_PATH or something?

I just tried ldd on the gdb binary. Note that the store path is the same as yours (pre-built from the channel):

$ nix-env -i gdb
installing `gdb-7.6.2'
these paths will be fetched (2.83 MiB download, 15.60 MiB unpacked):
  /nix/store/g8i1z783a5158bfybwws6qbd2lf8z0gn-gdb-7.6.2
fetching path `/nix/store/g8i1z783a5158bfybwws6qbd2lf8z0gn-gdb-7.6.2'...

*** Downloading ‘http://cache.nixos.org/nar/18x3xk763387b3q3xihgk0k38v01jrn9c44fm759fsk937imiw5p.nar.xz’ to ‘/nix/store/g8i1z783a5158bfybwws6qbd2lf8z0gn-gdb-7.6.2’...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 2900k  100 2900k    0     0   742k      0  0:00:03  0:00:03 --:--:--  742k

building path(s) `/nix/store/76c761gh5v2wfx59mdsals7d6nx5fvhs-user-environment'                                                                                                                 
created 2022 symlinks in user environment                                                                                                                                                       

$ ldd /nix/store/g8i1z783a5158bfybwws6qbd2lf8z0gn-gdb-7.6.2/bin/gdb
        linux-vdso.so.1 (0x00007fff577fe000)                                                                                                                                                    
        libreadline.so.6 => /nix/store/aacpvfiycczgw7njhrid05cqpn8n602s-readline-6.2/lib/libreadline.so.6 (0x00007f74ae712000)
        libdl.so.2 => /nix/store/q784x64hp3nwdxx7lbgb16f74i2bhxxk-glibc-2.18/lib/libdl.so.2 (0x00007f74ae50e000)
        libncursesw.so.5 => /nix/store/9ixnhyfnypvh85pr6qx8a5cljc6q2ya0-ncurses-5.9/lib/libncursesw.so.5 (0x00007f74ae2ac000)
        libm.so.6 => /nix/store/q784x64hp3nwdxx7lbgb16f74i2bhxxk-glibc-2.18/lib/libm.so.6 (0x00007f74adfa9000)
        libpthread.so.0 => /nix/store/q784x64hp3nwdxx7lbgb16f74i2bhxxk-glibc-2.18/lib/libpthread.so.0 (0x00007f74add8b000)
        libutil.so.1 => /nix/store/q784x64hp3nwdxx7lbgb16f74i2bhxxk-glibc-2.18/lib/libutil.so.1 (0x00007f74adb88000)
        libpython2.7.so.1.0 => /nix/store/v849mmrx2fa1493svmk6qjb0b3qa7ya6-python-2.7.5/lib/libpython2.7.so.1.0 (0x00007f74ad782000)
        libexpat.so.1 => /nix/store/iay21bxb5wvw66acqd9459ixss84b7l5-expat-2.1.0/lib/libexpat.so.1 (0x00007f74ad559000)
        libc.so.6 => /nix/store/q784x64hp3nwdxx7lbgb16f74i2bhxxk-glibc-2.18/lib/libc.so.6 (0x00007f74ad1aa000)
        /nix/store/q784x64hp3nwdxx7lbgb16f74i2bhxxk-glibc-2.18/lib/ld-linux-x86-64.so.2 (0x00007f74ae954000)

One difference here is that on your system ldd prints paths to your profile but on my system it prints the direct store path.

And running gdb works (no segfault).

Yes! thank-you I was messing with LD_LIBRARY_PATH a while back. The issue was resolved by passing in the right config into my cmake file. I forgot to remove the LD_LIBRARY_PATH. many thanks!

Now I remember why I set LD_LIBRARY_PATH.
If I don't set it when I run my self compiled version of mozart oz I get this:

$ ozc
/home/stewart/oz/bin/ozemulator: error while loading shared libraries: libboost_program_options.so.1.55.0: cannot open shared object file: No such file or directory

I have no idea how to resolve this.

This is my cmake command Iuse to build oz:
cmake -DCMAKE_BUILD_TYPE=Release -DGTEST_SRC_DIR=../../externals/gtest -DGTEST_BUILD_DIR=../gtest-debug -DLLVM_SRC_DIR=~/.nix-profile/include/llvm -DLLVM_BUILD_DIR=~/.nix-profile/ -DCLANG_BUILD_DIR=~/.nix-profile/include -DCLANG_SRC_DIR=~/.nix-profile/ -DMOZART_BOOST_USE_STATIC_LIBS=OFF -DBOOST_INCLUDEDIR=~/.nix-profile/include -DBOOST_LIBRARYDIR=~/.nix-profile/lib -DMOZART_GENERATOR_FLAGS="-I/home/stewart/.nix-profile/include/c++/4.8.2;-I/home/stewart/.nix-profile/include/c++/4.8.2/x86_64-unknown-linux-gnu;-I/home/stewart/.nix-profile/include" -DCMAKE_INSTALL_PREFIX=~/oz ../../mozart2

It might be a good idea to open a new ticket for this issue that has an appropriate title and appropriate labels? Just my 2 cents.