OpenWrt Forum Archive

Topic: compile a single package for backfire

The content of this topic has been archived on 4 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi!

I want to compile only an simple package for backfire without compile everything from scratch. I downloaded backfire source. First I tried this SDK compiling tutorial. But I get the error below. I thought, that the include directory is missing, because I dont installed SDK yet. So I went to make menuconfig, check "build SDK" but now it started to build the whole system. How can I compile an lonely nano for backfire, not wasting my time to compile everything?

$make package/ncurses/compile V=99
and the error: checking for C compiler default output... configure: error: C compiler cannot create executables

(Last edited by kukodajanos on 28 Mar 2011, 16:36)

I was meaning to do the same, but as you found out already there's no SDK for backfire. Still to build even just one package, you need the toolchain and I don't know whether you can actually build that alone... I tried a few times then gave up cos it would take far less time to build everything and call it a day.

If by any chance you happen to have a WR1043ND and 64-bit Linux, I have the SDK and can upload it somewhere for you to try.

Did you select your target and build the cross-compiler first?  You don't need to build the SDK.  Try:

make menuconfig
make toolchain/install V=99
make package/ncurses/compile V=99

Hey!

Thank you your advise, I tried the "make toolchain/install V=99", but I get an error. What do you think, what is the problem? I set up in menuconfig the system target and profile.

cp -fpR /home/kukodajanos/backfire/staging_dir/toolchain-mipsel_gcc-4.3.3+cs_uClibc-0.9.30.1/usr/bin/mipsel-openwrt-linux-uclibc-readelf /home/kukodajanos/backfire/staging_dir/host/bin/readelf
cp: cannot create regular file `/home/kukodajanos/backfire/staging_dir/host/bin/readelf': No such file or directory
make[2]: *** [/home/kukodajanos/backfire/staging_dir/toolchain-mipsel_gcc-4.3.3+cs_uClibc-0.9.30.1/stamp/.binutils_installed] Error 1

Sorry, I'm not in front of my Linux box right now... so I was just suggesting something to try w/o testing it myself.  I usually build everything first (i.e. make V=99), then recompile individual packages as needed.  What does "make prereq" tell you?  Just checking if you have all the required tools installed.  You may also try "make toolchain/compile" instead of "make toolchain/install".

For "make toolchain/compile" I get an other error, see below. "make prereq" give nothing back.

/home/kukodajanos/backfire/staging_dir/host/bin/sed -i -e 's/@expr length/@-expr length/' /home/kukodajanos/backfire/build_dir/toolchain-mipsel_gcc-4.3.3+cs_uClibc-0.9.30.1/linux-2.6.32.27/Makefile
--: /home/kukodajanos/backfire/staging_dir/host/bin/sed: No such file or directory
make[2]: *** [/home/kukodajanos/backfire/build_dir/toolchain-mipsel_gcc-4.3.3+cs_uClibc-0.9.30.1/linux-2.6.32.27/.prepared] Error 127

OK, I think I have the solution, first: make tools/install, then make toolchain/install.

(Last edited by kukodajanos on 28 Mar 2011, 21:26)

I would surely like to see you achieve and document a "simple" package compilation/build, but if all you want is nano, have you tried "opkg install nano"?

If you're trying to learn how to build a package, ignore this, and good luck.

Actually it is not about nano, I have it, use it every day, but the tutorial what I mentioned above was about nano. My problem was till today, when I had figured out I need an new package, I had to compile the whole toolchain process from scratch, and I was fed up with this.

OK, these are the commands. Now there is no error, and packages are in bin/ .

svn checkout svn://svn.openwrt.org/openwrt/trunk backfire
./scripts/feeds update
make defconfig
make package/symlinks
make menuconfig

make menuconfig -> check nano and libncurses
make tools/install
make toolchain/install
make target/compile
make package/ncurses/compile
make package/ncurses/install
make package/feeds/packages/nano/compile
make package/feeds/packages/nano/install
make package/index

(Last edited by kukodajanos on 10 Apr 2011, 09:39)

Dear fellows,

I need to compile this file for controlling usbrelay2
          https://forum.openwrt.org/viewtopic.php … 64#p315564
It works in Ubuntu.
Anyway just to start somehow, I want to crosscompile an introductory Hello World. I have the program and Makefile, but it does not works.
I have this wifi router with openWrt Chaos Calmer:
          https://wiki.openwrt.org/toh/asus/rt-n16
I downloaded 15.05 branch (Chaos Calmer) into my Lubuntu:
          git clone git://git.openwrt.org/15.05/openwrt.git
etc. up to:
make menuconfig
make defconfig
make prereq
according:
         https://forum.openwrt.org/viewtopic.php?id=29313

This is the program:
/*
in Ubuntu works this:
gcc -Wall hellowworld.c -o hellowworld
./hellowworld
*/
#include<stdio.h>
int main(void)
{
    printf("\n Hello World \n\n");
    return 0;
}
My non functional Makefile:
include $(TOPDIR)/rules.mk

PKG_NAME:=helloworld
PKG_VERSION:=1.0.0
PKG_RELEASE:=1

PKG_BUILD_DIR:=$(BUILD_DIR)/helloworld-$(PKG_VERSION)
PKG_SOURCE:=helloworld-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@SF/helloworld
PKG_MD5SUM:=9b7dc52656f5cbec846a7ba3299f73bd
PKG_CAT:=zcat

include $(INCLUDE_DIR)/package.mk

define Package/helloworld
  SECTION:=base
  CATEGORY:=General
  TITLE:=Typical starting program "Hello World" written in C
  #DESCRIPTION:=This variable is obsolete. use the Package/name/description define instead!
  URL:=http://www.klimes.us/
endef

define Package/helloworld/description
This is a tutorial, how to cross compile this simple program in C for OpenWrt distribution
endef

define Build/Configure
  $(call Build/Configure/Default,--with-linux-headers=$(LINUX_DIR))
endef

define Package/helloworld/install
        $(INSTALL_DIR) $(1)/usr/sbin
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/brctl/brctl $(1)/usr/sbin/
endef

$(eval $(call BuildPackage,helloworld))

That is all I have. Can you help me a bit. All I need is program usbrelay on command line in ssh switching on off relays over HID USB. First I want to start with simple crosscompiling C programm of Hello world then I will fight with HID USB... :-)
I will provide you any additional information needed, and of course thank you a lot your patience in replying to this obviously trivial question. :-)

The discussion might have continued from here.