No rule to make target error

CONFIG_PACKAGE_nano is different than CONFIG_PACKAGE_nano-plus in .config

Make sure you're calling the right one.. (or, go into menuconfig, Utilities, Editors and select it)

You can use / in menuconfig to search for package or string.

1 Like

Well, the package/feeds/package/nano/Makefile actually builds nano and nano-plus packages. I just had to set the right switch. I got it by rerunning the build with this command:

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

And I finally have a better editor than micro in CLI. Sorry, I am not a vi or emacs guy and I love the syntax highlighting of nano with modern keybinds. I use this ~/.nanorc:

set atblanks            # don't cut words when doing line wrap
set nohelp              # don't display help messages
set softwrap            # don't break lines
set suspend             # don't suspend the shell
set tabsize 4           # tab stops every 4 spaces
set tabstospaces        # convert tabs to spaces
set constantshow        # show constants
set linenumbers         # show line numbers Alt+N to toggle
set casesensitive       # case sensitive
set zap                 # zap to the end of the line
set autoindent          # auto indent
set indicator           # show the cursor position
set minibar             # show the minibar
set nonewlines          # don't insert newlines
#set backup             # don't make backups
#set backupdir "/tmp"   # where to put the backups

bind ^X cut main        # CTRL+X - Cut
bind ^C copy main       # CTRC+C - Copy
bind ^V paste all       # CTRL+V - Past
bind ^Q exit all        # CTRL+Q - Quit program
bind ^S savefile main   # CTRL+S - Save
bind ^Z undo all        # CTRL+Z - Undo
bind ^Y redo all        # CTRL+Y - Redo
bind ^H replace main    # CTRL+H - Replace
bind ^F whereis main    # CTRL+F - Find
bind F3 findnext main   # F3     - Find next
#bind ^/ comment main    # CTRL+/ - Comment

include /usr/share/nano/*
1 Like

Most of these problems happen because of calling make with "-C".
Please use make package/<packagefolder>/compile instead, that will ensure all dependencies are (re-)build when needed.

Well, downolading everything again to have a clean build source, I am now getting a different error when building make world, without any -C around.

I am using the same .config and this patch to feeds/packages/utils/nano/Makefile:

diff --git a/utils/nano/Makefile b/utils/nano/Makefile
index 156af90da..b9a4fdff8 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 += \
@@ -96,8 +86,11 @@ CONFIGURE_VARS += \
    ac_cv_header_regex_h=no \
 
 define Package/nano/install
-   $(INSTALL_DIR) $(1)/usr/bin
-   $(CP) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME) $(1)/usr/bin/
+    [ $(BUILD_VARIANT) = plus ] && \
+    $(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME) && \
+    $(CP) $(PKG_INSTALL_DIR)/usr/share/$(PKG_NAME)/* $(1)/usr/share/$(PKG_NAME); \
+    $(INSTALL_DIR) $(1)/usr/bin; \
+    $(CP) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME) $(1)/usr/bin
 endef
 
 define Package/nano-plus/install

The error dump is: related to the missing library libz.so.1:

make[3]: Leaving directory '/build/myopenwrt/openwrt/feeds/packages/net/mtr'
time: package/feeds/packages/mtr/compile#0.27#0.02#0.28
make[3]: Entering directory '/build/myopenwrt/openwrt/feeds/packages/utils/nano'
mkdir -p /build/myopenwrt/openwrt/bin/targets/ipq806x/generic/packages /build/myopenwrt/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/nano-plus/nano-6.2/ipkg-arm_cortex-a15_neon-vfpv4/nano-plus/CONTROL /build/myopenwrt/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/pkginfo
[ plus = plus ] && install -d -m0755 /build/myopenwrt/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/nano-plus/nano-6.2/ipkg-arm_cortex-a15_neon-vfpv4/nano-plus/usr/share/nano && cp -fpR /build/myopenwrt/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/nano-plus/nano-6.2/ipkg-install/usr/share/nano/* /build/myopenwrt/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/nano-plus/nano-6.2/ipkg-arm_cortex-a15_neon-vfpv4/nano-plus/usr/share/nano; install -d -m0755 /build/myopenwrt/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/nano-plus/nano-6.2/ipkg-arm_cortex-a15_neon-vfpv4/nano-plus/usr/bin; cp -fpR /build/myopenwrt/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/nano-plus/nano-6.2/ipkg-install/usr/bin/nano /build/myopenwrt/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/nano-plus/nano-6.2/ipkg-arm_cortex-a15_neon-vfpv4/nano-plus/usr/bin
find /build/myopenwrt/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/nano-plus/nano-6.2/ipkg-arm_cortex-a15_neon-vfpv4/nano-plus -name 'CVS' -o -name '.svn' -o -name '.#*' -o -name '*~'| xargs -r rm -rf
Package nano-plus is missing dependencies for the following libraries:
libz.so.1

make[3]: *** [Makefile:109: /build/myopenwrt/openwrt/bin/packages/arm_cortex-a15_neon-vfpv4/packages/nano-plus_6.2-1_arm_cortex-a15_neon-vfpv4.ipk] Error 1
make[3]: Leaving directory '/build/myopenwrt/openwrt/feeds/packages/utils/nano'
time: package/feeds/packages/nano/plus/compile#0.41#0.09#0.49
    ERROR: package/feeds/packages/nano failed to build (build variant: plus).
make[2]: *** [package/Makefile:116: package/feeds/packages/nano/compile] Error 1
make[2]: Leaving directory '/build/myopenwrt/openwrt'
make[1]: *** [package/Makefile:110: /build/myopenwrt/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/stamp/.package_compile] Error 2
make[1]: Leaving directory '/build/myopenwrt/openwrt'
make: *** [/build/myopenwrt/openwrt/include/toplevel.mk:230: world] Error 2

But the nano executable has been successfully compiled and all the files of the package are in the right output folder /build/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/nano-plus/nano-6.2/ipkg-arm_cortex-a15_neon-vfpv4/nano-plus. So for some reason it stopped before creating the package. I don't have experience with the Makefile process of Openwrt. So, I need help.

The missing library is actually in the Openwrt tree. A find . -name libz.so.1 in the top dir returns:

./build_dir/host/zlib-1.2.11/libz.so.1
./build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/zlib-1.2.11/libz.so.1
./build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/zlib-1.2.11/.pkgdir/zlib/usr/lib/libz.so.1
./build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/zlib-1.2.11/ipkg-install/usr/lib/libz.so.1
./build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/zlib-1.2.11/ipkg-arm_cortex-a15_neon-vfpv4/zlib/usr/lib/libz.so.1
./staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/usr/lib/libz.so.1
./staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/root-ipq806x/usr/lib/libz.so.1

What is going on? Any clue on how to fix this?

It takes care of them.
Defconfig is enough. No need for make config in addition.
After that if would have been enough to do make package/nano/compile
No need for the exact package path, and similarly the -C likely messes you up.

It actually builds all variants that you have been enabled in config from the "package name" file. (The Makefile declares the package file name first.) E.g. ipconfig packages file contains iptables-legacy, iptables-nft etc., But the build command references it still just with ipconfig)

Likely something has changed with zlib definition, and now nano detects it during build. And you are given warning, as the dependency should be declared (or the library detection patched away in nano build config script.)

Might be global error if something has changed with zlib

Edit:
Well, buildbot builds nano just ok, so it is something about your building and patches.

You are enabling lots of functionality and possibly libraries are needed, so you need to also declare dependencies for all those libraries that you now need.

I did it. there is only one new library, zlib.
The final patch that enables all the features, increasing the size of the package to 156 KB is:

diff --git a/utils/nano/Makefile b/utils/nano/Makefile
index 156af90da..f74d20fa1 100644
--- a/utils/nano/Makefile
+++ b/utils/nano/Makefile
@@ -44,6 +44,7 @@ define Package/nano-plus
   $(call Package/nano/Default)
   TITLE:=GNU nano text editor (more features, Unicode)
   VARIANT:=plus
+  DEPENDS:=+libncurses +zlib
 endef
 
 define Package/nano/description
@@ -72,17 +73,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 += \
@@ -96,8 +87,11 @@ CONFIGURE_VARS += \
   ac_cv_header_regex_h=no \
 
 define Package/nano/install
-  $(INSTALL_DIR) $(1)/usr/bin
-  $(CP) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME) $(1)/usr/bin/
+    [ $(BUILD_VARIANT) = plus ] && \
+    $(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME) && \
+    $(CP) $(PKG_INSTALL_DIR)/usr/share/$(PKG_NAME)/* $(1)/usr/share/$(PKG_NAME); \
+    $(INSTALL_DIR) $(1)/usr/bin; \
+    $(CP) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME) $(1)/usr/bin
 endef
 
 define Package/nano-plus/install

And it looks glorious both through ssh and in the lucy tty app!

Those extra 49 KB provides syntax highlight, mouse, etc. There should be a nano plusplus package with all the features. It is still pretty small.

Have you noticed this...

Thanks for letting me know. My patch above in this thread was a proof of concept. maybe the best solution is to generate a new variant. I will try to get it done as soon as I had some time. The problem is that the nano-full package you mention is that it should be called nano-color as there are still some interesting features disabled in that release that I have enabled in mine. Maybe that should be called nano-color and my release should be called nano-full as there are no disabled features, an actual full distribution.

@hnyman, my proposal for a nano-full package would be having an actual full package. This would be the nano Makefile:

#
# Copyright (C) 2007-2016 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:=nano
PKG_VERSION:=6.2
PKG_RELEASE:=$(AUTORELEASE)

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@GNU/nano
PKG_HASH:=2bca1804bead6aaf4ad791f756e4749bb55ed860eec105a97fba864bc6a77cb3

PKG_LICENSE:=GPL-3.0-or-later
PKG_LICENSE_FILES:=COPYING
PKG_MAINTAINER:=Hannu Nyman <hannu.nyman@iki.fi>
PKG_CPE_ID:=cpe:/a:gnu:nano

PKG_INSTALL:=1
PKG_BUILD_PARALLEL:=1

include $(INCLUDE_DIR)/package.mk

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

define Package/nano
  $(call Package/nano/Default)
  TITLE:=GNU nano text editor (minimal features)
  VARIANT:=tiny
  DEFAULT_VARIANT:=1
endef

define Package/nano-plus
  $(call Package/nano/Default)
  TITLE:=GNU nano text editor (more features, Unicode)
  VARIANT:=plus
endef

define Package/nano-full
  $(call Package/nano/Default)
  TITLE:=GNU nano text editor (all features, Unicode)
  VARIANT:=full
  DEPENDS:=+libncurses +zlib
endef

define Package/nano/description
  Nano is a small and simple text editor for use on the terminal.

  Nano started as an enhanced clone of the Pico text editor.
  Nowadays Nano wants to be a generally useful editor with sensible
  defaults (linewise scrolling, no automatic line breaking).

  Nano is an official GNU package.
endef

define Package/nano-plus/description
  nano-plus - Additional features enabled, larger size than default nano.
  (multibuffer, Unicode/UTF-8, help, justify, nanorc)

  $(call Package/nano/description)
endef

define Package/nano-full/description
  nano-full - all features enabled, including syntax highlighting,
  multibuffer, Unicode/UTF-8, help, justify, nanorc, some key bindings)

  $(call Package/nano/description)
endef

ifeq ($(BUILD_VARIANT),full)
# full variant with all features included
  CONFIGURE_ARGS += \
	--enable-all \
	--enable-utf8
else ifeq ($(BUILD_VARIANT),plus)
# plus variant with more features included
  CONFIGURE_ARGS += \
	--enable-help \
	--enable-justify \
	--enable-linenumbers \
	--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
else
# default tiny variant
  CONFIGURE_ARGS += \
	--enable-tiny \
	--enable-linenumbers \
	--disable-color \
	--disable-utf8
endif

CONFIGURE_VARS += \
	ac_cv_header_regex_h=no \

define Package/nano/install
	$(INSTALL_DIR) $(1)/usr/bin
	$(CP) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME) $(1)/usr/bin/
endef

define Package/nano-plus/install
	$(call Package/nano/install,$1)
endef

define Package/nano-full/install
	$(call Package/nano/install,$1)
	$(INSTALL_DIR) $(1)/etc $(1)/usr/share/nano
	$(INSTALL_CONF) ./files/nanorc $(1)/etc/nanorc
	$(CP) $(PKG_INSTALL_DIR)/usr/share/nano/* $(1)/usr/share/nano
endef

$(eval $(call BuildPackage,nano))
$(eval $(call BuildPackage,nano-plus))
$(eval $(call BuildPackage,nano-full))

and inside a files folder inside the nano package folder a nanorc file with this content:

## Settings ##
set multibuffer         # Open multiple files
set indicator           # show vertical scroll bar
set minibar             # show the info bar
set linenumbers         # show line numbers Alt+N to toggle
set mouse               # enable mouse support Alt+M to toggle
set autoindent          # auto indent
set nonewlines          # don't insert newline at the end of the file
set softwrap            # wrap lines
set atblanks            # wrap lines at word boundaries
unset casesensitive     # non case sensitive search
set nohelp              # don't display help footer (F1) to display help
set suspend             # Allow nano to be suspended
set tabsize 4           # tab stops every 4 spaces
set tabstospaces        # don't convert tabs to spaces
set constantshow        # show cursor position and its unicode
set zap                 # Allows you to highlight text (CTRL+SHIFT+ARROW) and delete it with backspace.
set positionlog         # Remembers position between sessions
#set backup             # make backups
set backupdir "/tmp/nano~"   # where to put the backups
#set speller "aspell -x -c"  # Sets what spelling utility to use.

## Keybindings ##
bind ^X cut main        # CTRL+X - Cut
bind ^C copy main       # CTRC+C - Copy
bind ^V paste all       # CTRL+V - Paste from GUI
bind ^B paste all       # CTRL+B - Paste fron nano
bind ^Q exit all        # CTRL+Q - Quit program
bind ^O insert all      # CTRL+O - Open new file
bind ^S savefile main   # CTRL+S - Save
bind ^Z undo all        # CTRL+Z - Undo
bind ^Y redo all        # CTRL+Y - Redo
bind ^H replace main    # CTRL+H - Replace
bind ^F whereis main    # CTRL+F - Find
bind F3 findnext main   # F3     - Find next
bind F5 refresh all     # F5     - refresh screen
bind ^/ comment main    # CTRL+/ - Comment lines

## Syntax highlighting ##
include /usr/share/nano/*.nanorc
include /usr/share/nano/extra/*.nanorc

This would create a third variant of the nano package.

I have created a new thread to summarize all the discussions about nano. This was going offtopic.