a-lunev edited a comment on issue #3737:
URL: 
https://github.com/apache/incubator-nuttx/issues/3737#issuecomment-844337725


   Hi @patacongo,
   
   The file system (romfs) and file search PATH are good indeed.
   The error code ("ERROR: exec(errno) failed: 2") is confusing and does not 
expose the real cause. This is not "No such file or directory" cause.
   
   I've enabled debug logs and the real cause has been exposed:
   ```
   testheader: 
   ****************************************************************************
   * Executing errno
   ****************************************************************************
   
   errno
   load_absmodule: Loading /mnt/romfs/errno
   nxflat_loadbinary: Loading file: /mnt/romfs/errno
   nxflat_init: filename: /mnt/romfs/errno loadinfo: 0x20003d50
   nxflat_read: Read 36 bytes from offset 0
   nxflat_dumploadinfo: LOAD_INFO:
   nxflat_dumploadinfo:   ISPACE:
   nxflat_dumploadinfo:     ispace:       00000000
   nxflat_dumploadinfo:     entryoffs:    000000a4
   nxflat_dumploadinfo:     isize:        000001ba
   nxflat_dumploadinfo:   DSPACE:
   nxflat_dumploadinfo:     dspace:       00000000
   nxflat_dumploadinfo:     datasize:     00000040
   nxflat_dumploadinfo:     bsssize:      00000000
   nxflat_dumploadinfo:       (pad):      00000000
   nxflat_dumploadinfo:     stacksize:    00000800
   nxflat_dumploadinfo:     dsize:        00000040
   nxflat_dumploadinfo:   RELOCS:
   nxflat_dumploadinfo:     relocstart:   000001fa
   nxflat_dumploadinfo:     reloccount:   11
   nxflat_dumploadinfo:   HANDLES:
   nxflat_dumploadinfo:     filfd:        3
   nxflat_load: Mapped ISpace (442 bytes) at 00019d54
   nxflat_load: Allocated DSpace (108 bytes) at 0x200040c0
   nxflat_read: Read 108 bytes from offset 442
   nxflat_load: TEXT: 00019d54 Entry point offset: 000000a4 Data offset: 
000001ba
   nxflat_dumploadinfo: LOAD_INFO:
   nxflat_dumploadinfo:   ISPACE:
   nxflat_dumploadinfo:     ispace:       00019d54
   nxflat_dumploadinfo:     entryoffs:    000000a4
   nxflat_dumploadinfo:     isize:        000001ba
   nxflat_dumploadinfo:   DSPACE:
   nxflat_dumploadinfo:     dspace:       200040b0
   nxflat_dumploadinfo:       crefs:      1
   nxflat_dumploadinfo:       region:     200040c0
   nxflat_dumploadinfo:     datasize:     00000040
   nxflat_dumploadinfo:     bsssize:      00000000
   nxflat_dumploadinfo:       (pad):      0000002c
   nxflat_dumploadinfo:     stacksize:    00000800
   nxflat_dumploadinfo:     dsize:        0000006c
   nxflat_dumploadinfo:   RELOCS:
   nxflat_dumploadinfo:     relocstart:   000001fa
   nxflat_dumploadinfo:     reloccount:   11
   nxflat_dumploadinfo:   HANDLES:
   nxflat_dumploadinfo:     filfd:        3
   nxflat_bindimports: Imports offset: 000001d2 nimports: 5
   nxflat_bindimports: Import[0] (0x200040d8) offset: 00000000 func: 00000000
   nxflat_bindimports: Exported symbol "__errno" not found
   nxflat_loadbinary: Failed to bind symbols program binary: -2
   exec_spawn: ERROR: Failed to load program 'errno': -2
   nxflat_main: ERROR: exec(errno) failed: 2
   ```
   
   As it turned out, symtab.c is generated with an empty g_nxflat_exports array.
   Makefile invokes $(APPDIR)/tools/mksymtab.sh script, that in turn invokes 
the host level "nm":
   `nm: errno: file format not recognized`
   
   As I understand, nxflat example was broken somewhere in 2020.
   I was able to find that nuttx-8.2 still worked correctly concerning this 
particular issue (the symbol table is generated successfully, and nxflat 
example normally works in nuttx-8.2).
   However, nuttx-9.1.0 and any newer state in nuttx repo are already broken.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to