lightning
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fw: 3 Bugs in Lightning


From: Max Barraclough
Subject: Fw: 3 Bugs in Lightning
Date: Thu, 27 Aug 2020 20:59:27 +0000




From: Max Barraclough <maxbarraclough@outlook.com>
Sent: 27 August 2020 21:12
To: Paulo César Pereira de Andrade <paulo.cesar.pereira.de.andrade@gmail.com>
Subject: Re: 3 Bugs in Lightning
 
Hi Paulo, so far I've only had time to look again at Issue 1:

I see I'd missed the '--enable-disassembler' flag in the configure script. Using it confirms the configure script failed to discover binutils-dev, as the script fails with a message saying such: 'configure: error: binutils not found, see http://www.gnu.org/software/binutils/'


I don't see any of what you mentioned in the config.log file. There's no mention of 'jit_private' or 'disassembler_ftype'. This is the case whether running './configure' or './configure --enable-disassembler'.

I'm not familiar with autotools but I took a look in configure.ac and saw a mention of libiberty, but installing the package libiberty-dev didn't make any difference. I also tried installing binutils-multiarch-dev but that made no difference either.

Here's a line-numbered excerpt from the config.log from when I ran './configure --enable-disassembler'. Line 517 is the only line matching 'binutils'. It's a fresh Ubuntu 20.04, except for the packages mentioned above, and for the following: build-essential gdb m4 binutils-dev



   -Max


466 configure: failed program was:
467 | /* confdefs.h */
468 | #define PACKAGE_NAME "GNU lightning"
469 | #define PACKAGE_TARNAME "lightning"
470 | #define PACKAGE_VERSION "2.1.3"
471 | #define PACKAGE_STRING "GNU lightning 2.1.3"
472 | #define PACKAGE_BUGREPORT "pcpa@gnu.org"
473 | #define PACKAGE_URL "http://www.gnu.org/software/lightning/"
474 | #define PACKAGE "lightning"
475 | #define VERSION "2.1.3"
476 | #define STDC_HEADERS 1
477 | #define HAVE_SYS_TYPES_H 1
478 | #define HAVE_SYS_STAT_H 1
479 | #define HAVE_STDLIB_H 1
480 | #define HAVE_STRING_H 1
481 | #define HAVE_MEMORY_H 1
482 | #define HAVE_STRINGS_H 1
483 | #define HAVE_INTTYPES_H 1
484 | #define HAVE_STDINT_H 1
485 | #define HAVE_UNISTD_H 1
486 | #define HAVE_DLFCN_H 1
487 | #define LT_OBJDIR ".libs/"
488 | #define HAVE_MREMAP 1
489 | #define HAVE_FFSL 1
490 | #define HAVE_GETOPT_LONG_ONLY 1
491 | #define HAVE_ISNAN 1
492 | #define HAVE_ISINF 1
493 | #define HAVE_GETOPT_H 1
494 | #define HAVE_STDINT_H 1
495 | #define HAVE_LIBBFD 1
496 | /* end confdefs.h.  */
497 |
498 | /* Override any GCC internal prototype to avoid an error.
499 |    Use char because int might match the return type of a GCC
500 |    builtin and then its argument prototype would still apply.  */
501 | #ifdef __cplusplus
502 | extern "C"
503 | #endif
504 | char compressBound ();
505 | int
506 | main ()
507 | {
508 | return compressBound ();
509 |   ;
510 |   return 0;
511 | }
512 configure:9005: result: no
513 configure:9018: checking for init_disassemble_info in -lopcodes
514 configure:9043: gcc -o conftest -g -O2   conftest.c -lopcodes  -lbfd  >&5
515 configure:9043: $? = 0
516 configure:9052: result: yes
517 configure:9070: error: binutils not found, see http://www.gnu.org/software/binutils/
518



From: Paulo César Pereira de Andrade <paulo.cesar.pereira.de.andrade@gmail.com>
Sent: 21 August 2020 19:08
To: Max Barraclough <maxbarraclough@outlook.com>
Cc: lightning@gnu.org <lightning@gnu.org>
Subject: Re: 3 Bugs in Lightning
 
Em qui., 25 de jun. de 2020 às 18:48, Max Barraclough
<maxbarraclough@outlook.com> escreveu:

  Hi,

  Sorry for the really long time to reply.

> Issue 1
> -------
> Platform: Ubuntu 20.04, AMD64. Also, Ubuntu 20.04, ARM64.
>
> Problem: The configure script fails to detect that the dev version of
> binutils ('binutils-dev') is installed. All 6 example programs compile
> and run fine, but the 'printf' example does not print disassembly.

  Likely it did not correctly detect binutils. Please check the
config.log file, and check what it prints below:

"""
| #include <lightning.h>
|       #include <lightning/jit_private.h>
|       #include <dis-asm.h>
|       int main(int argc, char *argv)
|       {
|               disassembler_ftype       print;
|               bfd                     *abfd;
|               print = disassembler(abfd);
|               return 0;
|       }
"""

  For some reason it failed to check, likely need to link to some
extra library, or some library is missing.

> Issue 2
> -------
> Platform: Amazon Linux 2, ARM64
>
> Problem: I'm able to configure and build, and the configure script
> detects that I've installed the binutils dev package, but all 6
> examples crash when run. Here's the error message:
>
>     Assertion 'a == bfd_get_arch(abfd) failed'

  This one is more complicated. Most likely need to hardcode
some code in lib/jit_disasm.c, following pattern of other
architectures, and select a base arch. I mean, something
in a pattern like this:
"""
#  if defined(__alpha__)
    disasm_info.arch = bfd_arch_alpha;
    disasm_info.mach = bfd_mach_alpha_ev6;
#  endif
"""
but adapted for arm64.

> Issue 3
> -------
> Platform: OmniOS (a distro of Illumos OpenSolaris), AMD64
>
> Problem: The 'ifib' and 'rfib' examples segfault. (I didn't install
> binutils dev.)

  To debug it, it should help to run under gdb, for example:
$ gdb doc/.libs/rfib
(gdb) b _jit_clear_state
(gdb) run
<<< when stopped in _jit_clear_state >>>
(gdb) fin
(gdb) x/30i _jit.code.ptr
(gdb) cont

the instruction address where it did segfault in the jit code
should help in understanding the root cause of the problem.

> On Amazon Linux 2 on AMD64, everything worked fine. The configure
> script correctly detected the binutils dev library, and all 6 examples
> ran fine, including the disassembly printing in the 'printf' example.
>
>
>    -Max
>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]