StationQ / Liquid

The Language-Integrated Quantum Operations (LIQUi|>) Simulator
http://StationQ.github.io/Liquid
Other
440 stars 97 forks source link

Linux version segfaults on Debian Jessie (mono 3.2.8) #35

Closed glaubitz closed 7 years ago

glaubitz commented 8 years ago

Hi there!

Just happened to test Liquid on Debian Jessie and noticed the Linux binary crashes while the Windows(?) binary works fine with the same Mono version:

glaubitz@qmio03:..glaubitz/Liquid-master> mono --version Mono JIT compiler version 3.2.8 (Debian 3.2.8+dfsg-10) Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com TLS: __thread SIGSEGV: altstack Notifications: epoll Architecture: amd64 Disabled: none Misc: softdebug LLVM: supported, not enabled. GC: sgen glaubitz@qmio03:..glaubitz/Liquid-master>

Windows version:

glaubitz@qmio03:..glaubitz/Liquid-master> mono ./bin/Liquid.exe 0:0000.0/ 0:0000.0/=========================================================================================== 0:0000.0/= The Language-Integrated Quantum Operations (LIQUi|>) Simulator = 0:0000.0/= Copyright (c) 2015,2016 Microsoft Corporation = 0:0000.0/= If you use LIQUi|> in your research, please follow the guidelines at = 0:0000.0/= https://github.com/msr-quarc/Liquid for citing LIQUi|> in your publications. = 0:0000.0/=========================================================================================== 0:0000.0/ 0:0000.0/TESTS (all start with two underscores): 0:0000.0/ Big() Try to run large entanglement tests (16 through 33 qubits) 0:0000.0/ Chem(m) Solve Ground State for molecule m (e.g., H2O) 0:0000.0/ ChemFull(...) See QChem docs for all the arguments 0:0000.0/ Correct() Use 15 qubits+random circs to test teleport 0:0000.0/ Entangle1(cnt) Run n qubit entanglement circuit (for timing purposes) 0:0000.0/ Entangle2(cnt) Entangle1 with compiled and optimized circuits 0:0000.0/ Entangles() Draw and run 100 instances of 16 qubit entanglement test 0:0000.0/ EntEnt() Entanglement entropy test 0:0000.0/ EIGS() Check eigevalues using ARPACK 0:0000.0/ EPR() Draw EPR circuit (.htm and .tex files) 0:0000.0/ Ferro(false,true) Test ferro magnetic coupling with true=full, true=runonce 0:0000.0/ JointCNOT() Run CNOTs defined by Joint measurements 0:0000.0/ Kraus(cnt,AD,DP,v)Teleport w/noise for cnt times with prob AmpDamp=AD, DePolar=DP, v=true=verbose 0:0000.0/ Noise1(d,i,p) d=# of idle gates, i=iters, p=probOfNoise 0:0000.0/ NoiseAmp() Amplitude damping (non-unitary) noise 0:0000.0/ QECC() Test teleport with errors and Steane7 code (gen drawing) 0:0000.0/ QFTbench() Benchmark QFT used in Shor (func,circ,optimized) 0:0000.0/ QLSA() Test of HHL linear equation solver 0:0000.0/ QuAM() Quantum Associative Memory 0:0000.0/ QWalk(typ) Walk tiny,tree,graph or RMat file with graph information 0:0000.0/ Ramsey33() Try to find a Ramsey(3,3) solution 0:0000.0/ SG() Test spin glass model 0:0000.0/ Shor(N,true) Factor N using Shor's algo false=direct true=optimized 0:0000.0/ show("str") Test routine to echo str and then exit 0:0000.0/ Steane7() Test basic error injection in Steane7 code 0:0000.0/ Teleport() Draw and run original, circuit and grown versions 0:0000.0/ __TSP(5) Try to find a Traveling Salesman solution for 5 to 8 cities 0:0000.0/ 0:0000.0/Liquid Usage: Liquid [/switch...] function 0:0000.0/ Enclose multi-word arguments in double quotes 0:0000.0/ 0:0000.0/Arguments (precede with / or -): 0:0000.0/ 0:0000.0/ Switch Default Purpose 0:0000.0/ ------ -------------------- ------------------------ 0:0000.0/ /log Liquid.log Output log file name path 0:0000.0/ /la Unset Append to old log files (otherwise erase) 0:0000.0/ 0:0000.0/ /s "" Compile and load script file 0:0000.0/ /l "" Load compiled script file 0:0000.0/ 0:0000.0/ 0:0000.0/ Final arg is the function to call: 0:0000.0/ function(pars,...) 0:0000.0/ 0:0000.0/============================================ 0:0000.0/ 0:0000.0/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 0:0000.0/!!! ERROR: Need to provide at least one argument 0:0000.0/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! glaubitz@qmio03:..glaubitz/Liquid-master>

Linux version:

glaubitz@qmio03:..glaubitz/Liquid-master> mono linux/Liquid.exe Missing method .ctor in assembly /local_scratch/glaubitz/Liquid-master/linux/Liquid.exe, type Microsoft.FSharp.Core.EntryPointAttribute Can't find custom attr constructor image: /local_scratch/glaubitz/Liquid-master/linux/Liquid.exe mtoken: 0x0a000011

Stacktrace:

Native stacktrace:

    mono() [0x4b5ca0]
    /lib/x86_64-linux-gnu/libpthread.so.0(+0xf8d0) [0x7ff6f251f8d0]
    /lib/x86_64-linux-gnu/libc.so.6(gsignal+0x37) [0x7ff6f219a067]
    /lib/x86_64-linux-gnu/libc.so.6(abort+0x148) [0x7ff6f219b448]
    mono() [0x6406e5]
    mono() [0x640853]
    mono() [0x529590]
    mono(mono_class_get_full+0xe2) [0x52a762]
    mono(mono_class_from_name+0xfe) [0x52ab7e]
    mono(mono_class_from_typeref+0x182) [0x52a392]
    mono(mono_class_get_full+0x145) [0x52a7c5]
    mono() [0x5296bd]
    mono(mono_class_get_full+0xe2) [0x52a762]
    mono() [0x5531aa]
    mono() [0x559a5e]
    mono() [0x42676e]
    mono(mono_runtime_invoke+0x3d) [0x5b8a8d]
    mono(mono_runtime_exec_main+0x10d) [0x5bb14d]
    mono(mono_main+0x1253) [0x48b863]
    /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0x7ff6f2186b45]
    mono() [0x419fad]

Debug info from gdb:

[New LWP 24286] [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". 0x00007ff6f251f4c9 in __libc_waitpid (pid=24287, stat_loc=0x7ffe171df7bc, options=0) at ../sysdeps/unix/sysv/linux/waitpid.c:40 40 ../sysdeps/unix/sysv/linux/waitpid.c: No such file or directory. Id Target Id Frame 2 Thread 0x7ff6effff700 (LWP 24286) "mono" sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:85

Thread 2 (Thread 0x7ff6effff700 (LWP 24286)):

0 sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:85

1 0x00000000006371d6 in mono_sem_wait ()

2 0x00000000005af5d4 in ?? ()

3 0x000000000059178b in ?? ()

4 0x000000000062ba1d in ?? ()

5 0x000000000063bd93 in ?? ()

6 0x00007ff6f25180a4 in start_thread (arg=0x7ff6effff700) at pthread_create.c:309

7 0x00007ff6f224d62d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 1 (Thread 0x7ff6f3008780 (LWP 24285)):

0 0x00007ff6f251f4c9 in __libc_waitpid (pid=24287, stat_loc=0x7ffe171df7bc, options=0) at ../sysdeps/unix/sysv/linux/waitpid.c:40

1 0x00000000004b5d3d in ?? ()

2

3 0x00007ff6f219a067 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56

4 0x00007ff6f219b448 in __GI_abort () at abort.c:89

5 0x00000000006406e5 in ?? ()

6 0x0000000000640853 in ?? ()

7 0x0000000000529590 in ?? ()

8 0x000000000052a762 in mono_class_get_full ()

9 0x000000000052ab7e in mono_class_from_name ()

10 0x000000000052a392 in mono_class_from_typeref ()

11 0x000000000052a7c5 in mono_class_get_full ()

12 0x00000000005296bd in ?? ()

13 0x000000000052a762 in mono_class_get_full ()

14 0x00000000005531aa in ?? ()

15 0x0000000000559a5e in ?? ()

16 0x000000000042676e in ?? ()

17 0x00000000005b8a8d in mono_runtime_invoke ()

18 0x00000000005bb14d in mono_runtime_exec_main ()

19 0x000000000048b863 in mono_main ()

20 0x00007ff6f2186b45 in __libc_start_main (main=0x419d10, argc=2, argv=0x7ffe171e1878, init=, fini=, rtld_fini=, stack_end=0x7ffe171e1868) at libc-start.c:287

21 0x0000000000419fad in ?? ()

================================================================= Got a SIGABRT while executing native code. This usually indicates a fatal error in the mono runtime or one of the native libraries used by your application.

Aborted glaubitz@qmio03:..glaubitz/Liquid-master>

Cheers, Adrian

dbwz8 commented 8 years ago

Makes no sense. If you cmp the two Liquid.exe files, you'll see that they're identical. The same holds for Liquid1.dll. I downloaded the current kit into a clean directory (just to make sure). When I run each, I get identical (correct) results. There much be something about your environment that's path dependent. Let me know if you figure out what's going on. The only reason that there are two directories is because of difference in the IDE.

glaubitz commented 8 years ago

I just had another quick go and noticed that the FSharp.Core.dll and FSharp.Core.xml (manifest?) file are not present in the Linux folder. Copying them over fixed the issue.

Please note I was using the Mono distribution which is part of Debian, so this issue affects a large number of potential users. Using the Mono distribution which was packaged for Debian Wheezy as suggested in [1] is not advisable as this can break other packages on Debian Jessie or newer. It's also not a good idea because it undermines the security support those runtimes are receiving in Debian.

I suggest repackaging Liquid so that the necessary DLLs are also in the search path on Linux (e.g., common lib directory and the use of LD_LIBRARY_PATH or similar).

Adrian

[1] https://github.com/StationQ/Liquid/blob/master/GettingStarted.md

alan-geller commented 8 years ago

@glaubitz Do you know if the pre-installed version of Mono includes F#? I know that the standard complete Mono install from the Mono site includes F# and the two DLLs you couldn't find. If the Debian built-in is missing F#, then I'll add a note to the set-up instructions to either do a complete Mono install or copy the two files over if you're on Debian. Thanks!

glaubitz commented 8 years ago

Those files are actually part of Debian's fsharp source package, more specifically in libfsharp-core4.3-cil which is built from the fsharp source package:

https://packages.debian.org/search?suite=sid&arch=any&mode=exactfilename&searchon=contents&keywords=FSharp.Core.dll

(Click on _libfsharp-core4.3-cil_and then Developer Information (PTS) and you see the association).

Anyway, the files seem to be part of Debian. Liquid just doesn't seem to find them.

Disclaimer: I am, by no means, familiar with Mono on Linux - I am an official Debian Developer, however - so I am not sure whether we are missing something in the fashion of LD_LIBRARY_PATH here. It might be a bug in Debian's fsharp package after all.

alan-geller commented 7 years ago

@glaubitz Hmm... Odd. I suspect it is indeed a LD_LIBRARY_PATH issue, but I don't have access to a Debian system to try to debug. I have added a note to the Linux getting started section that I think addresses this problem. If it turns out to be common, we can add the files to the Linux distribution as well. Thanks!!