Error during patch compilation of OpenWrt [solved]

I am trying to build patch for the archer c6 router as given in the hello world documentation (https://openwrt.org/docs/guide-developer/helloworld/chapter6) but I'm getting error during compilation

include $(TOPDIR)/rules.mk

# Name, version and release number
# The name and version of your package are used to define the variable to point to the build directory of your package: $(PKG_BUILD_DIR)
PKG_NAME:=helloworld
PKG_VERSION:=1.0
PKG_RELEASE:=1

# Source settings (i.e. where to find the source codes)
# This is a custom variable, used below
SOURCE_DIR:=/home/saka/Music/helloworld

include $(INCLUDE_DIR)/package.mk

# Package definition; instructs on how and where our package will appear in the overall configuration menu ('make menuconfig')
define Package/helloworld
  SECTION:=examples
  CATEGORY:=Examples
  TITLE:=Hello, World!
endef

# Package description; a more verbose description on what our package does
define Package/helloworld/description
  A simple "Hello, world!" -application.
endef

# Package preparation instructions; create the build directory and copy the source code. 
# The last command is necessary to ensure our preparation instructions remain compatible with the patching system.
define Build/Compile
	$(MAKE) -C $(PKG_BUILD_DIR) \
               CC="$(TARGET_CC)" \
           CFLAGS="$(TARGET_CFLAGS)" \
          LDFLAGS="$(TARGET_LDFLAGS)"
endef

# Package build instructions; invoke the target-specific compiler to first compile the source file, and then to link the file into the final executable
define Build/Compile
	$(TARGET_CC) $(TARGET_CFLAGS) -o $(PKG_BUILD_DIR)/helloworld.o -c $(PKG_BUILD_DIR)/helloworld.c
	$(TARGET_CC) $(TARGET_LDFLAGS) -o $(PKG_BUILD_DIR)/$1 $(PKG_BUILD_DIR)/helloworld.o
endef

# Package install instructions; create a directory inside the package to hold our executable, and then copy the executable we built previously into the folder
define Package/helloworld/install
	$(INSTALL_DIR) $(1)/usr/bin
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/helloworld $(1)/usr/bin
endef

# This command is always the last, it uses the definitions and variables we give above in order to get the job done
$(eval $(call BuildPackage,helloworld))

my makefile is given above and I face few error on compilation..

saka@saka-VirtualBox:~/Music/source$ make package/helloworld/{clean,compile} -j1 V=s
WARNING: Makefile 'package/utils/busybox/Makefile' has a dependency on 'libpam', which does not exist
WARNING: Makefile 'package/utils/busybox/Makefile' has a build dependency on 'libpam', which does not exist
WARNING: Makefile 'package/network/utils/curl/Makefile' has a dependency on 'libgnutls', which does not exist
WARNING: Makefile 'package/network/utils/curl/Makefile' has a dependency on 'libopenldap', which does not exist
WARNING: Makefile 'package/network/utils/curl/Makefile' has a dependency on 'libidn2', which does not exist
WARNING: Makefile 'package/network/utils/curl/Makefile' has a dependency on 'libssh2', which does not exist
WARNING: Makefile 'package/boot/kexec-tools/Makefile' has a dependency on 'liblzma', which does not exist
WARNING: Makefile 'package/network/services/lldpd/Makefile' has a dependency on 'libnetsnmp', which does not exist
make[1]: Entering directory '/home/saka/Music/source'
make[2]: Entering directory '/home/saka/Music/mypackages/examples/helloworld'
rm -rf /home/saka/Music/source/build_dir/target-mips_24kc_musl/helloworld-1.0
rm -f /home/saka/Music/source/staging_dir/target-mips_24kc_musl/stamp/.helloworld_installed
rm -f /home/saka/Music/source/staging_dir/target-mips_24kc_musl/packages/helloworld.list /home/saka/Music/source/staging_dir/host/packages/helloworld.list
make[2]: Leaving directory '/home/saka/Music/mypackages/examples/helloworld'
time: package/feeds/mypackages/helloworld/clean#0.09#0.02#0.24
make[1]: Leaving directory '/home/saka/Music/source'
WARNING: Makefile 'package/utils/busybox/Makefile' has a dependency on 'libpam', which does not exist
WARNING: Makefile 'package/utils/busybox/Makefile' has a build dependency on 'libpam', which does not exist
WARNING: Makefile 'package/network/utils/curl/Makefile' has a dependency on 'libgnutls', which does not exist
WARNING: Makefile 'package/network/utils/curl/Makefile' has a dependency on 'libopenldap', which does not exist
WARNING: Makefile 'package/network/utils/curl/Makefile' has a dependency on 'libidn2', which does not exist
WARNING: Makefile 'package/network/utils/curl/Makefile' has a dependency on 'libssh2', which does not exist
WARNING: Makefile 'package/boot/kexec-tools/Makefile' has a dependency on 'liblzma', which does not exist
WARNING: Makefile 'package/network/services/lldpd/Makefile' has a dependency on 'libnetsnmp', which does not exist
make[1]: Entering directory '/home/saka/Music/source'
make[2]: Entering directory '/home/saka/Music/source/package/libs/toolchain'
rm -rf /home/saka/Music/source/build_dir/target-mips_24kc_musl/toolchain/.pkgdir/libc.installed /home/saka/Music/source/build_dir/target-mips_24kc_musl/toolchain/.pkgdir/libc
mkdir -p /home/saka/Music/source/build_dir/target-mips_24kc_musl/toolchain/.pkgdir/libc
install -d -m0755 /home/saka/Music/source/build_dir/target-mips_24kc_musl/toolchain/.pkgdir/libc/lib /home/saka/Music/source/build_dir/target-mips_24kc_musl/toolchain/.pkgdir/libc/usr/bin
cp -fpR /home/saka/Music/source/staging_dir/toolchain-mips_24kc_gcc-7.3.0_musl/lib/ld-musl-*.so* /home/saka/Music/source/build_dir/target-mips_24kc_musl/toolchain/.pkgdir/libc/lib/
cp: cannot stat '/home/saka/Music/source/staging_dir/toolchain-mips_24kc_gcc-7.3.0_musl/lib/ld-musl-*.so*': No such file or directory
Makefile:618: recipe for target '/home/saka/Music/source/build_dir/target-mips_24kc_musl/toolchain/.pkgdir/libc.installed' failed
make[2]: *** [/home/saka/Music/source/build_dir/target-mips_24kc_musl/toolchain/.pkgdir/libc.installed] Error 1
make[2]: Leaving directory '/home/saka/Music/source/package/libs/toolchain'
time: package/libs/toolchain/compile#0.11#0.01#0.24
package/Makefile:107: recipe for target 'package/libs/toolchain/compile' failed
make[1]: *** [package/libs/toolchain/compile] Error 2
make[1]: Leaving directory '/home/saka/Music/source'
/home/saka/Music/source/include/toplevel.mk:216: recipe for target 'package/helloworld/compile' failed
make: *** [package/helloworld/compile] Error 2

Can someone help me to figure this out...

If you haven't done so, you might want to ensure that you've built all that is needed for your device. Perhaps the easiest is to select your device using make menuconfig and then make -jN clean download world

1 Like

@jeff Thanks a lot that solved the problem

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.