Hello! I try to build helloworld programm for openwrt, router Tp-link wr740n, firmware openwrt ar71xx v4.
I build package, load it on router via ftp and install. When i try to run programm, i get error:
root@OpenWrt:/bin# helloworld
-ash: helloworld: not found
Makefile:
include $(TOPDIR)/rules.mk
PKG_NAME:=helloworld
PKG_RELEASE:=1
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
define Package/helloworld
SECTION:=utils
CATEGORY:=Utilities
TITLE:=Helloworld -- prints a snarky message
endef
define Package/helloworld/description
helloworld packadetest
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
$(CP) ./src/* $(PKG_BUILD_DIR)/
endef
define Package/helloworld/install
$(INSTALL_DIR) $(1)/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/helloworld $(1)/bin/
endef
$(eval $(call BuildPackage,helloworld))
makefile in src folder:
helloworld: helloworld.o
$(CC) $(LDFLAGS) helloworld.o -o helloworld
helloworld.o: helloworld.c
$(CC) $(CFLAGS) -c helloworld.c
clean:
rm *.o helloworld
source:
#include <stdio.h>
int main(void)
{
printf("hello world!\n");
return 0;
}
make was succesfully, *.ipk generated in /bin/package/base. but installation returned errors:
root@OpenWrt:~# opkg install helloworld_1_ar71xx.ipk
Installing helloworld (1) to root...
Configuring helloworld.
//usr/lib/opkg/info/helloworld.postinst: line 4: default_postinst: not found
Collected errors:
* pkg_run_script: package "helloworld" postinst script returned status 127.
* opkg_configure: helloworld.postinst returned 127.
Despite this, binary was placed in /bin folder, but i can't execute it.
What could be the problem?