Fix creating incorrect .elf file when building .nro - #3
Conversation
The switch_rules .nro pattern requires .nro files to be generated from an identically-named .elf file. As a result, make would create a second .elf file with a non-_switch filename, then delete it after converting to .nro. I solved this by writing a custom build rule. If you wanted to use the existing rule on _switch.elf, you'd have to recursively make _switch.nro, then rename the file to .nro.
|
Thanks for this analysis, and yep your understanding is right, without being named per-platform, the wrong arch's
Is this an option? I haven't made big changes to this Makefile structure since it was introduced, but at the time I remember having a lot of issues fighting with those subfolders and placement of the .elf's |
I don't know if it's an option, but don't have the energy to look into it. I also do suspect that gdb may not be able to find the .elf in a subdirectory, unless you launch gdb from it. As a test I tried attaching from the parent of the Git clone, and gdb failed: Placing all output files in the build_switch folder would work, but may run into build system design conflicts (I'm not sure). In any case I don't particularly want to make further changes before this is merged, unless you have an idea of what to change. |
This project's Switch Makefile creates an
appname_switch.elffile (from$OUTPUT), then attempts to convert it toappname.nro(from$BINARY). However, it buildsappname.nrousing libnx'sswitch_rulespattern, which always builds a%.nrofile from an identically-named%.elffile. As a result, make would link a second .elf file namedappname.elf, then delete it after converting toappname.nro. As a result, we waste more time and disk space linking twice, and gdb'ssharedlibrary(share) command still looks for symbols in the missingappname.elf.I solved this by writing a custom build rule, which builds
appname.nrofromappname_switch.elf. If you wanted to use the existing%.nropattern onappname_switch.elf:appname_switch.nrofromappname_switch.elf, then rename the file toappname.nro.appname_switch.nroas a prerequisite ofappname.nro, since if you reranmakewith no changes, it would seeappname_switch.nrois missing, create it again, and rename it on top of the existingappname_switch.nro.appname_switch.nro, running make a second time still outputsappname_switch.nro, but doesn't rename it.Discussion:
appname.nroat the output root?