Openbazaar package - Help needed

#1

Anyone interested on helping me package the Openbazaar deb package found at https://github.com/OpenBazaar/openbazaar-desktop/releases/download/v2.3.2/openbazaar2_2.3.2_amd64.deb

I got this far:

{stdenv, fetchurl, autoPatchelfHook, xorg, gtk2, gnome2, nss, alsaLib, udev, dpkg}:                                           
                                                                                                                               
 stdenv.mkDerivation rec {                                                                                                     
   version = "2.3.2";                                                                                                          
   name = "openbazaar-${version}";                                                                                             
                                                                                                                               
   src = fetchurl {                                                                                                            
     url = "https://github.com/OpenBazaar/openbazaar-desktop/releases/download/v2.3.2/openbazaar2_2.3.2_amd64.deb";            
     sha256 = "0d68p3fv3jvzhsz3bx8n337ra1aaiawbd6q8ywvaflg7ljpvcyxl";                                                          
   };                                                                                                                          
                                                                                                                               
   nativeBuildInputs = [ autoPatchelfHook ];                                                                                   
                                                                                                                               
   buildInputs = with xorg; [                                                                                                  
     libXScrnSaver libXdamage libXtst                                                                                          
   ] ++ [                                                                                                                      
     nss gtk2 alsaLib gnome2.GConf dpkg                                                                                        
   ];                                                                                                                          
                                                                                                                               
   unpackPhase = ''                                                                                                            
     mkdir pkg                                                                                                                 
     dpkg-deb -x $src pkg                                                                                                      
     sourceRoot=pkg                                                                                                            
   '';                                                                                                                         
                                                                                                                               
   installPhase = ''                                                                                                           
     mkdir -p $out/lib $out/share $out/bin                                                                                     
     cp -r usr/lib/openbazaar2/* $out/lib                                                                                      
     cp -r usr/lib/openbazaar2/*.dat $out/bin                                                                                  
     cp -r usr/share/* $out/share                                                                                              
     cp usr/bin/openbazaar2 $out/bin/                                                                                          
   '';                                                                                                                                                                                                                                                        
 } 

The result returns a trace/trap exception:

$ strace ./result/bin/openbazaar2
execve("./openbazaar/usr/bin/openbazaar2", ["./openbazaar/usr/bin/openbazaar2"], 0x7ffc53d32bb0 /* 160 vars */) = 0
brk(NULL)                               = 0x4c22000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fe27d7de000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fe27d7dc000
access("/etc/ld-nix.so.preload", R_OK)  = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/run/opengl-driver/lib/tls/haswell/x86_64/libnode.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/run/opengl-driver/lib/tls/haswell/x86_64", 0x7fffac2d88c0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/run/opengl-driver/lib/tls/haswell/libnode.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/run/opengl-driver/lib/tls/haswell", 0x7fffac2d88c0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/run/opengl-driver/lib/tls/x86_64/libnode.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/run/opengl-driver/lib/tls/x86_64", 0x7fffac2d88c0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/run/opengl-driver/lib/tls/libnode.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/run/opengl-driver/lib/tls", 0x7fffac2d88c0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/run/opengl-driver/lib/haswell/x86_64/libnode.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/run/opengl-driver/lib/haswell/x86_64", 0x7fffac2d88c0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/run/opengl-driver/lib/haswell/libnode.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/run/opengl-driver/lib/haswell", 0x7fffac2d88c0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/run/opengl-driver/lib/x86_64/libnode.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/run/opengl-driver/lib/x86_64", 0x7fffac2d88c0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/run/opengl-driver/lib/libnode.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/run/opengl-driver/lib", {st_mode=S_IFDIR|0555, st_size=1138, ...}) = 0

Somehow even thogh the binary is “properly” pached (ldd result/bin/openbazaar2 returns all patched) there are paths in the strace output pointing to a non-existent path: /run/opengl-driver/lib/libnode.so, which it’s actually LD_LIBRARY_PATH in my machine. I also notice some other paths with appended paths: /nix/store/0bws9nii7syzw76jjl2z554hynsmp65v-openbazaar-2.3.2/lib/tls/haswell/x86_64/libnode.so

I am probably not reading the output correctly.

Thanks for any help ahead of time.

#2

I do think that is perfectly normala for the dynamic linker to probe all paths in $LD_LIBRARY_PATH before consulting the embedded rpath. Try attaching gdb and getting a backtrace. ld.so usually don’t “traps” on failures.

You might also try throwing the deb package output into an FHS environment. Here is an example of a .deb binary package turned into an FHS env: https://github.com/clefru/nur-packages/blob/0752efdeba32f6f84cab5fa8ed5a9564d29753f5/pkgs/parsecgaming/default.nix

#3

@acyuta108 did you solve the problem? Not that I could be of any help, but I’m interested in having Openbazaar in Nixos :slight_smile:

#4

No, it’s a bit bizarre how it crashes after building and running. I attempted the FHS as suggested but I got pretty much the same result. I’ll keep trying if no one else wants to give it a shot.