No rule to make target error

Hi,

I got the error : No rule to make target : toplevel.mk when make toolchains/install, image of error is attached.Error

Do as instructed ("Please re-run make....") and post the relevant outout here.

Please use the "Preformatted text </>" button for logs, scripts, configs and general console output and do not post console output as picture.
grafik

2 Likes

try make toolchain/install

https://openwrt.org/docs/guide-developer/single.package

1 Like

Error2

not "toolchains", "toolchain"

1 Like

Yes got the same error when write "toolchain" as well.

I am getting this same issue. I have my openwrt after successfully creating a full image, so the tools and toolchain, etc,etc are prepared,compiled and installed.
After that, I modify the config of the nano package with this patch:

diff --git a/utils/nano/Makefile b/utils/nano/Makefile
index 156af90da..770537d45 100644
--- a/utils/nano/Makefile
+++ b/utils/nano/Makefile
@@ -72,17 +72,7 @@ ifeq ($(BUILD_VARIANT),plus)
    --enable-multibuffer \
    --enable-nanorc \
    --enable-utf8 \
-   --disable-browser \
-   --disable-color \
-   --disable-comment \
-   --disable-extra \
-   --disable-histories \
-   --disable-libmagic \
-   --disable-mouse \
-   --disable-operatingdir \
-   --disable-speller \
-   --disable-tabcomp \
-   --disable-wordcomp
+   --enable-color
 else
 # default tiny variant
   CONFIGURE_ARGS += \

well, I want to build only that package, so I do:
make -j1 V=s feeds/packages/nano/{clean,compile,prepare,install}
And I get the following error:

make[2]: Entering directory '/build/myopenwrt/openwrt/scripts/config'
make[2]: 'conf' is up to date.
make[2]: Leaving directory '/build/myopenwrt/openwrt/scripts/config'
make[1]: Entering directory '/build/myopenwrt/openwrt'
make[1]: *** No rule to make target 'feeds/packages/nano/clean'.  Stop.
make[1]: Leaving directory '/build/myopenwrt/openwrt'
make: *** [/build/myopenwrt/openwrt/include/toplevel.mk:230: feeds/packages/nano/clean] Error 2

I have tried to make the whole image again doing a make -j1 V=s without cleaning, but all I got is the same error when it reaches the feeds/packages/nano package.

At this point, I tried the method described in the wiki for building a single package:

make clean
make defconfig
make tools/install
make toolchain/install
make package/libs/ncurses/compile
make -j1 V=s package/libs/ncurses/install

And this last command also fails with the same error:

make[2]: Entering directory '/build/myopenwrt/openwrt/scripts/config'
make[2]: 'conf' is up to date.
make[2]: Leaving directory '/build/myopenwrt/openwrt/scripts/config'
make[1]: Entering directory '/build/myopenwrt/openwrt'
make[1]: *** No rule to make target 'package/ncurses/install'.  Stop.
make[1]: Leaving directory '/build/myopenwrt/openwrt'
make: *** [/build/myopenwrt/openwrt/include/toplevel.mk:230: package/ncurses/install] Error 2

I haven't modified the ncurses package, but it is falling too, even after doing a clean.
Is there any way I could experiment with this package without redoing the whole thing all over again?

Thanks

make path appears incorrect

The path is the same. I execute make commands from the openwrt folder, in my case /build/myopenwrt/openwrt. And it works for some packages but not for others.

package/feeds/packages/nano/Makefile 
feeds/packages/utils/nano/Makefile 

Oh! those are symlinks, package folder is actually pointing to folders inside feeds, actually the same Makefile in both cases.

I have tried using the package folder, and I have the same problem. nano and ncurses have the same issue, so probably the problem is actually in ncurses, as it is a dependency in nano.

In any case if I do a clean openwrt clone and prepare the feeds and use the .config file I used many times for creating the whole image. then, I do this sequence of commands:

make defconfig
make download
make tools/install
make toolchain/install
make package/libs/ncurses/compile
make package/libs/ncurses/install

and that last instruction fails with the mentioned error.

Its: package/feeds/packages/nano/{clean,compile}

And for ncurses

grommish@DESKTOP-AW:~/openwrt$ make V=sc package/libs/ncurses/compile
make[2]: Entering directory '/home/grommish/openwrt/scripts/config'
make[2]: 'conf' is up to date.
make[2]: Leaving directory '/home/grommish/openwrt/scripts/config'
make[1]: Entering directory '/home/grommish/openwrt'
make[2]: Entering directory '/home/grommish/openwrt/package/libs/ncurses'
make[2]: Leaving directory '/home/grommish/openwrt/package/libs/ncurses'
time: package/libs/ncurses/host-compile#0.17#2.12#2.16
make[2]: Entering directory '/home/grommish/openwrt/package/libs/toolchain'
echo "libc" >> /home/grommish/openwrt/staging_dir/target-mips64_octeonplus_64_musl/pkginfo/toolchain.default.install
echo "libgcc" >> /home/grommish/openwrt/staging_dir/target-mips64_octeonplus_64_musl/pkginfo/toolchain.default.install
echo "libatomic" >> /home/grommish/openwrt/staging_dir/target-mips64_octeonplus_64_musl/pkginfo/toolchain.default.install
echo "libpthread" >> /home/grommish/openwrt/staging_dir/target-mips64_octeonplus_64_musl/pkginfo/toolchain.default.install
echo "librt" >> /home/grommish/openwrt/staging_dir/target-mips64_octeonplus_64_musl/pkginfo/toolchain.default.install
make[2]: Leaving directory '/home/grommish/openwrt/package/libs/toolchain'
time: package/libs/toolchain/compile#0.17#1.28#1.45
make[2]: Entering directory '/home/grommish/openwrt/package/libs/zlib'
echo "zlib" >> /home/grommish/openwrt/staging_dir/target-mips64_octeonplus_64_musl/pkginfo/zlib.default.install
make[2]: Leaving directory '/home/grommish/openwrt/package/libs/zlib'
time: package/libs/zlib/compile#0.20#1.45#1.58
make[2]: Entering directory '/home/grommish/openwrt/package/libs/ncurses'
echo "terminfo" >> /home/grommish/openwrt/staging_dir/target-mips64_octeonplus_64_musl/pkginfo/ncurses.default.install
echo "libncurses" >> /home/grommish/openwrt/staging_dir/target-mips64_octeonplus_64_musl/pkginfo/ncurses.default.install
echo "libncurses-dev" >> /home/grommish/openwrt/staging_dir/target-mips64_octeonplus_64_musl/pkginfo/ncurses.default.install
make[2]: Leaving directory '/home/grommish/openwrt/package/libs/ncurses'
time: package/libs/ncurses/compile#0.28#2.32#2.54
make[1]: Leaving directory '/home/grommish/openwrt'
grommish@DESKTOP-AW:~/openwrt$

Edit: If you call make directly (ala make -C) you need TOPDIR=$PWD make -C xxxx or rules.mk won't work

1 Like

same problem with package/libs/ncurses and package/libs/zlib

I believe the problem lies in zlib, as I can compile it, but returns error when installing the headers. When I run TOPDIR=$PWD make -C package/feeds/packages/nano I got this:

make: Entering directory '/build/openwrt/feeds/packages/utils/nano'
touch /build/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/nano-6.2/.prepared_6727f35fdf422cba1bb8e89c0adee1df_6664517399ebbbc92a37c5bb081b5c53_check
. /build/openwrt/include/shell.sh; xzcat /build/openwrt/dl/nano-6.2.tar.xz | tar -C /build/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/nano-6.2/.. -xf -
[ ! -d ./src/ ] || cp -fpR ./src/. /build/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/nano-6.2
touch /build/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/nano-6.2/.prepared_6727f35fdf422cba1bb8e89c0adee1df_6664517399ebbbc92a37c5bb081b5c53
rm -f /build/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/nano-6.2/.configured_*
rm -f /build/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/stamp/.nano_installed
(cd /build/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/nano-6.2/./; if [ -x ./configure ]; then find /build/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/nano-6.2/ -name config.guess | xargs -r chmod u+w; find /build/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/nano-6.2/ -name config.guess | xargs -r -n1 cp --remove-destination /build/openwrt/scripts/config.guess; find /build/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/nano-6.2/ -name config.sub | xargs -r chmod u+w; find /build/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/nano-6.2/ -name config.sub | xargs -r -n1 cp --remove-destination /build/openwrt/scripts/config.sub; AR="arm-openwrt-linux-muslgnueabi-gcc-ar" AS="arm-openwrt-linux-muslgnueabi-gcc -c -Os -pipe -g3 -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=hard -fmacro-prefix-map=/build/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/nano-6.2=nano-6.2 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro" LD=arm-openwrt-linux-muslgnueabi-ld NM="arm-openwrt-linux-muslgnueabi-gcc-nm" CC="arm-openwrt-linux-muslgnueabi-gcc" GCC="arm-openwrt-linux-muslgnueabi-gcc" CXX="arm-openwrt-linux-muslgnueabi-g++" RANLIB="arm-openwrt-linux-muslgnueabi-gcc-ranlib" STRIP=arm-openwrt-linux-muslgnueabi-strip OBJCOPY=arm-openwrt-linux-muslgnueabi-objcopy OBJDUMP=arm-openwrt-linux-muslgnueabi-objdump SIZE=arm-openwrt-linux-muslgnueabi-size CFLAGS="-Os -pipe -g3 -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=hard -fmacro-prefix-map=/build/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/nano-6.2=nano-6.2 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro " CXXFLAGS="-Os -pipe -g3 -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=hard -fmacro-prefix-map=/build/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/nano-6.2=nano-6.2 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro " CPPFLAGS="-I/build/openwrt/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-11.2.0_musl_eabi/usr/include -I/build/openwrt/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-11.2.0_musl_eabi/include/fortify -I/build/openwrt/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-11.2.0_musl_eabi/include " LDFLAGS="-L/build/openwrt/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-11.2.0_musl_eabi/usr/lib -L/build/openwrt/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-11.2.0_musl_eabi/lib -znow -zrelro "  ac_cv_header_regex_h=no   ./configure --target=arm-openwrt-linux --host=arm-openwrt-linux --build= --program-prefix="" --program-suffix="" --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib --sysconfdir=/etc --datadir=/usr/share --localstatedir=/var --mandir=/usr/man --infodir=/usr/info --disable-nls  --enable-tiny --enable-linenumbers --disable-color --disable-utf8 ; fi; )
configure: loading site script /build/openwrt/include/site/arm
checking build system type... x86_64-pc-linux-musl
checking host system type... arm-openwrt-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-openwrt-linux-strip... arm-openwrt-linux-muslgnueabi-strip
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports the include directive... yes (GNU style)
checking for arm-openwrt-linux-gcc... arm-openwrt-linux-muslgnueabi-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether arm-openwrt-linux-muslgnueabi-gcc accepts -g... yes
checking for arm-openwrt-linux-muslgnueabi-gcc option to enable C11 features... none needed
checking whether arm-openwrt-linux-muslgnueabi-gcc understands -c and -o together... yes
checking whether the compiler is clang... no
checking for compiler option needed when checking for declarations... none
checking dependency style of arm-openwrt-linux-muslgnueabi-gcc... gcc3
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for wchar.h... yes
checking for minix/config.h... no
checking for sys/socket.h... yes
checking for dirent.h... yes
checking for fnmatch.h... yes
checking for getopt.h... yes
checking for sys/cdefs.h... no
checking for sys/time.h... yes
checking for glob.h... yes
checking for threads.h... yes
checking for limits.h... yes
checking for crtdefs.h... no
checking for wctype.h... yes
checking for langinfo.h... yes
checking for xlocale.h... no
checking for math.h... yes
checking for sys/mman.h... yes
checking for sys/param.h... yes
checking for malloc.h... yes
checking for features.h... yes
checking for sys/random.h... yes
checking for sys/wait.h... yes
checking for utime.h... yes
checking whether it is safe to define __EXTENSIONS__... yes
checking whether _XOPEN_SOURCE should be defined... no
checking for arm-openwrt-linux-gcc... (cached) arm-openwrt-linux-muslgnueabi-gcc
checking whether the compiler supports GNU C... (cached) yes
checking whether arm-openwrt-linux-muslgnueabi-gcc accepts -g... (cached) yes
checking for arm-openwrt-linux-muslgnueabi-gcc option to enable C11 features... (cached) none needed
checking whether arm-openwrt-linux-muslgnueabi-gcc understands -c and -o together... (cached) yes
checking whether the compiler is clang... (cached) no
checking for compiler option needed when checking for declarations... (cached) none
checking dependency style of arm-openwrt-linux-muslgnueabi-gcc... (cached) gcc3
checking how to run the C preprocessor... arm-openwrt-linux-muslgnueabi-gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for Minix Amsterdam compiler... no
checking for arm-openwrt-linux-ar... arm-openwrt-linux-muslgnueabi-gcc-ar
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking for size_t... yes
checking for working alloca.h... yes
checking for alloca... yes
checking whether <wchar.h> uses 'inline' correctly... yes
checking for btowc... yes
checking for _set_invalid_parameter_handler... no
checking for fcntl... yes
checking for symlink... yes
checking for fnmatch... yes
checking for mbsrtowcs... yes
checking for futimens... yes
checking for getdelim... yes
checking for getdtablesize... yes
checking for getlogin_r... yes
checking for getrandom... yes
checking for timespec_get... yes
checking for gettimeofday... (cached) yes
checking for glob... yes
checking for glob_pattern_p... no
checking for getpwnam_r... yes
checking for isblank... yes
checking for iswcntrl... yes
checking for iswblank... yes
checking for lstat... (cached) yes
checking for mbsinit... yes
checking for mbrtowc... yes
checking for mprotect... yes
checking for mkstemps... yes
checking for nl_langinfo... yes
checking for iswctype... yes
checking for sigaction... yes
checking for sigaltstack... yes
checking for siginterrupt... yes
checking for snprintf... yes
checking for vasnprintf... no
checking for futimes... yes
checking for futimesat... yes
checking for utimensat... yes
checking for lutimes... yes
checking for wcrtomb... yes
checking for wcwidth... yes
checking for wmempcpy... no
checking for nl_langinfo and CODESET... yes
checking for a traditional french locale... none
checking whether the preprocessor supports include_next... yes
checking whether source code line length is unlimited... yes
checking for arm-openwrt-linux-muslgnueabi-gcc options needed to detect all undeclared functions... none needed
checking for complete errno.h... yes
checking whether ctype.h defines __header_inline... no
checking for working fcntl.h... cross-compiling
checking for pid_t... yes
checking for mode_t... yes
checking for mbstate_t... yes
checking whether frexp() can be used without linking with libm... yes
checking whether alarm is declared... yes
checking whether long double and double are the same... yes
checking whether stat file-mode macros are broken... no
checking for C/C++ restrict keyword... __restrict__
checking for nlink_t... yes
checking whether getdelim is declared... yes
checking whether getdtablesize is declared... yes
checking whether getline is declared... yes
checking whether getlogin_r is declared... yes
checking whether getlogin is declared... yes
checking for getopt.h... (cached) yes
checking for getopt_long_only... yes
checking whether getopt is POSIX compatible... guessing yes
checking for working GNU getopt function... guessing no
checking for struct timeval... yes
checking for wide-enough struct timeval.tv_sec member... yes
checking for pthread.h... yes
checking for pthread_kill in -lpthread... yes
checking whether POSIX threads API is available... yes
checking whether setlocale (LC_ALL, NULL) is multithread-safe... yes
checking whether setlocale (category, NULL) is multithread-safe... yes
checking whether limits.h has WORD_BIT, BOOL_WIDTH etc.... no
checking for wint_t... yes
checking whether wint_t is large enough... yes
checking whether the compiler produces multi-arch binaries... no
checking whether stdint.h conforms to C99... guessing yes
checking whether stdint.h works without ISO C predefines... yes
checking whether stdint.h has UINTMAX_WIDTH etc.... no
checking where to find the exponent in a 'double'... unknown
checking where to find the exponent in a 'float'... word 0 bit 23
checking whether byte ordering is bigendian... (cached) no
checking whether iswcntrl works... guessing yes
checking for towlower... yes
checking for wctype_t... yes
checking for wctrans_t... yes
checking whether langinfo.h defines CODESET... yes
checking whether langinfo.h defines T_FMT_AMPM... yes
checking whether langinfo.h defines ALTMON_1... no
checking whether langinfo.h defines ERA... yes
checking whether langinfo.h defines YESEXPR... yes
checking for wchar_t... yes
checking for good max_align_t... yes
checking whether NULL can be used in arbitrary expressions... yes
checking whether locale.h defines locale_t... yes
checking whether locale.h conforms to POSIX:2001... yes
checking whether struct lconv is properly defined... yes
checking whether imported symbols can be declared weak... guessing yes
checking for multithread API to use... posix
checking whether lstat correctly handles trailing slash... guessing yes
checking whether malloc is ptrdiff_t safe... no
checking whether malloc, realloc, calloc set errno on failure... yes
checking whether malloc (0) returns nonnull... (cached) yes
checking whether NAN macro works... yes
checking whether HUGE_VAL works... yes
checking for a traditional japanese locale... none
checking for a french Unicode locale... none
checking for a transitional chinese locale... none
checking for inline... inline
checking for mmap... yes
checking for MAP_ANONYMOUS... yes
checking whether memchr works... guessing no
checking whether <limits.h> defines MIN and MAX... no
checking whether <sys/param.h> defines MIN and MAX... yes
checking for O_CLOEXEC... yes
checking for promoted mode_t type... mode_t
checking for sigset_t... yes
checking for uid_t in sys/types.h... yes
checking for volatile sig_atomic_t... yes
checking for sighandler_t... yes
checking whether snprintf returns a byte count as in C99... guessing yes
checking whether snprintf is declared... yes
checking for stdint.h... yes
checking for inttypes.h... yes
checking whether printf supports size specifiers as in C99... guessing yes
checking whether printf supports 'long double' arguments... (cached) yes
checking whether printf supports infinite 'double' arguments... guessing yes
checking whether printf supports infinite 'long double' arguments... (cached) yes
checking whether printf supports the 'a' and 'A' directives... guessing no
checking whether printf supports the 'F' directive... guessing yes
checking whether printf supports the 'n' directive... (cached) yes
checking whether printf supports the 'ls' directive... guessing yes
checking whether printf supports the grouping flag... guessing yes
checking whether printf supports the left-adjust flag correctly... guessing yes
checking whether printf supports the zero flag correctly... guessing yes
checking whether printf supports large precisions... guessing yes
checking whether printf survives out-of-memory conditions... guessing yes
checking whether snprintf truncates the result as in C99... guessing yes
checking for intmax_t... yes
checking for snprintf... (cached) yes
checking for strnlen... yes
checking for wcslen... yes
checking for wcsnlen... yes
checking for mbrtowc... (cached) yes
checking for wcrtomb... (cached) yes
checking whether _snprintf is declared... no
checking for stdbool.h that conforms to C99... yes
checking for _Bool... yes
checking whether fcloseall is declared... no
checking which flavor of printf attribute matches inttypes macros... system
checking whether ecvt is declared... yes
checking whether fcvt is declared... yes
checking whether gcvt is declared... yes
checking whether strnlen is declared... yes
checking for struct timespec in <time.h>... yes
checking for TIME_UTC in <time.h>... yes
checking whether execvpe is declared... yes
checking whether the utimes function works... guessing no
checking whether vsnprintf is declared... yes
checking whether wcsdup is declared... yes
checking for C compiler option to allow warnings... -Wno-error
checking for alloca as a compiler built-in... yes
checking whether btowc(0) is correct... guessing yes
checking whether btowc(EOF) is correct... guessing yes
checking for __builtin_expect... yes
checking for library containing clock_gettime... none required
checking for clock_getres... yes
checking for clock_gettime... yes
checking for clock_settime... yes
checking for closedir... yes
checking for d_type member in directory struct... yes
checking for dirfd... yes
checking whether dirfd is declared... yes
checking whether dirfd is a macro... no
checking whether // is distinct from /... unknown, assuming no
checking whether dup2 works... guessing yes
checking whether fcntl handles F_DUPFD correctly... guessing yes
checking whether fcntl understands F_DUPFD_CLOEXEC... guessing no
checking for flexible array member... yes
checking whether conversion from 'int' to 'long double' works... guessing yes
checking for working POSIX fnmatch... guessing no
checking whether free is known to preserve errno... no
checking whether frexp works... guessing yes
checking whether frexpl is declared... yes
checking whether frexpl() can be used without linking with libm... yes
checking whether frexpl works... guessing yes
checking whether futimens works... guessing no
checking for working getdelim function... guessing no
checking for flockfile... yes
checking for funlockfile... yes
checking whether getc_unlocked is declared... yes
checking whether getdtablesize works... guessing yes
checking for getline... yes
checking for working getline function... guessing no
checking whether getlogin_r works with small buffers... guessing yes
checking whether getrandom is compatible with its GNU+BSD signature... yes
checking for gettimeofday with POSIX signature... yes
checking for GNU glob interface version 1 or 2... no
checking whether isnan(double) can be used without linking with libm... yes
checking whether isnan(float) can be used without linking with libm... yes
checking whether isnan(float) works... guessing yes
checking whether isnan(long double) can be used without linking with libm... yes
checking whether isnanl works... guessing yes
checking whether iswblank is declared... yes
checking whether the compiler supports the __inline keyword... yes
checking for pthread_rwlock_t... yes
checking whether pthread_rwlock_rdlock prefers a writer to a reader... guessing no
checking whether mbrtowc handles incomplete characters... guessing yes
checking whether mbrtowc works as well as mbtowc... guessing yes
checking whether mbrtowc handles a NULL pwc argument... guessing yes
checking whether mbrtowc handles a NULL string argument... guessing yes
checking whether mbrtowc has a correct return value... guessing yes
checking whether mbrtowc returns 0 when parsing a NUL character... guessing yes
checking whether mbrtowc stores incomplete characters... guessing no
checking whether mbrtowc works on empty input... guessing no
checking whether the C locale is free of encoding errors... guessing no
checking whether mbrtowc handles incomplete characters... (cached) guessing yes
checking whether mbrtowc works as well as mbtowc... (cached) guessing yes
checking whether mbrtowc handles incomplete characters... (cached) guessing yes
checking whether mbrtowc works as well as mbtowc... (cached) guessing yes
checking whether mbsrtowcs works... guessing yes
checking for mbtowc... yes
checking for bp-sym.h... no
checking for mempcpy... yes
checking whether mkdir handles trailing slash... guessing yes
checking whether mkdir handles trailing dot... guessing yes
checking whether YESEXPR works... guessing yes
checking whether open recognizes a trailing slash... guessing yes
checking for opendir... yes
checking whether frexp works... (cached) guessing yes
checking whether ldexp can be used without linking with libm... yes
checking whether frexpl() can be used without linking with libm... (cached) yes
checking whether frexpl works... (cached) guessing yes
checking whether frexpl is declared... (cached) yes
checking whether ldexpl() can be used without linking with libm... yes
checking whether ldexpl works... guessing yes
checking whether ldexpl is declared... yes
checking for raise... yes
checking for sigprocmask... yes
checking for readdir... yes
checking for working re_compile_pattern... guessing no
checking for libintl.h... yes
checking whether isblank is declared... yes
checking whether setlocale (LC_ALL, NULL) is multithread-safe... (cached) yes
checking whether setlocale (category, NULL) is multithread-safe... (cached) yes
checking for struct sigaction.sa_sigaction... yes
checking for signbit macro... guessing yes
checking for signbit compiler built-ins... guessing yes
checking for sigprocmask... (cached) yes
checking for stdint.h... (cached) yes
checking for SIZE_MAX... yes
checking for snprintf... (cached) yes
checking whether snprintf respects a size of 1... guessing yes
checking whether printf supports POSIX/XSI format strings with positions... guessing yes
checking for snprintf... (cached) yes
checking whether snprintf fully supports the 'n' directive... (cached) yes
checking whether snprintf respects a size of 1... (cached) guessing yes
checking whether vsnprintf respects a zero size as in C99... guessing yes
checking for nl_langinfo... (cached) yes
checking for ptrdiff_t... yes
checking for ssize_t... yes
checking whether stat handles trailing slashes on files... guessing yes
checking for struct stat.st_atim.tv_nsec... yes
checking whether struct stat.st_atim is of type struct timespec... yes
checking for struct stat.st_birthtimespec.tv_nsec... no
checking for struct stat.st_birthtimensec... no
checking for struct stat.st_birthtim.tv_nsec... no
checking for working stdalign.h... yes
checking for va_copy... yes
checking for strcasecmp... yes
checking for strncasecmp... yes
checking whether strncasecmp is declared... yes
checking for strcasestr... yes
checking for working strnlen... yes
checking for utime... yes
checking whether utime handles trailing slashes on files... guessing yes
checking for variable-length arrays... yes
checking for ptrdiff_t... (cached) yes
checking for vsnprintf... (cached) yes
checking whether snprintf respects a size of 1... (cached) guessing yes
checking whether printf supports POSIX/XSI format strings with positions... (cached) guessing yes
checking for vsnprintf... (cached) yes
checking whether snprintf fully supports the 'n' directive... (cached) yes
checking whether snprintf respects a size of 1... (cached) guessing yes
checking whether vsnprintf respects a zero size as in C99... (cached) guessing yes
checking for nl_langinfo... (cached) yes
checking for ptrdiff_t... (cached) yes
checking whether mbrtowc handles incomplete characters... (cached) guessing yes
checking whether mbrtowc works as well as mbtowc... (cached) guessing yes
checking whether wcrtomb works in the C locale... guessing yes
checking whether wcrtomb return value is correct... guessing yes
checking whether wcwidth is declared... yes
checking whether wcwidth works reasonably in UTF-8 locales... guessing yes
checking for wmemchr... yes
checking for stdint.h... (cached) yes
checking whether ln -s works... yes
checking for library containing strerror... none required
checking for special C compiler options needed for large files... (cached) no
checking for _FILE_OFFSET_BITS value needed for large files... (cached) no
checking pkg-config is at least version 0.9.0... /build/openwrt/staging_dir/host/bin/pkg-config: 3: pkg-config.real: not found
no
checking for a sed that does not truncate output... /usr/bin/sed
checking whether NLS is requested... no
checking for msgfmt... /usr/bin/msgfmt
checking for gmsgfmt... /usr/bin/msgfmt
checking for xgettext... /usr/bin/xgettext
checking for msgmerge... /usr/bin/msgmerge
checking for ld used by arm-openwrt-linux-muslgnueabi-gcc... arm-openwrt-linux-muslgnueabi-ld
checking if the linker (arm-openwrt-linux-muslgnueabi-ld) is GNU ld... yes
checking for shared library run path origin... done
checking for CFPreferencesCopyAppValue... no
checking for CFLocaleCopyCurrent... no
checking whether to use NLS... no
checking whether building from git... no
checking for libintl.h... (cached) yes
checking for limits.h... (cached) yes
checking for pwd.h... yes
checking for termios.h... yes
checking for sys/param.h... (cached) yes
checking whether to enable UTF-8 support... no
checking whether C compiler accepts -Wall... yes
checking for NCURSES... no
checking for ncurses.h... no
checking for initscr in -lncurses... no
checking for curses.h... no
checking for initscr in -lcurses... no
configure: error:
  *** No curses lib was found.  Please install the curses header files
  *** from libncurses-dev (Debian), ncurses-devel (Fedora), or similar.
  *** (Or install ncurses from https://ftp.gnu.org/gnu/ncurses/.)
make: *** [Makefile:101: /build/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/nano-6.2/.configured_68b329da9893e34099c7d8ad5cb9c940] Error 1
make: Leaving directory '/build/openwrt/feeds/packages/utils/nano'

Run make menuconfig after editing your .config or the dependencies aren't updated in the build system. You just need to run it and then exit and save to update them

I already did a make defconfig. Isn't it the same as make menuconfig? This is the .config I am using:

CONFIG_TARGET_ipq806x=y
CONFIG_TARGET_ipq806x_generic=y
CONFIG_TARGET_ipq806x_generic_DEVICE_netgear_r7800=y
CONFIG_DEVEL=y
CONFIG_BUSYBOX_CUSTOM=y
CONFIG_BUILD_LOG=y
CONFIG_BUSYBOX_CONFIG_FEATURE_EDITING_SAVEHISTORY=y
CONFIG_BUSYBOX_CONFIG_FEATURE_EDITING_SAVE_ON_EXIT=y
CONFIG_BUSYBOX_CONFIG_FEATURE_LESS_FLAGS=y
CONFIG_BUSYBOX_CONFIG_FEATURE_LESS_REGEXP=y
CONFIG_BUSYBOX_CONFIG_FEATURE_LESS_WINCH=y
CONFIG_BUSYBOX_DEFAULT_STAT=y
# CONFIG_BUSYBOX_DEFAULT_FEATURE_STAT_FORMAT is not set
# CONFIG_BUSYBOX_DEFAULT_FEATURE_STAT_FILESYSTEM is not set
CONFIG_DEBUG=y
CONFIG_DROPBEAR_ECC=y
CONFIG_IMAGEOPT=y
CONFIG_INCLUDE_CONFIG=y
CONFIG_LIBCURL_COOKIES=y
CONFIG_LIBCURL_FILE=y
CONFIG_LIBCURL_FTP=y
CONFIG_LIBCURL_HTTP=y
CONFIG_LIBCURL_NGHTTP2=y
CONFIG_LIBCURL_NO_SMB="!"
CONFIG_LIBCURL_OPENSSL=y
CONFIG_LIBCURL_PROXY=y
# CONFIG_LUCI_JSMIN is not set
CONFIG_OPENSSL_ENGINE=y
CONFIG_OPENSSL_WITH_ASM=y
CONFIG_OPENSSL_WITH_CHACHA_POLY1305=y
CONFIG_OPENSSL_WITH_CMS=y
CONFIG_OPENSSL_WITH_DEPRECATED=y
CONFIG_OPENSSL_WITH_ERROR_MESSAGES=y
CONFIG_OPENSSL_WITH_PSK=y
CONFIG_OPENSSL_WITH_SRP=y
CONFIG_OPENSSL_WITH_TLS13=y
CONFIG_PACKAGE_NTFS-3G_HAS_PROBE=y
CONFIG_PACKAGE_adblock=y
CONFIG_PACKAGE_block-mount=y
CONFIG_PACKAGE_ccrypt=y
CONFIG_PACKAGE_cgi-io=y
CONFIG_PACKAGE_collectd=y
CONFIG_PACKAGE_coreutils=y
CONFIG_PACKAGE_coreutils-sort=y
CONFIG_PACKAGE_curl=y
CONFIG_PACKAGE_ddns-scripts=y
CONFIG_PACKAGE_ddns-scripts-services=y
CONFIG_PACKAGE_diffutils=y
CONFIG_PACKAGE_gdbserver=y
CONFIG_PACKAGE_hostapd-utils=y
CONFIG_PACKAGE_iptables-mod-ipopt=y
CONFIG_PACKAGE_iptables-nft=y
CONFIG_PACKAGE_kmod-crypto-arc4=y
CONFIG_PACKAGE_kmod-crypto-des=y
CONFIG_PACKAGE_kmod-crypto-ecb=y
CONFIG_PACKAGE_kmod-crypto-kpp=y
CONFIG_PACKAGE_kmod-crypto-lib-blake2s=y
CONFIG_PACKAGE_kmod-crypto-lib-chacha20=y
CONFIG_PACKAGE_kmod-crypto-lib-chacha20poly1305=y
CONFIG_PACKAGE_kmod-crypto-lib-curve25519=y
CONFIG_PACKAGE_kmod-crypto-lib-poly1305=y
CONFIG_PACKAGE_kmod-crypto-md4=y
CONFIG_PACKAGE_kmod-crypto-md5=y
CONFIG_PACKAGE_kmod-crypto-sha1=y
CONFIG_PACKAGE_kmod-crypto-sha512=y
CONFIG_PACKAGE_kmod-fs-cifs=y
CONFIG_PACKAGE_kmod-fuse=y
CONFIG_PACKAGE_kmod-gre=y
CONFIG_PACKAGE_kmod-ifb=y
CONFIG_PACKAGE_kmod-ip6tables=y
CONFIG_PACKAGE_kmod-ipt-core=y
CONFIG_PACKAGE_kmod-ipt-ipopt=y
CONFIG_PACKAGE_kmod-iptunnel=y
CONFIG_PACKAGE_kmod-iptunnel4=y
CONFIG_PACKAGE_kmod-lib-crc16=y
CONFIG_PACKAGE_kmod-mppe=y
CONFIG_PACKAGE_kmod-nf-conntrack-netlink=y
CONFIG_PACKAGE_kmod-nf-ipt=y
CONFIG_PACKAGE_kmod-nf-ipt6=y
CONFIG_PACKAGE_kmod-nft-compat=y
CONFIG_PACKAGE_kmod-pptp=y
CONFIG_PACKAGE_kmod-sched-cake=y
CONFIG_PACKAGE_kmod-sched-core=y
CONFIG_PACKAGE_kmod-scsi-core=y
CONFIG_PACKAGE_kmod-sit=y
CONFIG_PACKAGE_kmod-tun=y
CONFIG_PACKAGE_kmod-udptunnel4=y
CONFIG_PACKAGE_kmod-udptunnel6=y
CONFIG_PACKAGE_kmod-wireguard=y
CONFIG_PACKAGE_libcap-ng=y
CONFIG_PACKAGE_libcurl=y
CONFIG_PACKAGE_libiptext=y
CONFIG_PACKAGE_libiptext-nft=y
CONFIG_PACKAGE_libiptext6=y
CONFIG_PACKAGE_libiwinfo-lua=y
CONFIG_PACKAGE_libltdl=y
CONFIG_PACKAGE_liblua=y
CONFIG_PACKAGE_liblucihttp=y
CONFIG_PACKAGE_liblucihttp-lua=y
CONFIG_PACKAGE_libncurses=y
CONFIG_PACKAGE_libnghttp2=y
CONFIG_PACKAGE_libopenssl=y
CONFIG_PACKAGE_libopenssl-conf=y
CONFIG_PACKAGE_liboping=y
CONFIG_PACKAGE_libpcap=y
CONFIG_PACKAGE_libpcre=y
CONFIG_PACKAGE_librrd1=y
CONFIG_PACKAGE_librt=y
CONFIG_PACKAGE_libubus-lua=y
CONFIG_PACKAGE_libuci-lua=y
CONFIG_PACKAGE_libuuid=y
# CONFIG_PACKAGE_libwolfssl is not set
CONFIG_PACKAGE_libxtables=y
CONFIG_PACKAGE_lua=y
CONFIG_PACKAGE_miniupnpd-nftables=y
CONFIG_PACKAGE_mtr=y
CONFIG_PACKAGE_nlbwmon=y
CONFIG_PACKAGE_openssl-util=y
CONFIG_PACKAGE_patch=y
CONFIG_PACKAGE_ppp-mod-pptp=y
CONFIG_PACKAGE_resolveip=y
CONFIG_PACKAGE_rpcd=y
CONFIG_PACKAGE_rpcd-mod-file=y
CONFIG_PACKAGE_rpcd-mod-iwinfo=y
CONFIG_PACKAGE_rpcd-mod-luci=y
CONFIG_PACKAGE_rpcd-mod-rrdns=y
CONFIG_PACKAGE_rrdtool1=y
CONFIG_PACKAGE_sqm-scripts=y
CONFIG_PACKAGE_tc-mod-iptables=y
CONFIG_PACKAGE_tc-tiny=y
CONFIG_PACKAGE_tcpdump-mini=y
CONFIG_PACKAGE_terminfo=y
CONFIG_PACKAGE_tree=y
CONFIG_PACKAGE_uhttpd=y
CONFIG_PACKAGE_uhttpd-mod-ubus=y
CONFIG_PACKAGE_wget-ssl=y
CONFIG_PACKAGE_wireguard-tools=y
CONFIG_PACKAGE_zlib=y
CONFIG_PREINITOPT=y
CONFIG_TARGET_PREINIT_TIMEOUT=5
# CONFIG_WPA_WOLFSSL is not set
# CONFIG_LUCI_CSSTIDY is not set 
# CUSTOM PACKAGE SET
CONFIG_PACKAGE_mc=y
CONFIG_PACKAGE_nano-plus=y
CONFIG_PACKAGE_htop=y
CONFIG_PACKAGE_ncdu=y
CONFIG_PACKAGE_iperf3=y
CONFIG_PACKAGE_irqbalance=y
CONFIG_PACKAGE_auc=y
CONFIG_PACKAGE_ca-certificates=y
# CONFIG_PACKAGE_wpad-basic-wolfssl is not set
# CONFIG_PACKAGE_libustream-wolfssl is not set
# CONFIG_PACKAGE_px5g-wolfssl is not set
CONFIG_PACKAGE_wpad-openssl=y
CONFIG_PACKAGE_libustream-openssl=y
CONFIG_PACKAGE_luci=y
CONFIG_PACKAGE_luci-compat=y
CONFIG_PACKAGE_luci-mod-dashboard=y
CONFIG_PACKAGE_luci-app-attendedsysupgrade=y
CONFIG_PACKAGE_luci-app-vnstat2=y
CONFIG_PACKAGE_luci-app-nlbwmon=y
CONFIG_PACKAGE_luci-app-adblock=y
CONFIG_PACKAGE_luci-app-banip=y
CONFIG_PACKAGE_luci-app-bcp38=y
CONFIG_PACKAGE_luci-app-commands=y
CONFIG_PACKAGE_luci-app-ddns=y
CONFIG_PACKAGE_ddns-scripts-noip=y
CONFIG_PACKAGE_luci-app-openvpn=y
# CONFIG_PACKAGE_luci-ssl-openssl is not set
CONFIG_PACKAGE_luci-app-sqm=y
CONFIG_PACKAGE_luci-app-wireguard=y
CONFIG_PACKAGE_luci-app-upnp=y
CONFIG_PACKAGE_luci-app-uhttpd=y
CONFIG_PACKAGE_luci-app-statistics=y
CONFIG_PACKAGE_collectd-mod-conntrack=y
CONFIG_PACKAGE_collectd-mod-cpu=y
CONFIG_PACKAGE_collectd-mod-cpufreq=y
CONFIG_PACKAGE_collectd-mod-dhcpleases=y
CONFIG_PACKAGE_collectd-mod-entropy=y
CONFIG_PACKAGE_collectd-mod-exec=y
CONFIG_PACKAGE_collectd-mod-interface=y
CONFIG_PACKAGE_collectd-mod-iwinfo=y
CONFIG_PACKAGE_collectd-mod-load=y
CONFIG_PACKAGE_collectd-mod-memory=y
CONFIG_PACKAGE_collectd-mod-network=y
CONFIG_PACKAGE_collectd-mod-ping=y
CONFIG_PACKAGE_collectd-mod-rrdtool=y
CONFIG_PACKAGE_collectd-mod-sqm=y
CONFIG_PACKAGE_collectd-mod-thermal=y
CONFIG_PACKAGE_collectd-mod-uptime=y
CONFIG_PACKAGE_collectd-mod-wireless=y
CONFIG_PACKAGE_blockd=y
CONFIG_PACKAGE_cryptsetup=y
CONFIG_PACKAGE_e2fsprogs=y
CONFIG_PACKAGE_f2fs-tools=y
CONFIG_PACKAGE_kmod-fs-exfat=y
CONFIG_PACKAGE_kmod-fs-ext4=y
CONFIG_PACKAGE_kmod-fs-f2fs=y
CONFIG_PACKAGE_kmod-fs-hfs=y
CONFIG_PACKAGE_kmod-fs-hfsplus=y
CONFIG_PACKAGE_kmod-fs-msdos=y
CONFIG_PACKAGE_kmod-fs-nfs=y
CONFIG_PACKAGE_kmod-fs-nfs-common=y
CONFIG_PACKAGE_kmod-fs-nfs-v3=y
CONFIG_PACKAGE_kmod-fs-nfs-v4=y
CONFIG_PACKAGE_kmod-fs-vfat=y
CONFIG_PACKAGE_kmod-nls-base=y
CONFIG_PACKAGE_kmod-nls-cp1250=y
CONFIG_PACKAGE_kmod-nls-cp437=y
CONFIG_PACKAGE_kmod-nls-cp850=y
CONFIG_PACKAGE_kmod-nls-iso8859-1=y
CONFIG_PACKAGE_kmod-nls-iso8859-15=y
CONFIG_PACKAGE_kmod-nls-utf8=y
CONFIG_PACKAGE_kmod-usb-storage=y
CONFIG_PACKAGE_kmod-usb-storage-uas=y
CONFIG_PACKAGE_libblkid=y
CONFIG_PACKAGE_ntfs-3g=y
CONFIG_PACKAGE_nfs-utils=y
CONFIG_PACKAGE_ip6tables-mod-nat=y
CONFIG_PACKAGE_6in4=y
CONFIG_PACKAGE_6rd=y
CONFIG_PACKAGE_6to4=y
CONFIG_PACKAGE_ip6tables-nft=y
CONFIG_PACKAGE_luci-lib-ipkg=y
CONFIG_PACKAGE_luci-app-ttyd=y

Well, the make defconfig command doesn't set ipq806x as the target tree, so you've edited it. If you don't have nano selected in .config none of the Host/ will be fired (because it doesn't know it needs to be) and won't be in staging_dir/target_xxx and unavailable at compile, which means calling it from make package/feeds/packages/nano/compile will fail because it doesn't know about terminfo and libncurses/ncurses etc.

Edit: Even if it worked, not having it in .config will return an error about Nothing to be done for compile because the build system doesn't know it needs to build it

But nano-plus is actually in the .config. I think the problem was related to compiling ncurses. I did this:

TOPDIR=$PWD make -C package/libs/ncurses

and then

TOPDIR=$PWD make -C package/feeds/packages/nano

And it worked!

For some reason make package/libs/ncurses/{clean,compile,install} doesn't do everything as TOPDIR=$PWD make -C package/libs/ncurses does.

it is crazy, as most packages don't require this form of compile and install packages.

Yes, but did you run make menuconfig AFTER setting the nano package in your .config so it sets the deps

grommish@DESKTOP-AW:~/openwrt$ cat package/libs/ncurses/Makefile
#
# Copyright (C) 2006-2015 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=ncurses
PKG_VERSION:=6.2
PKG_RELEASE:=3

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@GNU/$(PKG_NAME)
PKG_HASH:=30306e0c76e0f9f1f0de987cf1c82a5c21e1ce6568b9227f7da5b71cbea86c9d

PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=README

PKG_INSTALL:=1
PKG_BUILD_PARALLEL:=1

PKG_BUILD_DEPENDS:=ncurses/host

include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/host-build.mk

define Package/terminfo
  SECTION:=libs
  CATEGORY:=Libraries
  TITLE:=Terminal Info Database (ncurses)
  URL:=http://www.gnu.org/software/ncurses/
endef

define Package/libncurses
  SECTION:=libs
  CATEGORY:=Libraries
  TITLE:=Terminal handling library (Unicode)
  URL:=http://www.gnu.org/software/ncurses/
  PROVIDES:=libncursesw
  DEPENDS:= +terminfo
  ABI_VERSION:=6
endef

define Package/libncurses-dev
  SECTION:=devel
  CATEGORY:=Development
  SUBMENU:=Libraries
  DEPENDS:=zlib
  TITLE:=Development files for the ncurses library
endef

TARGET_CFLAGS += $(FPIC)

CONFIGURE_ARGS += \
        --enable-echo \
        --enable-const \
        --enable-overwrite \
        --enable-pc-files \
        --disable-rpath \
        --without-ada \
        --without-debug \
        --without-manpages \
        --without-profile \
        --without-progs \
        --without-tests \
        --disable-big-core \
        --disable-home-terminfo \
        --with-normal \
        --with-shared \
        --with-terminfo-dirs=/usr/share/terminfo \
        --with-default-terminfo-dir=/usr/share/terminfo \
        --with-pkg-config-libdir=/usr/lib/pkgconfig \
        --enable-widec \
        --with-build-cppflags=-D_GNU_SOURCE

CONFIGURE_VARS += \
        cf_try_fPIC=no

HOST_CFLAGS += $(HOST_FPIC)

HOST_CONFIGURE_ARGS += \
        --without-cxx \
        --without-cxx-binding \
        --without-ada \
        --without-debug \
        --without-manpages \
        --without-profile \
        --without-tests \
        --without-curses-h


ifeq ($(HOST_OS),FreeBSD)
        CONFIGURE_ARGS +=
                --with-terminfo=/usr/share/terminfo.db
endif

MAKE_FLAGS += \
        BUILD_CC="$(HOSTCC)" \
        HOSTCC="$(HOSTCC)" \
        HOSTCCFLAGS="" \
        PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig \
        libs

define Build/Install/Default
        $(MAKE_VARS) \
        $(MAKE) -C $(PKG_BUILD_DIR)/$(MAKE_PATH) \
                $(MAKE_INSTALL_FLAGS) \
                $(1) install.libs install.data;
endef

define Package/terminfo/install
        echo ""
ifneq ($(HOST_OS),FreeBSD)
        $(INSTALL_DIR) $(1)/usr/share/terminfo
        (cd $(PKG_INSTALL_DIR)/usr/share/terminfo; \
                for dir in ??; do \
                        [ -d "$$$$dir" ] || continue; \
                        mv $$$$dir $$$$(echo -ne "\x$$$$dir"); \
                done \
        )
        for file in \
                a/ansi \
                d/dumb \
                l/linux \
                r/rxvt \
                r/rxvt-unicode \
                s/screen \
                s/screen-256color \
                t/tmux \
                t/tmux-256color \
                v/vt100 \
                v/vt102 \
                x/xterm \
                x/xterm-color \
                x/xterm-256color; do \
                $(INSTALL_DIR) $(1)/usr/share/terminfo/`dirname $$$$file`; \
                $(CP) $(PKG_INSTALL_DIR)/usr/share/terminfo/$$$$file \
                        $(1)/usr/share/terminfo/$$$$file; \
        done
endif
endef

define Package/libncurses/install
        $(INSTALL_DIR) $(1)/usr/lib
        for lib in ncurses panel menu form; do \
                $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib$$$${lib}w.so.* $(1)/usr/lib/; \
                for so in $(1)/usr/lib/lib$$$${lib}w.so.*; do \
                        ln -s $$$${so##*/} $$$${so%w.so*}.so$$$${so##*w.so}; \
                done; \
        done
endef

define Package/libncurses-dev/install
        $(INSTALL_DIR) $(1)/usr/bin
        $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
        $(INSTALL_DIR) $(1)/usr/include
        $(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/
        $(INSTALL_DIR) $(1)/usr/lib
        $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.a $(1)/usr/lib/
        $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
        $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc $(1)/usr/lib/pkgconfig/
endef

define Build/InstallDev
        $(CP) $(PKG_INSTALL_DIR)/* $(1)
        for lib in ncurses panel menu form; do \
                for so in $(1)/usr/lib/lib$$$${lib}w.so*; do \
                        ln -s $$$${so##*/} $$$${so%w.so*}.so$$$${so##*w.so}; \
                done; \
        done
        ln -s . $(1)/usr/include/ncursesw
        $(TARGET_CROSS)ar rc $(1)/usr/lib/libtinfo.a
        $(INSTALL_DIR) $(2)/bin
        $(CP) $(PKG_INSTALL_DIR)/usr/bin/ncursesw6-config $(2)/bin/
        $(SED) 's,^\(prefix\|exec_prefix\)=.*,\1=$(STAGING_DIR)/usr,g' -e 's/$$$$INCS //g' \
                $(2)/bin/ncursesw6-config
        ln -sf $(STAGING_DIR)/host/bin/ncursesw6-config $(1)/usr/bin/ncursesw6-config
endef

define Host/Compile
        $(MAKE) -C $(HOST_BUILD_DIR) libs
        $(MAKE) -C $(HOST_BUILD_DIR)/progs tic
endef

$(eval $(call HostBuild))
$(eval $(call BuildPackage,terminfo))
$(eval $(call BuildPackage,libncurses))
$(eval $(call BuildPackage,libncurses-dev))

Including things like the Host/ calls for ncurses (and zlib) as ncurses calls PKG_BUILD_DEPENDS:=ncurses/host

You need to run make menuconfig, then exit out and save changes.. you can copy your .config first, if you'd like, but after you exit menuconfig, it'll update all the dependencies in set things as they should be.

define Package/nano/Default
  SUBMENU:=Editors
  SECTION:=utils
  CATEGORY:=Utilities
  URL:=https://www.nano-editor.org/
  DEPENDS:=+libncurses
endef

Calls libncurses, which calls, ncurses/host which places the requires libs in the staging_dir and in the image. You need to manually set EVERY Dep, all the way down, if you want to do it by hand.

Edit: Alternatively, you can call make package/libs/ncurses/host/compile to force the Host/ stuff, but then you'll run into other issues later with missing deps

Thanks for the explanation. I didn't know that make defconfig wasn't taking care of setting all those deps.

My objective was to get a nano package with, basically, most configure build switches enabled. That is why I was applying the patch to its Makefile. Then I wanted to create a package using the previous full build.

The problem I have now is that I tweaked the settings for nano-plus, and I am now getting a nano-plus package, but with the default configuration (the small one). Probably I have to ser something when calling that TOPDIR=$PWD make -C package/feeds/packages/nano isn,t it?